Inheritance: System.ComponentModel.Component, ISupportLifecycle, ISupportInitialize, IProvideStatus, IPersistSettings
コード例 #1
0
 public ServiceHelperAppender(ServiceHelper serviceHelper)
 {
     m_serviceHelper = serviceHelper;
     m_serviceHelper.Disposed += (sender, args) => m_serviceHelper = null;
 }
コード例 #2
0
        /// <summary>
        /// Initializes the service helper.
        /// </summary>
        public void InitializeServiceHelper()
        {
            CategorizedSettingsElementCollection remotingServerSettings = ConfigurationFile.Current.Settings["remotingServer"];

            m_serviceHelper = new ServiceHelper();

            if (remotingServerSettings.Cast<CategorizedSettingsElement>().Any(element => element.Name.Equals("EnabledSslProtocols", StringComparison.OrdinalIgnoreCase) && !element.Value.Equals("None", StringComparison.OrdinalIgnoreCase)))
                m_remotingServer = InitializeTlsServer();
            else
                m_remotingServer = InitializeTcpServer();

            m_serviceHelper.ErrorLogger.ErrorLog.FileName = "ErrorLog.txt";
            m_serviceHelper.ErrorLogger.ErrorLog.PersistSettings = true;
            m_serviceHelper.ErrorLogger.ErrorLog.SettingsCategory = "ErrorLog";
            m_serviceHelper.ErrorLogger.ErrorLog.Initialize();

            m_serviceHelper.ErrorLogger.LogToEventLog = false;
            m_serviceHelper.ErrorLogger.PersistSettings = true;
            m_serviceHelper.ErrorLogger.SmtpServer = "";
            m_serviceHelper.ErrorLogger.Initialize();

            m_serviceHelper.ProcessScheduler.PersistSettings = true;
            m_serviceHelper.ProcessScheduler.SettingsCategory = "ProcessScheduler";
            m_serviceHelper.ProcessScheduler.Initialize();

            m_serviceHelper.StatusLog.FileName = "StatusLog.txt";
            m_serviceHelper.StatusLog.PersistSettings = true;
            m_serviceHelper.StatusLog.SettingsCategory = "StatusLog";
            m_serviceHelper.StatusLog.Initialize();

            m_serviceHelper.ParentService = this;
            m_serviceHelper.PersistSettings = true;
            m_serviceHelper.RemotingServer = m_remotingServer;
            m_serviceHelper.Initialize();
        }
コード例 #3
0
 public ClientStatusUpdateConfiguration(Guid clientID, ServiceHelper serviceHelper)
 {
     m_clientID = clientID;
     m_filter = new ClientFilter();
     m_thread = serviceHelper.m_threadScheduler.CreateThread(2);
     m_messageCounts = new List<Tuple<DateTime, int>>();
     m_serviceHelper = serviceHelper;
 }
コード例 #4
0
        /// <summary>
        /// Releases the unmanaged resources used by the <see cref="ServiceHostBase"/> object and optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
        protected override void Dispose(bool disposing)
        {
            if (!m_disposed)
            {
                try
                {
                    if (disposing)
                    {
                        if ((object)components != null)
                        {
                            components.Dispose();
                            components = null;
                        }

                        if ((object)m_serviceHelper != null)
                        {
                            m_serviceHelper.Dispose();
                            m_serviceHelper = null;
                        }

                        if ((object)m_remotingServer != null)
                        {
                            m_remotingServer.Dispose();
                            m_remotingServer = null;
                        }
                    }
                }
                finally
                {
                    m_disposed = true;          // Prevent duplicate dispose.
                    base.Dispose(disposing);    // Call base class Dispose().
                }
            }
        }