Ejemplo n.º 1
0
        /// <summary>
        /// 加载检查KEY
        /// </summary>
        private void LoadingKeyCheck()
        {
            Session.Instance.StartSession((IsAuto) =>
            {
                //如果窗口本来就打开了,就别打开了(自动检查模式下).
                if (IsAuto && IsOpenKeyWindow)
                {
                    return;
                }

                Common.GetCommon().CheckAndAlert(new Action <string>((message) =>
                {
                    IsOpenKeyWindow = true;

                    if (string.IsNullOrWhiteSpace(message))
                    {
                        message = Resources.GetRes().GetString("Exception_ServerCantCorrConn");
                    }
                    else
                    {
                        message = string.Format(Resources.GetRes().GetString("Exception_ExceptionSource"), Resources.GetRes().GetString("Exception_ServerCantCorrConn"), "", message);
                    }

                    this.Invoke(new Action(() =>
                    {
                        DialogResult result = KryptonMessageBox.Show(this, message, Resources.GetRes().GetString("Warn"), MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button2);
                        if (result == System.Windows.Forms.DialogResult.Abort)
                        {
                            this.Close();
                        }
                    }));
                }), new Action(() =>
                {
                    IsOpenKeyWindow = false;

                    if (null != homeWindow && !homeWindow.IsDisposed)
                    {
                        homeWindow.RefreshAll();
                    }
                }));
            });
        }