Example #1
0
        public AlarmProcess(ProcessReceiver m)
        {
            main = m;
            log  = new LogCls();

            logMsg = new LogMessageCallback(main.setLogMessage);
        }
Example #2
0
        public ObserverProcess(object cls)
        {
            main       = (WindClientForm)cls;
            isShutdown = true;

            myIniFile         = new IniFile(@"D:\WindLidarClient.ini");
            m_sourcePath      = myIniFile.Read("SOURCE_PATH");
            m_backupPath      = myIniFile.Read("BACKUP_PATH");
            m_sts_sleep_time  = System.Convert.ToInt32(myIniFile.Read("STS_SLEEP_TIME"));
            m_file_sleep_time = System.Convert.ToInt32(myIniFile.Read("FILE_SLEEP_TIME"));
            m_sta_sleep_time  = System.Convert.ToInt32(myIniFile.Read("STA_SLEEP_TIME"));
            m_alm_sleep_time  = System.Convert.ToInt32(myIniFile.Read("ALM_SLEEP_TIME"));
            m_data1           = myIniFile.Read("DATA1");
            m_data2           = myIniFile.Read("DATA2");

            waitHandle = new ManualResetEvent(false);
            almHandle  = new ManualResetEvent(false);
            staHandle  = new ManualResetEvent(false);

            log = new LogMessageCallback(main.logMessage);


            startProgress = new StartPointCallback(main.StartPointProgress);
            endProgress   = new EndPointCallback(main.EndPointProgress);
            ingProgress   = new ProgressIngCallback(main.IngProgress);

            alarmProcess = new AlarmProcess(this);
            fsLog        = new LogCls();
        }
Example #3
0
 public static void LogDebug(LogMessageCallback callback)
 {
     if (LogWriter.HandlesLogDebug)
     {
         callback(Logger.LogDebug);
     }
 }
Example #4
0
 public static void LogAction(LogMessageCallback callback)
 {
     if (LogWriter.HandlesLogAction)
     {
         callback(Logger.LogAction);
     }
 }
Example #5
0
 public void LogMessage(string Message)
 {
     if (Message == "")
     {
         return;
     }
     if (textBoxLog.InvokeRequired)
     {
         LogMessageCallback Temp = new LogMessageCallback(LogMessage);
         textBoxLog.Invoke(Temp, new object[] { Message });
     }
     else
     {
         if (textBoxLog.Text.Length + Message.Length >= textBoxLog.MaxLength)
         {
             if (TextBoxFull != null)
             {
                 TextBoxFull(this, new EventArgs());
             }
             if (AutoClearOnFull)
             {
                 textBoxLog.Clear();
             }
         }
         textBoxLog.AppendText(Message);
         if (AddLine)
         {
             textBoxLog.AppendText(Environment.NewLine);
         }
     }
 }
Example #6
0
        public void LogMessage(string Message, Color?c = null, byte Level = 0)
        {
#if DEBUG
            if (Level > Debug_Level)
            {
                return;
            }
            if ((Level > 0) && (!IsLike(Message)))
            {
                return;
            }
#endif
            if (m_rtbLogZone != null)
            {
                if (m_rtbLogZone.InvokeRequired)
                {
                    LogMessageCallback d = new LogMessageCallback(LogMessage);
                    m_rtbLogZone.Invoke(d, new object[] { Message, c, Level });
                }
                else
                {
                    if ((m_rtbLogZone != null) && (!m_rtbLogZone.IsDisposed))
                    {
                        m_rtbLogZone.SelectionStart  = m_rtbLogZone.TextLength;
                        m_rtbLogZone.SelectionLength = 0;
                        m_rtbLogZone.SelectionColor  = c ?? Color.Black;
                        m_rtbLogZone.AppendText(Message + Environment.NewLine);
                        m_rtbLogZone.SelectionColor = m_rtbLogZone.ForeColor;
                        m_rtbLogZone.ScrollToCaret();
                    }
                }
            }
        }
Example #7
0
        public StatusProcess(ProcessReceiver m)
        {
            main = m;
            log  = new LogCls();

            stsLog = new LogMessageCallback(main.setLogMessage);
        }
Example #8
0
 public static extern void install_callbacks(
     NotifyRealmCallback notifyRealmCallback,
     GetNativeSchemaCallback nativeSchemaCallback,
     OpenRealmCallback openCallback,
     OnBindingContextDestructedCallback contextDestructedCallback,
     LogMessageCallback logMessageCallback,
     NotifiableObjectHandleBase.NotificationCallback notifyObject,
     DictionaryHandle.KeyNotificationCallback notifyDictionary,
     MigrationCallback onMigration);
Example #9
0
 public static extern void install_callbacks(
     NotifyRealmCallback notify_realm_callback,
     GetNativeSchemaCallback native_schema_callback,
     OpenRealmCallback open_callback,
     OnBindingContextDestructedCallback context_destructed_callback,
     LogMessageCallback log_message_callback,
     NotifiableObjectHandleBase.NotificationCallback notify_object,
     DictionaryHandle.KeyNotificationCallback notify_dictionary,
     MigrationCallback migration_callback,
     ShouldCompactCallback should_compact_callback);
Example #10
0
 public void LogMessage(string message, Color color, Font font)
 {
     if (this.TextBoxLog.InvokeRequired)
     {
         LogMessageCallback CB = new LogMessageCallback(LogMessage);
         this.Invoke(CB, new object[] { message, color, font });
     }
     else
     {
         TextBoxLog.AppendText(message, color, font);
         TextBoxLog.ScrollToCaret();
     }
 }
Example #11
0
        /// <summary>
        /// Base logging method to send data and create the message only when a logWriter is attached
        /// </summary>
        /// <param name="logType">LogTypes enumeration item</param>
        /// <param name="callback">A delegate to create the log message.</param>
        public static void Log(LogMessageType logType, LogMessageCallback callback)
        {
            if (callback == null)
            {
                return;
            }
            switch (logType)
            {
            case LogMessageType.Action:
                Logger.LogAction(callback);
                break;

            case LogMessageType.Debug:
                Logger.LogDebug(callback);
                break;
            }
        }
        public ProcessReceiver(object obj)
        {
            main       = (WindLidarServer)obj;
            isShutdown = true;

            waitHandle = new ManualResetEvent(false);
            stsHandle  = new ManualResetEvent(false);
            staHandle  = new ManualResetEvent(false);
            othHandle  = new ManualResetEvent(false);

            log        = new LogMessageCallback(main.logMessage);
            stsMessage = new StsMessageCallback(main.stsMessage);
            ftsMessage = new FtsMessageCallback(main.ftsMessage);
            stsDB      = new StsMessageDBCallback(main.stsDB);
            stsProcess = new StatusProcess(this);
            ftsProcess = new FileProcess(this);
            atsProcess = new FileProcess(this);
            othProcess = new FileProcess(this);
            almProcess = new AlarmProcess(this);

            server = null;
        }
Example #13
0
        public static void LogMessage(string command, params string[] list)
        {
            if (_listViewLog == null)
            {
                return;
            }

            if (_listViewLog.InvokeRequired)
            {
                LogMessageCallback cb = new LogMessageCallback(LogMessage);
                _listViewLog.Invoke(cb, command, list);
            }
            else
            {
                ListViewItem lvi = _listViewLog.Items.Add(command);
                foreach (string s in list)
                {
                    lvi.SubItems.Add(s);
                }
                _listViewLog.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                _listViewLog.EnsureVisible(_listViewLog.Items.Count - 1);
            }
        }
Example #14
0
 public static extern void set_log_callback(LogMessageCallback callback, out NativeException ex);
Example #15
0
 // Add a log entry to the log text box, ensure cross-thread support, as Spokes events come in on a different thread
 public void LogMessage(string callingmethodname, string message)
 {
     if (!m_debugmode || eventslog == null) return; // log is not open!
     if (eventslog.eventLogTextBox.InvokeRequired)
     {
         LogMessageCallback d = new LogMessageCallback(LogMessage);
         this.Invoke(d, new object[] { callingmethodname, message });
     }
     else
     {
         string datetime = DateTime.Now.ToString("HH:mm:ss.fff");
         if (m_debugmode && eventslog != null && !eventslog.IsDisposed)
         {
             eventslog.eventLogTextBox.AppendText(String.Format("{0}: {1}(): {2}\r\n", datetime, callingmethodname, message));
             eventslog.eventLogTextBox.SelectionStart = eventslog.Text.Length;
             //eventslog.eventLogTextBox.ScrollToCaret();
         }
     }
 }
Example #16
0
 public static extern IntPtr initialize(
     [MarshalAs(UnmanagedType.LPWStr)] string platform, IntPtr platform_len,
     [MarshalAs(UnmanagedType.LPWStr)] string platform_version, IntPtr platform_version_len,
     [MarshalAs(UnmanagedType.LPWStr)] string sdk_version, IntPtr sdk_version_len,
     UserCallback user_callback, VoidTaskCallback void_callback, BsonCallback bson_callback, LogMessageCallback log_message_callback, ApiKeysCallback api_keys_callback);
		public static void LogDebug(LogMessageCallback callback)
		{
			if (LogWriter.HandlesLogDebug) callback(Logger.LogDebug);
		}
Example #18
0
 /// <summary>
 /// Logs the information
 /// </summary>
 /// <param name="information"></param>
 public void Log(string head, string information, LogSeverity severity = LogSeverity.Information)
 {
     LogMessageCallback?.Invoke(DateTime.Now, head, information, null, severity);
 }
		public static void LogAction(LogMessageCallback callback)
		{
			if (LogWriter.HandlesLogAction) callback(Logger.LogAction);
		}
 /// <summary>
 /// Base logging method to send data and create the message only when a logWriter is attached
 /// </summary>
 /// <param name="logType">LogTypes enumeration item</param>
 /// <param name="callback">A delegate to create the log message.</param>
 public static void Log(LogMessageType logType, LogMessageCallback callback)
 {
 	if (callback == null) return;
 	switch (logType)
     {
         case LogMessageType.Action:
 			Logger.LogAction(callback);
             break;
         case LogMessageType.Debug:
             Logger.LogDebug(callback);
             break;
     }
 }
Example #21
0
 /// <summary>
 /// Logs an exception to the console with detailed exception information
 /// </summary>
 /// <param name="head"></param>
 /// <param name="description"></param>
 /// <param name="date"></param>
 /// <param name="exception"></param>
 public void LogException(Exception exception, LogSeverity severity = LogSeverity.Warning)
 {
     LogMessageCallback?.Invoke(DateTime.Now, Name, "An exception has occoured", exception, severity);
 }
Example #22
0
 /// <summary>
 /// Logs an exception to the console with detailed exception information
 /// </summary>
 /// <param name="head"></param>
 /// <param name="description"></param>
 /// <param name="date"></param>
 /// <param name="exception"></param>
 public void LogException(string information, Exception exception, LogSeverity severity = LogSeverity.Warning)
 {
     LogMessageCallback?.Invoke(DateTime.Now, Name, information, exception, severity);
 }
Example #23
0
 public static extern void install_callbacks(
     NotifyRealmCallback notifyRealmCallback,
     GetNativeSchemaCallback nativeSchemaCallback,
     OpenRealmCallback openCallback,
     OnBindingContextDestructedCallback contextDestructedCallback,
     LogMessageCallback logMessageCallback);