Example #1
0
 private void AfterAuth()
 {
     new Thread(new ThreadStart(() =>
     {
         this.Dispatcher.Invoke(new Action(() => { this.Hide(); }));
         ListCoWorkers();
         int port = InitWebSocketServer();
         this.Dispatcher.Invoke(new Action(() => { mswin.confirm("Getting Status of Shared Users..."); }));
         RegistrationServer.register(global.Email, port);
         var IAddressMap = RegistrationServer.getAddressMap(global.CoWorkers);
         foreach (SharedUser user in global.CoWorkers)
         {
             if (IAddressMap.Keys.Contains(user.Email))
             {
                 user.setStatus(true);
             }
             else
             {
                 user.setStatus(false);
             }
         }
         this.Dispatcher.Invoke(new Action(() =>
         {
             SecondStepGrid.Visibility = System.Windows.Visibility.Visible;
             userGrid.ItemsSource      = global.CoWorkers;
             mswin.Hide();
             this.Show();
         }));
         ConnectCoWorkers(IAddressMap);
     })).Start();
 }
Example #2
0
 private void exitProgram()
 {
     RegistrationServer.close();
     if (webServer != null)
     {
         webServer.Stop();
     }
     for (int i = 0; i < WebSocketPool.Count; i++)
     {
         WebSocketPool.Values.ElementAt(i).Close();
     }
     if (keyboardHook != null)
     {
         keyboardHook.UninstallHook();
     }
     if (flowMeasureDevicePool != null)
     {
         flowMeasureDevicePool.Dispose();
     }
     Application.Current.Shutdown();
 }