Esempio n. 1
0
        private void UpdateConfigStateOPCUA(ConfigStateOPCUA state)
        {
            trayNotifyIcon.Text = Application.ProductName + " - " + state.ToString();
            SafeThread.SetTextStripItem(statusbar, statusConfigLabel, "Configuration state: " + state.ToString());
            switch (state)
            {
            case ConfigStateOPCUA.Started:
                trayNotifyIcon.Text = Application.ProductName + " - OPCUA" + " - " + state.ToString();
                trayNotifyIcon.Icon = Properties.Resources.servicerunning;
                SafeThread.SetImageStripItem(statusbar, statusConfigLabel, Resources.Run);
                SafeThread.SetEnableStripItem(toolbar, startOPCUAButton, false);
                SafeThread.SetEnableStripItem(menu, startOPCUAMenuItem, false);
                SafeThread.SetEnableStripItem(trayMenu, startOPCUATrayMenuItem, false);
                SafeThread.SetEnableStripItem(toolbar, stopOPCUAButton, true);
                SafeThread.SetEnableStripItem(menu, stopOPCUAMenuItem, true);
                SafeThread.SetEnableStripItem(trayMenu, stopOPCUATrayMenuItem, true);
                break;

            case ConfigStateOPCUA.Stopped:
                trayNotifyIcon.Text = Application.ProductName + " - OPCUA" + " - " + state.ToString();
                trayNotifyIcon.Icon = Properties.Resources.servicestopped;
                SafeThread.SetImageStripItem(statusbar, statusConfigLabel, Resources.Stop);
                if (Config.ReadyOPCUA)
                {
                    SafeThread.SetEnableStripItem(toolbar, startOPCUAButton, true);
                    SafeThread.SetEnableStripItem(menu, startOPCUAMenuItem, true);
                    SafeThread.SetEnableStripItem(trayMenu, startOPCUATrayMenuItem, true);
                }
                else
                {
                    SafeThread.SetEnableStripItem(toolbar, startOPCUAButton, false);
                    SafeThread.SetEnableStripItem(menu, startOPCUAMenuItem, false);
                    SafeThread.SetEnableStripItem(trayMenu, startOPCUATrayMenuItem, false);
                }
                SafeThread.SetEnableStripItem(toolbar, stopOPCUAButton, false);
                SafeThread.SetEnableStripItem(menu, stopOPCUAMenuItem, false);
                SafeThread.SetEnableStripItem(trayMenu, stopOPCUATrayMenuItem, false);
                break;
            }
        }