/// <summary>コンストラクタ</summary> public Form1() { InitializeComponent(); // サーバを起動 string[] args = Environment.CommandLine.Split('/'); args = args[1].Trim().Split(','); // this.NPS this.NPS = args[0].Trim(); this.Text = this.NPS; // this.NPCS this.NPCS = new string[args.Length - 1]; for (int i = 1; i < args.Length; i++) { this.NPCS[i - 1] = args[i].Trim(); } // 初期化 // 初めが自分の名称、 //// 2つ目からが相手の名称 //MessageBox.Show( // "this.NPS:" + this.NPS // + "\r\nthis.NPCS:" + string.Join(",", this.NPCS), // "コマンドラインのチェック"); AsyncEventFx.Init(this.NPS, this.NPCS, 3000); }
/// <summary>エントリを削除</summary> private void button7_Click(object sender, EventArgs e) { AsyncEventFx.UnRegisterAsyncEvent(this.AeeTh); AsyncEventFx.UnRegisterAsyncEvent(this.AeePl); AsyncEventFx.UnRegisterAsyncEvent(this.AeeWin); AsyncEventFx.UnRegisterAsyncEvent(this.AeeWPF); }
/// <summary>WPFのUIInvoke</summary> private void button4_Click(object sender, EventArgs e) { byte[] bytes = BinarySerialize.ObjectToBytes(this.txtMSG.Text); AsyncEventFx.SendAsyncEvent( AsyncEventEnum.EventClass.WPF, "WPF", AsyncEventEnum.EventClass.WPF, "WPF", this.NPCS[1], this.NPS, (uint)bytes.Length, bytes); }
/// <summary>WPFのThreadPool</summary> private void button2_Click(object sender, RoutedEventArgs e) { byte[] bytes = BinarySerialize.ObjectToBytes(this.txtMSG.Text); AsyncEventFx.SendAsyncEvent( AsyncEventEnum.EventClass.ThreadPool, "ThreadPool", AsyncEventEnum.EventClass.ThreadPool, "ThreadPool", this.NPCS[0], this.NPS, (uint)bytes.Length, bytes); }
/// <summary>へんなところ</summary> private void button5_Click(object sender, RoutedEventArgs e) { byte[] bytes = BinarySerialize.ObjectToBytes(this.txtMSG.Text); AsyncEventFx.SendAsyncEvent( AsyncEventEnum.EventClass.WinForm, "いいい", AsyncEventEnum.EventClass.WinForm, "いいい", this.NPCS[1], "あああ", (uint)bytes.Length, bytes); //this.NPCS[1], this.NPS, (uint)bytes.Length, bytes); }
/// <summary>初期処理</summary> private void Form1_Load(object sender, EventArgs e) { // 登録エントリ // スレッド this.AeeTh = new AsyncEventEntry( AsyncEventEnum.EventClass.Thread, "Thread", null, new ParameterizedThreadStart(this.ParameterizedThreadStartDgt)); AsyncEventFx.RegisterAsyncEvent(this.AeeTh); // --- // スレッド プール this.AeePl = new AsyncEventEntry( AsyncEventEnum.EventClass.ThreadPool, "ThreadPool", null, new WaitCallback(this.WaitCallbackDgt)); AsyncEventFx.RegisterAsyncEvent(this.AeePl); // --- // WinForm this.AeeWin = new AsyncEventEntry( AsyncEventEnum.EventClass.WinForm, "WinForm", this, new AsyncEventFx.SetResultDelegate(this.SetResultDgt)); AsyncEventFx.RegisterAsyncEvent(this.AeeWin); // --- // WPF this.AeeWPF = new AsyncEventEntry( AsyncEventEnum.EventClass.WPF, "WPF", this, new AsyncEventFx.SetResultDelegate(this.SetResultDgt)); AsyncEventFx.RegisterAsyncEvent(this.AeeWPF); }
/// <summary>終了処理</summary> private void Form1_FormClosed(object sender, FormClosedEventArgs e) { // 終了 AsyncEventFx.Final(); }
// ↑↓どっち?? /// <summary>クローズ</summary> private void Window_Closed(object sender, EventArgs e) { // 終了 AsyncEventFx.Final(); }
/// <summary>アンロード</summary> private void Window_Unloaded(object sender, RoutedEventArgs e) { // 終了 AsyncEventFx.Final(); }