Пример #1
0
            private void DeleteServerToolStripButton_Click ( object sender, EventArgs e )
            {
               DialogResult result = DialogResult.Yes;


               if ( null == WorkstationService ) 
               {
                  return ;
               }
               
               if ( WorkstationService.Status == ServiceControllerStatus.Running )
               {
                   result = ThreadSafeMessager.ShowQuestion ( "Service is currently running\r\nDo you want to stop and delete?",
                                                              MessageBoxButtons.YesNo ) ;
                                              
                   if (result == DialogResult.Yes)
                   {
                       WorkstationService.Stop();
                       
                       while ( WorkstationService.Status != ServiceControllerStatus.Stopped )
                       {
                           Application.DoEvents ( ) ;
                       }
                   }
               }

               if ( result == DialogResult.Yes )
               {
                  try
                  {
                     string serviceName ;
                     
                     
                     serviceName = ServiceManager.ServiceName ;
                     
                     UnInstallService ( ) ;
                       
                     LEADStorageServiceAELabel.Text = string.Empty ;
                     IpAddressLabel.Text            = string.Empty;
                     ServerPortLabel.Text           = string.Empty;

                     AeTitlesListView.Items.Clear();
                       
                     ThreadSafeMessager.ShowInformation (  "Service successfully uninstalled" ) ;
                       
                     WorkstationService = null ;
                     
                     OnWorkstationServiceDeleted ( this, new WorkstationServiceEventArgs ( serviceName, null ) ) ;
                  }
                  catch (Exception ex)
                  {
                     ThreadSafeMessager.ShowError (  ex.Message );
                  }
               }
               
               HandleStatusChange ( ) ;
           }
Пример #2
0
 private void toolStripButtonStop_Click ( object sender, EventArgs e )
 {
    try
    {
       WorkstationService.Stop ( ) ;
    }
    catch ( Exception exception )
    {
       System.Diagnostics.Debug.Assert ( false, exception.Message ) ;
                      
       ThreadSafeMessager.ShowError (  exception.Message ) ;
    }
 }