コード例 #1
0
        /// <summary>Event handler of Exit from Zeptair Client Configuration.</summary>
        /// <param name="sender">Sender Object.</param>
        /// <param name="e">Event parameters.</param>
        private void zeptConfProcess_Exited(object sender, EventArgs e)
        {
            _notifyIcon.ContextMenu = _contextMenu;

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

            UpdateZeptMenus(IsZeptSvcStarted(), zeptConf);

            /*
             * License-Key RE-Validation
             */
            LicKeyInfo licKeyInfo = LicKeyParser.Parse(zeptConf.LicenseKey);

            if (licKeyInfo == null || licKeyInfo.GetErrorMsg() != null)
            {
                _hasValidZeptLicKey = false;
#if true
                _menuItemZeptConnect.Enabled = false;
#else
                System.Windows.Forms.MessageBox.Show(
                    Properties.Resources.ERR_CANNOT_CONFIRM_VALID_LIC_KEY,
                    TaskMain.APP_TITLE,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
                this.HideNotifyIcon();
                Environment.Exit(0);
#endif
            }
            else
            {
                _hasValidZeptLicKey          = true;
                _menuItemZeptConnect.Enabled = true;
            }

            if (this.IsZeptSvcStarted())
            {
                if (zeptConf.ServerAddress == null ||
                    zeptConf.ServerAddress.Length <= 0 ||
                    zeptConf.ServerPort <= 0)
                {
                    System.Windows.Forms.MessageBox.Show(
                        Properties.Resources.ERR_ZEPT_SVC_START_CANCELED,
                        TaskMain.APP_TITLE,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error
                        );
                    this.UpdateZeptMenus(false, zeptConf);
                    return;
                }

                if (!_DoStartZeptair())
                {
                    UpdateZeptMenus(false, zeptConf);
                    return;
                }
            }
        }
コード例 #2
0
        /// <summary>Initialize.</summary>
        public static void Init()
        {
            _self = new TaskMain();

            /*
             * IPC
             */
            RemotingConfiguration.Configure(Path.Combine(ThetisCore.Lib.Def.COMMON_CONFIG_ROOT_DIR, @"remotingTask.config"), false);

            IpcTaskService ipcTaskService = new IpcTaskService();

            ipcTaskService.RssTargetInfosUpdated += _self.ipcTaskService_RssTargetInfosUpdated;

            RemotingServices.Marshal(ipcTaskService, "ipcTaskService");

#if ZEPTAIR
            Zeptair.Lib.Common.ConfParam zeptConf = TaskMain.Instance.ZeptConf(false);

            /*
             * License-Key Validation
             */
            LicKeyInfo licKeyInfo = LicKeyParser.Parse(zeptConf.LicenseKey);
            if (licKeyInfo == null || licKeyInfo.GetErrorMsg() != null)
            {
                _self._hasValidZeptLicKey = false;
 #if true
                _self._menuItemZeptConnect.Enabled = false;
 #else
                CommonUtil.StartProcessWithCallback(
                    Path.Combine(CommonUtil.GetAppPath(), @"ZeptairClientConf.exe"),
                    @"/default=tbiLicenseKey /edit",
                    _self,
                    new EventHandler(_self.zeptConfProcess_Exited)
                    );
 #endif
            }
            else
            {
                _self._hasValidZeptLicKey = true;
            }
#endif

            _self._rssManager = new RssManager();
            if (_self._rssManager.LoadWatchers())
            {
                _self._rssManager.Start();
            }
            //else
            //    Process.Start("ThetisCoreConf.exe");

#if ZEPTAIR
            _self._zeptDistManager = new ZeptDistManager();
            _self._zeptDistManager.Init(zeptConf.AcceptCmd);
#endif
        }