Example #1
0
        private bool _DoStartZeptair()
        {
            ushort res_code = 0;

            if (!ClientServiceAgent.OnStart(ref res_code))
            {
                string msg = Properties.Resources.ERR_FAILED_TO_ACTIVATE_SVC;
                switch (res_code)
                {
                case ClientServiceAgent.RET_ON_START_ERR_LICKEY:
                    msg += "\n" + Properties.Resources.ERR_ON_START_LICKEY;
                    break;

                default:
                    break;
                }
                System.Windows.Forms.MessageBox.Show(
                    msg,
                    TaskMain.APP_TITLE,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
                return(false);
            }
            return(true);
        }
Example #2
0
        /// <summary>Click event handler of the Zeptair Disconnect item in the menu of the task tray.</summary>
        /// <param name="sender">Sender Object.</param>
        /// <param name="e">Event parameters.</param>
        private void menuItemZeptDisconnect_Click(object sender, EventArgs e)
        {
            Zeptair.Lib.Common.ConfParam zeptConf = ZeptConf(false);
            UpdateZeptMenus(false, zeptConf);

            if (!ClientServiceAgent.OnStop())
            {
                System.Windows.Forms.MessageBox.Show(
                    Properties.Resources.ERR_FAILED_TO_DISABLE_SVC,
                    TaskMain.APP_TITLE,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
                UpdateZeptMenus(true, zeptConf);
            }
        }
Example #3
0
        /// <summary>Updates Task tray Icon.</summary>
        private void UpdateTaskTrayIcon()
        {
            int act_state  = ClientServiceAgent.ACT_STATE_UNKNOWN;
            int icon_state = ClientServiceAgent.ICON_STATE_UNKNOWN;

            if (!ClientServiceAgent.GetCurrentState(ref act_state, ref icon_state))
            {
                return;
            }

            Zeptair.Lib.Common.ConfParam zeptConf = ZeptConf(false);

            if (act_state != ClientServiceAgent.ACT_STATE_AUTH_FAILED)
            {
                _dispAuthFailed = false;
            }

            switch (act_state)
            {
            case ClientServiceAgent.ACT_STATE_FOR_AUTH:
                this.UpdateZeptMenus(true, zeptConf);
                break;

            case ClientServiceAgent.ACT_STATE_ON:
                this.UpdateZeptMenus(true, zeptConf);
                break;

            case ClientServiceAgent.ACT_STATE_OFF:
                this.UpdateZeptMenus(false, zeptConf);
                break;

            case ClientServiceAgent.ACT_STATE_AUTH_FAILED:
                this.UpdateZeptMenus(false, zeptConf);
                if (!_dispAuthFailed)
                {
                    _dispAuthFailed = true;
                    System.Windows.Forms.MessageBox.Show(
                        Properties.Resources.ERR_ON_START_AUTH_FAILED,
                        TaskMain.APP_TITLE,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error
                        );
                }
                break;

            default:
                break;
            }

            _notifyIcon.Icon = Properties.Resources.AppIcon;

            switch (icon_state)
            {
            case ClientServiceAgent.ICON_STATE_DISABLED:
                _notifyIcon.Icon = Properties.Resources.AppIcon;
                break;

            case ClientServiceAgent.ICON_STATE_ACTIVATED:
                _notifyIcon.Icon = Properties.Resources.activated;
                break;

            case ClientServiceAgent.ICON_STATE_STANDBY:
                _notifyIcon.Icon = Properties.Resources.standby;
                break;

            case ClientServiceAgent.ICON_STATE_UNDEFINED1:
                _notifyIcon.Icon = Properties.Resources.undefined;
                break;

            case ClientServiceAgent.ICON_STATE_UNDEFINED2:
                _notifyIcon.Icon = Properties.Resources.undefined;
                break;

            case ClientServiceAgent.ICON_STATE_UNAVAILABLE:
                _notifyIcon.Icon = Properties.Resources.unavailable;
                break;

            case ClientServiceAgent.ICON_STATE_UNKNOWN:
                break;

            case ClientServiceAgent.ICON_STATE_RETRY1:
                break;

            case ClientServiceAgent.ICON_STATE_RETRY2:
                break;

            default:
                break;
            }
        }