public WCFHostServiceState(ViewModel model, TaskScheduler scheduler)
 {
     Model            = model;
     Scheduler        = scheduler;
     GetTraceSessions = CreateGetTraceSessions();
     AsyncInitializer = CreateService();
     AsyncInitializer.Execute();
 }
        public void Restart()
        {
            if (Host != null)
            {
                Host.Close();
                Host = null;
            }

            AsyncInitializer = CreateService();
            AsyncInitializer.Execute();
        }
 void CreateAndExecuteStartCommand()
 {
     StartCommand = new AsyncUICommand(() =>
     {
         Sender = new MessageSender(Model.Host, Model.PortNumber, NetworkProtocolType.TCP);
     },
                                       Model, Scheduler)
     {
         Started       = String.Format("Connected to {0}", Model.Host),
         Starting      = String.Format("Connecting to server {0}:{1} ...", Model.Host, Model.PortNumber),
         StartingError = String.Format("Failed to connect to server {0}:{1} ...", Model.Host, Model.PortNumber),
     };
     StartCommand.Execute();
 }
Beispiel #4
0
 void CreateAndExecuteStartCommand()
 {
     StartCommand = new AsyncUICommand(() =>
     {
         Receiver = new MessageReceiver(Model.PortNumber, NetworkProtocolType.TCP);
         Receiver.OnMessageReceived += Receiver_OnMessageReceived;
     },
                                       Model, Scheduler)
     {
         Started       = String.Format("Server started at port {0}", Model.PortNumber),
         Starting      = String.Format("Starting server at port {0}", Model.PortNumber),
         StartingError = "Failed to start server ",
     };
     StartCommand.Execute();
 }
 void CreateAndExecuteStopCommand()
 {
     StopCommand = new AsyncUICommand(() =>
     {
         if (Sender != null)
         {
             Sender.Dispose();
             Sender = null;
         }
     },
                                      Model, Scheduler)
     {
         Started       = String.Format("Closed connection to {0}", Model.Host),
         Starting      = String.Format("Closing connection to {0}:{1}", Model.Host, Model.PortNumber),
         StartingError = String.Format("Error while closing connection to server {0}:{1} ...", Model.Host, Model.PortNumber),
     };
     StopCommand.Execute();
 }
Beispiel #6
0
        void CreateAndExecuteStopCommand()
        {
            StopCommand = new AsyncUICommand(() =>
            {
                var tmp = Receiver;

                if (Receiver != null)
                {
                    Receiver.OnMessageReceived -= Receiver_OnMessageReceived;
                    Receiver.Dispose();
                    Receiver = null;
                }
            }, Model, Scheduler)
            {
                Starting      = String.Format("Closing server port {0}", Model.PortNumber),
                Started       = String.Format("Closed server port {0}", Model.PortNumber),
                StartingError = String.Format("Failed to stop server port {0}", Model.PortNumber),
            };
            StopCommand.Execute();
        }