Initial import!

This commit is contained in:
markpollack
2008-05-30 22:55:02 +00:00
commit c478a783c0
2978 changed files with 510966 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.IocQuickStart.EventRegistry.2003", "src/Spring.IocQuickStart.EventRegistry.2003.csproj", "{0D35F19E-308E-4A0B-88B1-7E7C2D665053}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{0D35F19E-308E-4A0B-88B1-7E7C2D665053}.Debug.ActiveCfg = Debug|.NET
{0D35F19E-308E-4A0B-88B1-7E7C2D665053}.Debug.Build.0 = Debug|.NET
{0D35F19E-308E-4A0B-88B1-7E7C2D665053}.Release.ActiveCfg = Release|.NET
{0D35F19E-308E-4A0B-88B1-7E7C2D665053}.Release.Build.0 = Release|.NET
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.IocQuickStart.EventRegistry.2005", "src/Spring.IocQuickStart.EventRegistry.2005.csproj", "{0D35F19E-308E-4A0B-88B1-7E7C2D665053}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0D35F19E-308E-4A0B-88B1-7E7C2D665053}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D35F19E-308E-4A0B-88B1-7E7C2D665053}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D35F19E-308E-4A0B-88B1-7E7C2D665053}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D35F19E-308E-4A0B-88B1-7E7C2D665053}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" ?>
<project name="Spring.IocQuickStart.EventRegistry" default="build" xmlns="http://nant.sf.net/schemas/nant.xsd">
<!--
Required properties:
* current.bin.dir - (path) root level to build to
* current.build.debug - (true|false) debug build?
* current.build.defines.csc - framework-specific build defines for C# compiler
-->
<target name="build">
<!-- build EventRegistry example -->
<csc target="exe"
define="${current.build.defines.csc}"
warnaserror="true"
debug="${current.build.debug}"
output="${current.bin.dir}/${project::get-name()}.exe">
<sources failonempty="true">
<include name="**/*.cs" />
</sources>
<nowarn>
<warning number="${nowarn.numbers}" />
</nowarn>
<references basedir="${current.bin.dir}">
<include name="Spring.Core.dll" />
</references>
</csc>
<copy tofile="${current.bin.dir}/${project::get-name()}.exe.config"
file="src/App.config" overwrite="true">
</copy>
</target>
</project>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core" />
<section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
</sectionGroup>
</configSections>
<spring>
<context>
<resource uri="config://spring/objects" />
</context>
<objects xmlns="http://www.springframework.net">
<description>An example demonstrating the event registry.</description>
<object name="MyEventPublisher"
type="Spring.IocQuickStart.EventRegistry.MyEventPublisher, Spring.IocQuickStart.EventRegistry"
singleton="false">
<property name="PublisherName" value="My event publisher" />
</object>
<object name="MyEventSubscriber"
type="Spring.IocQuickStart.EventRegistry.MyEventSubscriber, Spring.IocQuickStart.EventRegistry"
singleton="false" />
</objects>
</spring>
</configuration>

View File

@@ -0,0 +1,43 @@
#region License
/*
* Copyright <20> 2002-2006 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#endregion
#region Imports
using System;
#endregion
namespace Spring.IocQuickStart.EventRegistry
{
public class MyClientEventArgs : EventArgs
{
private string _eventMessage;
public MyClientEventArgs(string eventMessage)
{
_eventMessage = eventMessage;
}
public string EventMessage
{
get { return _eventMessage; }
}
}
}

View File

@@ -0,0 +1,49 @@
#region License
/*
* Copyright 2002-2006 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#endregion
namespace Spring.IocQuickStart.EventRegistry
{
public delegate void SimpleClientEvent(object sender, MyClientEventArgs args);
public class MyEventPublisher
{
private string _publisherName;
public event SimpleClientEvent MyClientEvent1;
public MyEventPublisher()
{
}
public string PublisherName
{
get { return _publisherName; }
set { _publisherName = value; }
}
public void ClientMethodThatTriggersEvent1()
{
if (MyClientEvent1 != null)
{
MyClientEvent1(this, new MyClientEventArgs("Event 1 raised from " + _publisherName));
}
}
}
}

View File

@@ -0,0 +1,58 @@
#region License
/*
* Copyright 2002-2006 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#endregion
#region Imports
using System;
#endregion
namespace Spring.IocQuickStart.EventRegistry
{
public class MyEventSubscriber
{
private bool _eventHandled = false;
public MyEventSubscriber()
{
}
public void HandleClientEvents(object sender, MyClientEventArgs args)
{
Console.WriteLine("HandleClientEvents handler in subscriber handled event with args: " + args.EventMessage);
_eventHandled = true;
}
public bool EventHandled
{
get { return _eventHandled; }
}
public void NeverCall()
{
throw new Exception();
}
public string FakeEventHandler(object sender, MyClientEventArgs args)
{
throw new Exception();
}
}
}

View File

@@ -0,0 +1,96 @@
#region License
/*
* Copyright <20> 2002-2006 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#endregion
#region Imports
using System;
using Spring.Context;
using Spring.Context.Support;
#endregion
namespace Spring.IocQuickStart.EventRegistry
{
/// <summary>
/// Small example application showing how objects can publish their events
/// to an IApplicationContex.
/// </summary>
/// <remarks>
/// <p>
/// The example then goes on to illustrate how subscribers can subscribe to
/// any events by notifying an IApplicationContext instance. The context
/// will only wire events and event handlers if they have compatible
/// signatures.
/// </p>
/// </remarks>
public sealed class Program
{
/// <summary>
/// In this example, the subscriber is subscribing by publisher type.
/// </summary>
[STAThread]
public static void Main()
{
try
{
// Retrieve context defined in the spring/context section of
// the standard .NET configuration file.
using (IApplicationContext ctx = ContextRegistry.GetContext())
{
// gets the publisher from the application context...
MyEventPublisher publisher = (MyEventPublisher) ctx.GetObject("MyEventPublisher");
// publishes events to the context...
ctx.PublishEvents(publisher);
// gets first instance of subscriber...
MyEventSubscriber subscriber = (MyEventSubscriber) ctx.GetObject("MyEventSubscriber");
// gets second instance of subscriber...
MyEventSubscriber subscriber2 = (MyEventSubscriber) ctx.GetObject("MyEventSubscriber");
// subscribes the first instance to any events published by the MyEventPublisher type...
ctx.Subscribe(subscriber, typeof (MyEventPublisher));
Console.WriteLine("Publisher name: " + publisher.PublisherName);
// must be false for both subscribers as no event has yet been raised...
Console.WriteLine("Subscriber 1 Event Handled: " + subscriber.EventHandled);
Console.WriteLine("Subscriber 2 Event Handled: " + subscriber2.EventHandled);
// raises a publisher event...
publisher.ClientMethodThatTriggersEvent1();
// must be true (subscribed to any events)...
Console.WriteLine("Subscriber 1 Event Handled: " + subscriber.EventHandled);
// must be false (did not subscribe to any events)...
Console.WriteLine("Subscriber 2 Event Handled: " + subscriber2.EventHandled);
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
finally
{
Console.WriteLine();
Console.WriteLine("--- hit <return> to quit ---");
Console.ReadLine();
}
}
}
}

View File

@@ -0,0 +1,109 @@
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{0D35F19E-308E-4A0B-88B1-7E7C2D665053}"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "Spring.IocQuickStart.EventRegistry"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Exe"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "Spring.IocQuickStart"
RunPostBuildEvent = "OnBuildSuccess"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
/>
<Reference
Name = "Spring.Core"
AssemblyName = "Spring.Core"
HintPath = "..\..\..\..\bin\net\1.1\debug\Spring.Core.dll"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "App.config"
BuildAction = "None"
/>
<File
RelPath = "EventRegistry\MyClientEventArgs.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "EventRegistry\MyEventPublisher.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "EventRegistry\MyEventSubscriber.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "EventRegistry\Program.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>

View File

@@ -0,0 +1,100 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0D35F19E-308E-4A0B-88B1-7E7C2D665053}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>Spring.IocQuickStart.EventRegistry</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Exe</OutputType>
<RootNamespace>Spring.IocQuickStart</RootNamespace>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<StartupObject>Spring.IocQuickStart.EventRegistry.Program</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG;NET_2_0</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;NET_2_0</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>false</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>none</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="Spring.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\bin\net\2.0\debug\Spring.Core.dll</HintPath>
</Reference>
<Reference Include="System">
<Name>System</Name>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="EventRegistry\MyClientEventArgs.cs" />
<Compile Include="EventRegistry\MyEventPublisher.cs" />
<Compile Include="EventRegistry\MyEventSubscriber.cs" />
<Compile Include="EventRegistry\Program.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>