Ejemplo n.º 1
0
 private void DoService(Action action)
 {
     if (this.machineInfoService != null)
     {
         try
         {
             action();
         }
         catch (ThreadAbortException)
         {
             throw;
         }
         catch (Exception ex)
         {
             this.machineInfoService.Dispose();
             this.machineInfoService = null;
             MessageBox.Show(ex.Message, this.Text);
         }
     }
 }
Ejemplo n.º 2
0
        private void buttonConnect_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            var service = protocolFactory.WaitForClient <IMachineInfoServiceClient>(
                MachineInfoServiceConfiguration.CreateClientAddress(textBoxMachineName.Text),
                MachineInfoServiceConfiguration.EndpointName
                );

            if (service != null)
            {
                if (this.machineInfoService != null)
                {
                    this.machineInfoService.Dispose();
                    this.machineInfoService = null;
                }
                this.machineInfoService = service;
                this.screenInfo         = this.machineInfoService.GetScreenInfo(0);
            }
            else
            {
                MessageBox.Show("Failed to connect.");
            }
            this.Cursor = Cursors.Default;
        }