Guest User

Untitled

a guest
Jul 15th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5.  
  6. namespace moa.test.remote.client {
  7.  
  8.  
  9. /// <summary>
  10. ///
  11. /// </summary>
  12. class MoaRemoteClientSample {
  13. /// <summary>
  14. ///
  15. /// </summary>
  16. /// <param name="args"></param>
  17. public void run(string[] args) {
  18. Console.WriteLine( "client start" );
  19. Console.WriteLine( AppDomain.CurrentDomain.SetupInformation.ApplicationName.ToString() );
  20. Console.Write( "regist start, please enter " );
  21. Console.ReadKey();
  22.  
  23. RemoteClient client = new RemoteClient();
  24. IRemoteObject server_remote_object = client.createRemoteScreenObject( "localhost",
  25. "remortobj",
  26. typeof( IRemoteObject )
  27. ) as IRemoteObject;
  28.  
  29. RemoteObject client_remote_object = new RemoteObject();
  30.  
  31. client_remote_object.sendMessage += new SendMessageEventHandler( messageSend ); // たぶんクライアントでうごいてる
  32. server_remote_object.sendMessage += new SendMessageEventHandler( client_remote_object.onMessageSend ); // たぶんサーバでうごいてる
  33. //server_remote_object.sendMessage += new MesSendEventHandler( messageSend );<-これだけだとサーバ内で発生
  34.  
  35. Console.WriteLine( "regist messageSend success" );
  36. Console.ReadKey();
  37. server_remote_object.onMessageSend();
  38. Console.ReadKey();
  39. }
  40.  
  41.  
  42. /// <summary>
  43. ///
  44. /// </summary>
  45. static void messageSend() {
  46. //Console.WriteLine( AppDomain.CurrentDomain.SetupInformation.ApplicationName.ToString() );
  47. Console.WriteLine( "クライアント待ちうけイベントだよっ!" );
  48. }
  49.  
  50.  
  51. /// <summary>
  52. ///
  53. /// </summary>
  54. /// <param name="args"></param>
  55. static void Main(string[] args) {
  56. MoaRemoteClientSample progn = new MoaRemoteClientSample();
  57.  
  58. progn.run( args );
  59. }
  60. }
  61.  
  62.  
  63. }
Add Comment
Please, Sign In to add comment