EnableLog Property

Summary
Gets or sets whether logging is enabled.
Syntax
C#
VB
C++
public bool EnableLog { get; set; } 
  
Public Property EnableLog As Boolean 
public: 
property bool EnableLog { 
   bool get(); 
   void set (    bool ); 
} 

Property Value

True to enable logging; otherwise it is false.

Example
C#
VB
using LeadtoolsExamples.Common; 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Dicom; 
using Leadtools.Dicom.Scu.Common; 
using Leadtools.ImageProcessing; 
using Leadtools.Dicom.AddIn.Common; 
using Leadtools.Dicom.Scu; 
using Leadtools.Medical.Workstation.Client; 
using Leadtools.Medical.Workstation.Client.Local; 
using Leadtools.Medical.Workstation.Client.Pacs; 
using Leadtools.Medical.Storage.DataAccessLayer; 
using Leadtools.Medical.DataAccessLayer; 
using Leadtools.Medical.Storage.DataAccessLayer.Configuration; 
 
public void StoreDicom() 
{ 
   Leadtools.Examples.Support.SetLicense(); 
 
   AeInfo clientInfo = new AeInfo(); 
 
   clientInfo.Address = Dns.GetHostName(); //local machine 
   clientInfo.AETitle = "TEST_CLIENT"; 
   clientInfo.Port = 1000; 
 
   IStorageDataAccessAgent dataAccess = null; 
   bool fromConfiguration = false; 
 
   if (fromConfiguration) 
   { 
      //Make sure that the Sotrage Data Access is configured before creating an instance. 
      dataAccess = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView()).CreateDataAccessAgent<IStorageDataAccessAgent>(); 
   } 
   else 
   { 
      string connectionString = @"Data Source=local;Initial Catalog=DicomStorage;Integrated Security=True;User ID=;Password=;Pooling=True"; 
      //or you can directly create the data access object which works with your database 
      dataAccess = new StorageSqlDbDataAccessAgent(connectionString); 
   } 
 
   DbQueryClient queryClient = new DbQueryClient(clientInfo, dataAccess); 
 
   queryClient.EnableLog = true; 
   queryClient.LogFileName = Path.Combine(LEAD_VARS.ImagesDir, "DicomLog.txt"); 
 
   DicomDataSet[] series = queryClient.FindSeries(new FindQuery()); 
 
   if (series.Length > 0) 
   { 
      DicomScp scpInfo = new DicomScp(); 
 
      scpInfo.AETitle = "LEAD_SERVER"; 
      scpInfo.Port = 104; 
      scpInfo.Timeout = 30; 
 
      bool addressFound; 
      IPAddress[] addresses; 
 
      addressFound = false; 
      addresses = Dns.GetHostAddresses(Dns.GetHostName()); 
 
      foreach (IPAddress address in addresses) 
      { 
         //we need to get an IP V4, won't work with IP V6 
         if (address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) 
         { 
            addressFound = true; 
 
            scpInfo.PeerAddress = address; 
 
            break; 
         } 
      } 
 
      if (!addressFound) 
      { 
         throw new ArgumentException("Couldn't resolve a valid host Address. Address must conform to IP version 4"); 
      } 
 
      StoreClient client = new StoreClient(clientInfo, scpInfo, Compression.Native, dataAccess); 
 
      client.EnableLog = true; 
      client.LogFileName = Path.Combine(LEAD_VARS.ImagesDir, "DicomLog.txt"); 
 
      client.StoreSeries(series[0].GetValue<string>(DicomTag.StudyInstanceUID, string.Empty), 
                           series[0].GetValue<string>(DicomTag.SeriesInstanceUID, string.Empty)); 
 
      Console.WriteLine("Series {0} has been stored successfully.", series[0].GetValue<string>(DicomTag.SeriesInstanceUID, string.Empty)); 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images"; 
} 
Imports LeadtoolsExamples.Common 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.Dicom 
Imports Leadtools.Dicom.Scu.Common 
Imports Leadtools.ImageProcessing 
Imports Leadtools.Dicom.AddIn.Common 
Imports Leadtools.Dicom.Scu 
Imports Leadtools.Medical.DataAccessLayer 
Imports Leadtools.Medical.Storage.DataAccessLayer 
Imports Leadtools.Medical.Storage.DataAccessLayer.Configuration 
Imports Leadtools.Medical.Workstation.Client 
Imports Leadtools.Medical.Workstation.Client.Local 
Imports Leadtools.Medical.Workstation.Client.Pacs 
 
Public Sub StoreDicom() 
   Leadtools.Examples.Support.SetLicense() 
   Dim clientInfo As AeInfo = New AeInfo() 
   clientInfo.Address = Dns.GetHostName() 'local machine 
   clientInfo.AETitle = "TEST_CLIENT" 
   clientInfo.Port = 1000 
 
   Dim dataAccess As Medical.Storage.DataAccessLayer.IStorageDataAccessAgent 
 
   Dim fromConfiguration As Boolean 
 
   fromConfiguration = False 
   If (fromConfiguration) Then 
 
      'Make sure that the Sotrage Data Access is configured before creating an instance. 
      dataAccess = DataAccessFactory.GetInstance(New StorageDataAccessConfigurationView()).CreateDataAccessAgent(Of IStorageDataAccessAgent)() 
   Else 
 
      Dim connectionString As String = "Data Source=local;Initial Catalog=DicomStorage;Integrated Security=True;User ID=;Password=;Pooling=True" 
      'or you can directly create the data access object which works with your database 
      dataAccess = New StorageSqlDbDataAccessAgent(connectionString) 
   End If 
 
 
   'Make sure that the FindAddIn is configured properly before using this class. 
   Dim queryClient As DbQueryClient = New DbQueryClient(clientInfo, dataAccess) 
 
   queryClient.EnableLog = True 
   queryClient.LogFileName = Path.Combine(LEAD_VARS.ImagesDir, "DicomLog.txt") 
 
   Dim series As DicomDataSet() = queryClient.FindSeries(New FindQuery()) 
 
   If series.Length > 0 Then 
      Dim scpInfo As DicomScp = New DicomScp() 
 
      scpInfo.AETitle = "LEAD_SERVER" 
      scpInfo.Port = 104 
      scpInfo.Timeout = 30 
 
      Dim addressFound As Boolean 
      Dim addresses As IPAddress() 
 
      addressFound = False 
      addresses = Dns.GetHostAddresses(Dns.GetHostName()) 
 
      For Each address As IPAddress In addresses 
         'we need to get an IP V4, won't work with IP V6 
         If address.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork Then 
            addressFound = True 
 
            scpInfo.PeerAddress = address 
 
            Exit For 
         End If 
      Next address 
 
      If (Not addressFound) Then 
         Throw New ArgumentException("Couldn't resolve a valid host Address. Address must conform to IP version 4") 
      End If 
 
      Dim client As StoreClient = New StoreClient(clientInfo, scpInfo, Compression.Native, dataAccess) 
 
      client.EnableLog = True 
      client.LogFileName = Path.Combine(LEAD_VARS.ImagesDir, "DicomLog.txt") 
 
      client.StoreSeries(series(0).GetValue(Of String)(DicomTag.StudyInstanceUID, String.Empty), series(0).GetValue(Of String)(DicomTag.SeriesInstanceUID, String.Empty)) 
 
      Console.WriteLine("Series {0} has been stored successfully.", series(0).GetValue(Of String)(DicomTag.SeriesInstanceUID, String.Empty)) 
   End If 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\LEADTOOLS21\Resources\Images" 
End Class 
Requirements

Target Platforms

Help Version 21.0.2021.6.30
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Medical.Workstation.Client Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.