private void InitializeService ( )
 {
    try
    {
       if ( InvokeRequired ) 
       {
          Invoke ( new MethodInvoker ( delegate ( ) 
          {
             InitializeService ( ) ;
          } ) ) ;
          
          return ;
       }
       
       InitServiceInformation ( ) ;
       
       if ( ( null != WorkstationService ) && ( WorkstationService.Status == ServiceControllerStatus.Running ) ) 
       {
          AeTitlesListView.Items.Clear ( ) ;
          
          //
          // Request server ae titles
          //    
          WorkstationService.SendMessage ( MessageNames.GetAeTitles ) ;
       }
    }
    catch ( Exception ex )
    {
       ThreadSafeMessager.ShowError( "Error sending message.\n" + ex.Message );
    }
 }
            private void toolStripButtonEditServer_Click ( object sender, EventArgs e )
            {
               try
               {
                  EditServiceDialog dialog ;
                  
                  
                  dialog = new EditServiceDialog ( ) ;

                  dialog.Settings    = AddInUtils.Clone <ServerSettings> ( WorkstationService.Settings ) ;
                  dialog.ServiceName = ServiceManager.ServiceName ;
                  dialog.Mode        = EditServiceDialog.EditMode.EditServer ;
                  
                  if ( dialog.ShowDialog ( this ) == DialogResult.OK )
                  {
                     WorkstationService.Settings = dialog.Settings ;
                     
                     LEADStorageServiceAELabel.Text = WorkstationService.Settings.AETitle ;
                     IpAddressLabel.Text            = WorkstationService.Settings.IpAddress ;
                     ServerPortLabel.Text           = WorkstationService.Settings.Port.ToString ( ) ;
                     
                     OnWorkstationServiceChanged ( this, new WorkstationServiceEventArgs ( WorkstationService.ServiceName, WorkstationService ) ) ;
                  }
               }
               catch ( Exception exception )
               {
                  System.Diagnostics.Debug.Assert ( false, exception.Message ) ;
                                 
                  ThreadSafeMessager.ShowError (  exception.Message ) ;
               }
            }
        public void OnDisplayedControlChanged(string uiElement)
        {
            try
            {
                this.BackColor = ControlsDisplayPanel.BackColor;

                foreach (Control control in ContainerItemsAutoHidePanel.Controls)
                {
                    if (control is Button)
                    {
                        if (control.BackColor == Color.LightGray)
                        {
                            control.BackColor = Color.DimGray;
                        }
                    }
                }

                if (_buttonsFeatures.ContainsKey(uiElement))
                {
                    _buttonsFeatures[uiElement].BackColor = Color.LightGray;
                }
            }
            catch (Exception exception)
            {
                ThreadSafeMessager.ShowError(exception.Message);
            }
        }
            private void toolStripButtonAddAeTitle_Click ( object sender, EventArgs e )
            {
               try
               {
                  EditAeTitleDialog dialog ;
                  
                  
                  dialog = new EditAeTitleDialog ( ) ;

                  if ( dialog.ShowDialog ( this ) == DialogResult.OK )
                  {
                     AeInfo newAeInfo = AddInUtils.Clone<AeInfo> ( dialog.AeInfo ) ;
                     
                     
                     newAeInfo.Address = newAeInfo.Address ;
                     
                     try
                     {
                        WorkstationService.SendMessage ( MessageNames.AddAeTitle, newAeInfo ) ;
                     }
                     catch ( Exception ex )
                     {
                        ThreadSafeMessager.ShowError (  "Error sending message.\n" + ex.Message ) ;
                     }
                  }
               }
               catch ( Exception exception )
               {
                  System.Diagnostics.Debug.Assert ( false, exception.Message ) ;
                                 
                  ThreadSafeMessager.ShowError (  exception.Message ) ;
               }
            }
        void __WorkstationViewer_SeriesDropLoaderRequested(object sender, SeriesDropLoaderRequestedEventArgs e)
        {
            try
            {
                MedicalViewerLoader loader;


                if (!ConfigurationData.SupportLocalQueriesStore)
                {
                    loader = new MedicalViewerLoader(DicomClientFactory.CreateRetrieveClient( ));
                }
                else
                {
                    loader = new MedicalViewerLoader(DicomClientFactory.CreateLocalRetrieveClient( ));
                }

                InitMedicalViewerLoader(loader);

                e.SeriesLoader = loader;
            }
            catch (Exception exception)
            {
                ThreadSafeMessager.ShowError(exception.Message);
            }
        }
        void StudyNodesTreeView_AfterCheck(object sender, TreeViewEventArgs e)
        {
            try
            {
                VerifyInstanceCheckState(e.Node);

                if (isUpdating)
                {
                    return;
                }

                isUpdating = true;

                try
                {
                    ApplyCheckToChilds(e.Node);

                    ApplyCheckToParents(e.Node);
                }
                finally
                {
                    isUpdating = false;
                }
            }
            catch (Exception exception)
            {
                ThreadSafeMessager.ShowError(exception.Message);
            }
        }
            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 ( ) ;
           }
 void fullScreenCmd_CommandExecuted(object sender, EventArgs e)
 {
     try
     {
         View.OnFullScreenChanged((( ToggleFullScreenCommand )sender).FullScreen);
     }
     catch (Exception exception)
     {
         ThreadSafeMessager.ShowError(exception.Message);
     }
 }
Example #9
0
 private void Instance_SeriesReady(object sender, SeriesInformationEventArgs e)
 {
     try
     {
         LoadSeriesInViewer(e.PatientId, e.StudyInstanceUID, e.SeriesInstanceUID, DicomClientMode.LocalDb);
     }
     catch (Exception exception)
     {
         ThreadSafeMessager.ShowError(exception.Message);
     }
 }
 private void btnSaveChanges_Click(object sender, EventArgs e)
 {
     try
     {
         SaveChanges( );
     }
     catch (Exception exception)
     {
         ThreadSafeMessager.ShowError(exception.Message);
     }
 }
 private void __SearchStudies_DisplayViewer(object sender, EventArgs e)
 {
     try
     {
         ExecuteFeature(UIElementKeys.WorkstationViewer);
     }
     catch (Exception exception)
     {
         ThreadSafeMessager.ShowError(exception.Message);
     }
 }
        //private MediaBurningManagerController <IMediaInformationView> __MediaCreationController
        //{
        //   get ;
        //   set ;
        //}

        #endregion

        #region Events

        void btnLogOut_Click(object sender, EventArgs e)
        {
            try
            {
                OnLogOutRequested(this, e);
            }
            catch (Exception exception)
            {
                ThreadSafeMessager.ShowError(exception.Message);
            }
        }
 void FeatureButton_Click(object sender, EventArgs e)
 {
     try
     {
         (((Button)sender).Tag as Action).Invoke( );
     }
     catch (Exception exception)
     {
         ThreadSafeMessager.ShowError(exception.Message);
     }
 }
 private void __SearchStudies_AddSeriesToLocalMediaBurning(object sender, ProcessSeriesEventArgs e)
 {
     try
     {
         __LocalMediaCreationController.AddSeriesToBurningManager(e.Study, e.Series);
     }
     catch (Exception exception)
     {
         ThreadSafeMessager.ShowError(exception.Message);
     }
 }
 void ClearButton_Click(object sender, EventArgs e)
 {
     try
     {
         ClearItems( );
     }
     catch (Exception exception)
     {
         ThreadSafeMessager.ShowError(exception.Message);
     }
 }
 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 ) ;
    }
 }
        void MediaTitleTextBox_TextChanged(object sender, EventArgs e)
        {
            try
            {
                _mediaTitleErrorProv.SetError(MediaTitleTextBox, null);

                OnMediaTitleChanged( );
            }
            catch (Exception exception)
            {
                ThreadSafeMessager.ShowError(exception.Message);
            }
        }
        public void SetHelpNamescpace(string helpNamespace)
        {
            try
            {
                _helpProvider.HelpNamespace = ConfigurationData.HelpFile;

                _helpProvider.SetShowHelp(this, true);
            }
            catch (Exception exception)
            {
                ThreadSafeMessager.ShowError(exception.Message);
            }
        }
        private void __SearchStudies_RetrieveSeries(object sender, StoreSeriesEventArgs e)
        {
            try
            {
                PopulateState(e.Study, e.Series);

                if (!__QueueManager.Visible)
                {
                    __QueueManager.Show(View.DisplayContainer);
                }

                DicomScp                 scp;
                string                   patientID;
                string                   description;
                PacsRetrieveClient       client;
                RetrieveQueueItemCommand retrieveCommand;


                scp = new DicomScp( );

                scp.AETitle     = e.Server.AETitle;
                scp.PeerAddress = Utils.ResolveIPAddress(e.Server.Address);
                scp.Port        = e.Server.Port;
                scp.Timeout     = e.Server.Timeout;
                scp.Secure      = e.Server.Secure;

                patientID = e.Study.IsPatientIDNull( ) ? string.Empty : e.Study.PatientID;

                description = string.Format(SeriesInfo,
                                            e.Study.IsPatientNameNull( ) ? string.Empty : e.Study.PatientName,
                                            patientID,
                                            e.Series.IsSeriesNumberNull( ) ? string.Empty : e.Series.SeriesNumber,
                                            e.Series.IsModalityNull( ) ? string.Empty : e.Series.Modality);


                client = DicomClientFactory.CreatePacsRetrieveClient(scp);

                retrieveCommand = new RetrieveQueueItemCommand(new SeriesInformation(patientID,
                                                                                     e.Study.StudyInstanceUID,
                                                                                     e.Series.SeriesInstanceUID,
                                                                                     description),
                                                               client);


                __QueueManager.AddCommand(retrieveCommand);
            }
            catch (Exception exception)
            {
                ThreadSafeMessager.ShowError(exception.Message);
            }
        }
            private void Init ( ) 
            {
               try
               {
                  string serviceName = null ;
                  
                  
                  EventLogViewerToolStripButton.Enabled = EventLogViewer != null ;
                  
                  serviceName = ConfigurationData.ListenerServiceName ;
                     
                  if ( string.IsNullOrEmpty ( serviceName ) )
                  {
                     serviceName = ConfigurationData.ListenerServiceDefaultName ;
                  }

                  CreateServiceManager ( ) ;
                  
                  WorkstationService = ServiceManager.LoadWorkstationListenerService ( serviceName ) ;
                  
                  if ( null == WorkstationService )
                  {
                     try
                     {
                        WorkstationService = CreateDefaultWorkStationService ( ) ;
                     }
                     catch ( Exception ex ) 
                     {
                        ThreadSafeMessager.ShowError (  ex.Message ) ;
                        
                        WorkstationService = null ;
                     }
                  }
                  
                  HandleStatusChange ( ) ;
                  
                  if ( null == WorkstationService ) 
                  {
                     ThreadSafeMessager.ShowWarning (  "No Listener service installed." ) ; 
                  }
               }
               catch ( Exception exception )
               {
                  System.Diagnostics.Debug.Assert ( false, exception.Message ) ;
                  
                  HandleStatusChange ( ) ;
                  
                  throw ;
               }
            }
 void MediaBaseFolderTextBox_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (null != MediaBaseFolderChanged)
         {
             MediaBaseFolderChanged(this, e);
         }
     }
     catch (Exception exception)
     {
         ThreadSafeMessager.ShowError(exception.Message);
     }
 }
Example #22
0
 void ServerAEComboBox_SelectionChangeCommitted(object sender, EventArgs e)
 {
     try
     {
         if (null != SelectedServerChanged)
         {
             SelectedServerChanged(this, e);
         }
     }
     catch (Exception exception)
     {
         ThreadSafeMessager.ShowError(exception.Message);
     }
 }
 void CreateAutoRunCheckBox_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (null != CreateAutoRunChanged)
         {
             CreateAutoRunChanged(this, e);
         }
     }
     catch (Exception exception)
     {
         ThreadSafeMessager.ShowError(exception.Message);
     }
 }
 void CheckActionAllButton_Click(object sender, EventArgs e)
 {
     try
     {
         foreach (TreeNode node in StudyNodesTreeView.Nodes)
         {
             ApplyAction(node, (Action <TreeNode>)(( Button )sender).Tag);
         }
     }
     catch (Exception exception)
     {
         ThreadSafeMessager.ShowError(exception.Message);
     }
 }
 void CheckActionSelectedButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (null != StudyNodesTreeView.SelectedNode)
         {
             ApplyAction(StudyNodesTreeView.SelectedNode, (Action <TreeNode>)(( Button )sender).Tag);
         }
     }
     catch (Exception exception)
     {
         ThreadSafeMessager.ShowError(exception.Message);
     }
 }
        void WorkstationConfiguration_Load(object sender, EventArgs e)
        {
            try
            {
                SaveChangesButton.Enabled = false;

                RegisterEvents( );

                WorkstationClientToolStripButton.PerformClick( );
            }
            catch (Exception exception)
            {
                ThreadSafeMessager.ShowError(exception.Message);
            }
        }
        void __SearchStudies_LoadSeries(object sender, ProcessSeriesEventArgs e)
        {
            try
            {
                PopulateState(e.Study, e.Series);

                LoadSeriesInViewer(e.Study.PatientID,
                                   e.Study.StudyInstanceUID,
                                   e.Series.SeriesInstanceUID,
                                   ConfigurationData.ClientBrowsingMode);
            }
            catch (Exception exception)
            {
                ThreadSafeMessager.ShowError(exception.Message);
            }
        }
        void btnDicomSecurity_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.Validate())
                {
                    ControlsAreaPanel.Controls.Clear();

                    ControlsAreaPanel.Controls.Add(_securityOptionsView);
                }
            }
            catch (Exception exception)
            {
                ThreadSafeMessager.ShowError(exception.Message);
            }
        }
        void btnPACS_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.Validate( ))
                {
                    ControlsAreaPanel.Controls.Clear( );

                    ControlsAreaPanel.Controls.Add(_servers);
                }
            }
            catch (Exception exception)
            {
                ThreadSafeMessager.ShowError(exception.Message);
            }
        }
        void IncludeViewerCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                BrowseViewerButton.Enabled    = IncludeViewerCheckBox.Checked;
                CreateAutoRunCheckBox.Enabled = IncludeViewerCheckBox.Checked;

                if (null != IncludeViewerChanged)
                {
                    IncludeViewerChanged(this, e);
                }
            }
            catch (Exception exception)
            {
                ThreadSafeMessager.ShowError(exception.Message);
            }
        }