Exemple #1
0
        private void BtnStartServer_Click(object sender, RoutedEventArgs e)
        {
            buttonRestartServer.IsEnabled = true;
            buttonStartServer.IsEnabled   = false;
            buttonStopServer.IsEnabled    = true;
            AddMessage("User Start Server: " + serverArgs);
            var acmClose     = Bundle.ACMCloseFlag.CloseOff;
            var acmHeartbeat = Bundle.ACMHeartbeatFlag.HeartbeatOff;

            App.Current.Dispatcher.Invoke(() =>
            {
                Enum.TryParse("Close" + cbServerClose.Text, out acmClose);
                Enum.TryParse("Heartbeat" + cbServerHeartbeat.Text, out acmHeartbeat);
            });
            Thread.Sleep(1);
            Task.Run(() =>
            {
                iceServer.Start(serverArgs, acmClose, acmHeartbeat);
            });
        }
Exemple #2
0
 private void BtnRestartServer_Click(object sender, RoutedEventArgs e)
 {
     buttonRestartServer.IsEnabled = false;
     buttonStartServer.IsEnabled   = false;
     buttonStopServer.IsEnabled    = false;
     AddMessage("User Restart Server: " + serverArgs);
     Task.Run(delegate
     {
         iceServer.OnStatusChanged    -= IceServer_OnStatusChanged;
         iceServer.OnExceptionOccured -= IceServer_OnExceptionOccured;
         iceServer.OnMethodInvoked    -= IceServer_OnMethodInvoked;
         iceServer.Exit();
         Thread.Sleep(serverRestartIntervalMS);
         iceServer = new IceServer();
         iceServer.OnStatusChanged    += IceServer_OnStatusChanged;
         iceServer.OnExceptionOccured += IceServer_OnExceptionOccured;
         iceServer.OnMethodInvoked    += IceServer_OnMethodInvoked;
         Application.Current.Dispatcher.Invoke(delegate
         {
             buttonStopServer.IsEnabled    = true;
             buttonRestartServer.IsEnabled = true;
         });
         var acmClose     = Bundle.ACMCloseFlag.CloseOff;
         var acmHeartbeat = Bundle.ACMHeartbeatFlag.HeartbeatOff;
         App.Current.Dispatcher.Invoke(() =>
         {
             Enum.TryParse("Close" + cbServerClose.Text, out acmClose);
             Enum.TryParse("Heartbeat" + cbServerHeartbeat.Text, out acmHeartbeat);
         });
         Thread.Sleep(1);
         Task.Run(() =>
         {
             iceServer.Start(serverArgs, acmClose, acmHeartbeat);
         });
     });
 }