Beispiel #1
0
 private void OnReceiveLog(EventBroker.EventID id, EventBroker.EventParam param)
 {
     if (param == null)
     {
         return;
     }
     SystemLog.MSG_TYPE type = (SystemLog.MSG_TYPE)param.ParamInt;
     if (type == SystemLog.MSG_TYPE.Err)
     {
         Output(param.ParamString, Brushes.Yellow);
     }
     else if (type == SystemLog.MSG_TYPE.War)
     {
         Output(param.ParamString, Brushes.YellowGreen);
     }
     else
     {
         Output(param.ParamString, Brushes.LightGray);
     }
 }
Beispiel #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (m_timerEvent == null)
            {
                m_timerEvent = new EventBroker.EventParam(this, 0);
                EventBroker.AddTimeEvent(EventBroker.EventID.etUpdateMe, m_timerEvent, 3960000, true);//66분에 한번씩
                //EventBroker.AddTimeEvent(EventBroker.EventID.etUpdateMe, m_timerEvent, 20000, true);//66분에 한번씩
            }
            LoadBackgroundWorker();
            LoadAdress();
            System.Windows.Forms.ContextMenu menu = new System.Windows.Forms.ContextMenu();

            System.Windows.Forms.MenuItem itemConfig = new System.Windows.Forms.MenuItem();
            itemConfig.Index  = 0;
            itemConfig.Text   = "Configure";
            itemConfig.Click += ItemConfig_Click;
            menu.MenuItems.Add(itemConfig);

            System.Windows.Forms.MenuItem itemExit = new System.Windows.Forms.MenuItem();
            itemExit.Index  = 1;
            itemExit.Text   = "Exit";
            itemExit.Click += ItemExit_Click;
            menu.MenuItems.Add(itemExit);

            m_notify              = new System.Windows.Forms.NotifyIcon();
            m_notify.Icon         = Properties.Resources.Proycontec_Robots_Robot_screen_settings;
            m_notify.Visible      = true;
            m_notify.DoubleClick += (object send, EventArgs args) => { this.Show(); this.WindowState = WindowState.Normal; this.ShowInTaskbar = true; };
            m_notify.ContextMenu  = menu;
            m_notify.Text         = "PLC To GMES";
            Version ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
            string  str = string.Format("PLC To GMES: v{0}.{1}.{2}", ver.Major, ver.Minor, ver.Build);

            notiftyBalloonTip(str, 1000);


            StartTimerGetPLCData();
        }