mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
reorganize tester project
This commit is contained in:
parent
d4c5b20e97
commit
682dc71c14
2
CSharpTranslator/.gitignore
vendored
Normal file
2
CSharpTranslator/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.pidb
|
||||
|
66
CSharpTranslator/tests/Tester/Delegates/EventHandler.cs
Normal file
66
CSharpTranslator/tests/Tester/Delegates/EventHandler.cs
Normal file
@ -0,0 +1,66 @@
|
||||
// This example demonstrates the EventHandler<T> delegate.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Tester.Delegates.EventHandler
|
||||
{
|
||||
//---------------------------------------------------------
|
||||
public class MyEventArgs : EventArgs
|
||||
{
|
||||
private string msg;
|
||||
|
||||
public MyEventArgs (string messageData)
|
||||
{
|
||||
msg = messageData;
|
||||
}
|
||||
public string Message {
|
||||
get { return msg; }
|
||||
set { msg = value; }
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------
|
||||
public class HasEvent
|
||||
{
|
||||
// Declare an event of delegate type EventHandler of
|
||||
// MyEventArgs.
|
||||
|
||||
public event EventHandler<MyEventArgs> SampleEvent;
|
||||
|
||||
public void DemoEvent (string val)
|
||||
{
|
||||
// Copy to a temporary variable to be thread-safe.
|
||||
EventHandler<MyEventArgs> temp = SampleEvent;
|
||||
if (temp != null)
|
||||
temp (this, new MyEventArgs (val));
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------
|
||||
public class Sample
|
||||
{
|
||||
public static void EHMain ()
|
||||
{
|
||||
HasEvent he = new HasEvent ();
|
||||
he.SampleEvent += new EventHandler<MyEventArgs> (SampleEventHandler);
|
||||
he.DemoEvent ("Hey there, Bruce!");
|
||||
he.DemoEvent ("How are you today?");
|
||||
he.DemoEvent ("I'm pretty good.");
|
||||
he.DemoEvent ("Thanks for asking!");
|
||||
}
|
||||
private static void SampleEventHandler (object src, MyEventArgs mea)
|
||||
{
|
||||
Console.WriteLine (mea.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------
|
||||
/*
|
||||
This example produces the following results:
|
||||
|
||||
Hey there, Bruce!
|
||||
How are you today?
|
||||
I'm pretty good.
|
||||
Thanks for asking!
|
||||
|
||||
*/
|
||||
|
@ -7,8 +7,8 @@ namespace Tester
|
||||
{
|
||||
}
|
||||
|
||||
public static const int Enuma = 2;
|
||||
public static const int Enumb = 44;
|
||||
public const int Enuma = 2;
|
||||
public const int Enumb = 44;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,9 @@ namespace Tester
|
||||
|
||||
//Tester.RefOut.RefOutTest.RefOutMain(args);
|
||||
|
||||
Tester.PartialUser.PartialMain(args);
|
||||
//Tester.PartialUser.PartialMain(args);
|
||||
|
||||
Tester.Delegates.EventHandler.Sample.EHMain();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -41,19 +41,21 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="DelegateUser.cs" />
|
||||
<Compile Include="Generics.cs" />
|
||||
<Compile Include="Misc.cs" />
|
||||
<Compile Include="RefOut.cs" />
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="PartialUser.cs" />
|
||||
<Compile Include="PartialUserTwo.cs" />
|
||||
<Compile Include="PartialInner.cs" />
|
||||
<Compile Include="FullOuterPartialInner.cs" />
|
||||
<Compile Include="PartialOuterPartialInner.cs" />
|
||||
<Compile Include="PartialOuterPartialInnerB.cs" />
|
||||
<Compile Include="Enums\PacketTester.cs" />
|
||||
<Compile Include="Enums\Consts.cs" />
|
||||
<Compile Include="Generics\Generics.cs" />
|
||||
<Compile Include="Partial\PartialUserTwo.cs" />
|
||||
<Compile Include="Partial\PartialInner.cs" />
|
||||
<Compile Include="Partial\PartialOuterPartialInner.cs" />
|
||||
<Compile Include="Partial\PartialOuterPartialInnerB.cs" />
|
||||
<Compile Include="Partial\PartialUser.cs" />
|
||||
<Compile Include="Partial\FullOuterPartialInner.cs" />
|
||||
<Compile Include="Misc\MiscSyntax.cs" />
|
||||
<Compile Include="Misc\RefOut.cs" />
|
||||
<Compile Include="Misc\Misc.cs" />
|
||||
<Compile Include="Delegates\DelegateUser.cs" />
|
||||
<Compile Include="Delegates\EventHandler.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
|
Loading…
x
Reference in New Issue
Block a user