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;
            }
        }
Esempio n. 2
0
        private void UpdateConfigStateOPCUA(ConfigStateOPCUA state)
        {
            switch (state)
            {
            case ConfigStateOPCUA.Started:
                epConnectServerButton.Enabled      = false;
                epConnectServerButton.BackColor    = SystemColors.ScrollBar;
                endpointListView.Enabled           = false;
                endpointListView.BackColor         = SystemColors.ScrollBar;
                groupBox1.BackColor                = SystemColors.ScrollBar;
                userAnonButton.BackColor           = SystemColors.ScrollBar;
                userAnonButton.Enabled             = false;
                userPwButton.BackColor             = SystemColors.ScrollBar;
                userPwButton.Enabled               = false;
                userTextBox.BackColor              = SystemColors.ScrollBar;
                pwTextBox.BackColor                = SystemColors.ScrollBar;
                endpointButton.BackColor           = SystemColors.ScrollBar;
                endpointButton.Enabled             = false;
                discoveryTextBox.BackColor         = SystemColors.ScrollBar;
                discoveryTextBox.Enabled           = false;
                discoveryTextBox.Text              = Config.Sets.Primary_OPCUA_Node;
                buttonTestConfig.BackColor         = SystemColors.ScrollBar;
                buttonTestConfig.Enabled           = false;
                textBoxS7RecArrayName.Enabled      = false;
                textBoxS7RecResetCountName.Enabled = false;
                buttonSaveConfig.BackColor         = SystemColors.ScrollBar;
                buttonSaveConfig.Enabled           = false;

                descriptionGridView.Enabled         = false;
                descriptionGridView.BackgroundColor = SystemColors.ScrollBar;
                nodeTreeView.Enabled            = false;
                nodeTreeView.BackColor          = SystemColors.ScrollBar;
                textBoxSQLTableName.Enabled     = false;
                textBoxSQLTableName.BackColor   = SystemColors.ScrollBar;
                numericS7RecordsCount.Enabled   = false;
                numericS7RecordsCount.BackColor = SystemColors.ScrollBar;


                textBoxS7DBName.Enabled = false;

                textBoxSQLIDColName.BackColor  = SystemColors.ScrollBar;
                textBoxSQLIDColName.Enabled    = false;
                textBoxSQLValColName.BackColor = SystemColors.ScrollBar;
                textBoxSQLValColName.Enabled   = false;
                textBoxSQLDATColName.BackColor = SystemColors.ScrollBar;
                textBoxSQLDATColName.Enabled   = false;

                break;

            case ConfigStateOPCUA.Stopped:
                epConnectServerButton.Enabled      = true;
                epConnectServerButton.BackColor    = Color.Transparent;
                endpointListView.Enabled           = true;
                endpointListView.BackColor         = SystemColors.Window;
                groupBox1.BackColor                = SystemColors.Window;
                userAnonButton.BackColor           = SystemColors.Window;
                userPwButton.BackColor             = SystemColors.Window;
                userTextBox.BackColor              = SystemColors.Window;
                pwTextBox.BackColor                = SystemColors.Window;
                endpointButton.BackColor           = Color.Transparent;
                endpointButton.Enabled             = true;
                discoveryTextBox.BackColor         = SystemColors.Window;
                discoveryTextBox.Enabled           = true;
                discoveryTextBox.Text              = Config.Sets.Primary_OPCUA_Node;
                buttonTestConfig.BackColor         = SystemColors.ScrollBar;
                buttonTestConfig.Enabled           = false;
                textBoxS7RecArrayName.Enabled      = false;
                textBoxS7RecResetCountName.Enabled = false;
                buttonSaveConfig.BackColor         = SystemColors.ScrollBar;
                buttonSaveConfig.Enabled           = false;

                descriptionGridView.Enabled         = false;
                descriptionGridView.BackgroundColor = SystemColors.ScrollBar;
                nodeTreeView.Enabled            = false;
                nodeTreeView.BackColor          = SystemColors.ScrollBar;
                textBoxSQLTableName.Enabled     = false;
                textBoxSQLTableName.BackColor   = SystemColors.ScrollBar;
                numericS7RecordsCount.Enabled   = false;
                numericS7RecordsCount.BackColor = SystemColors.ScrollBar;

                textBoxS7DBName.Enabled = false;

                textBoxSQLIDColName.BackColor  = SystemColors.ScrollBar;
                textBoxSQLIDColName.Enabled    = false;
                textBoxSQLValColName.BackColor = SystemColors.ScrollBar;
                textBoxSQLValColName.Enabled   = false;
                textBoxSQLDATColName.BackColor = SystemColors.ScrollBar;
                textBoxSQLDATColName.Enabled   = false;

                break;
            }
        }