Пример #1
0
        public FormMain()
        {
            InitializeComponent();

            uiSynchronizationContext = SynchronizationContext.Current;

            //((log4net.Repository.Hierarchy.Hierarchy)log4net.LogManager.GetRepository()).Root.AddAppender(this);

            // register a notification handler to log
            NotificationBroker.Register(typeof(LogWrittenNotification), (object thesender, Notification notification) =>
            {
                LogWrittenNotification logNotification = notification as LogWrittenNotification;

                // only write on UI thread!
                uiSynchronizationContext.Send((object state) =>
                {
                    Log(state as string);
                }, logNotification.Text);
            }, null);


            this.comboBox2.DataSource = Enum.GetValues(typeof(SERemoteConnection.EItemType));

            var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            this.Text = String.Format("Mettler Toledo - SE Cockpit V{0}", version);

            EnableTabAndControls(false);
        }
Пример #2
0
 /// <summary>
 /// Logs the specified text by raising the LogWritten event.
 /// </summary>
 /// <param name="text">The text.</param>
 private void Log(string text)
 {
     text = "[C] " + text;
     NotificationBroker.Send(new LogWrittenNotification {
         Text = text, Sender = this.GetType().FullName, Stamp = DateTime.Now
     }, NotificationScope.Local);
 }
Пример #3
0
        public override void Update(uint jobId, string xmlResultMessage)
        {
            string text = string.Format("[R] jobId({0}) result({1}):", jobId, xmlResultMessage);

            NotificationBroker.Send(new LogWrittenNotification {
                Text = text, Sender = this.GetType().FullName, Stamp = DateTime.Now
            }, NotificationScope.Local);
        }