Exemplo n.º 1
0
        /// <summary>
        /// 主窗口关闭,系统退出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BaseWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            // 数据库没有连接上则不需要验证
            if (!AppConfigInfos.AppStateInfos.DataBaseState.Equals("1"))
            {
                LoginWindow loginWindow = WindowsHelper.ShowDialogWindow <LoginWindow>(this, PermissionConfig.AppClose, "0");
                if (loginWindow.MessageBoxResult != MessageBoxResult.OK)
                {
                    e.Cancel = true;
                    return;
                }
                else
                {
                    MainMessage.Instance.SendOperationLog("CollectAppExit");
                }
            }
            else
            {
                MessageBoxResult result = NewMessageBox.Show(TryFindResource("appMainExitApp").ToString(), MessageBoxButton.OKCancel, this);
                if (result != MessageBoxResult.OK)
                {
                    e.Cancel = true;
                    return;
                }
            }

            WarnInfo.WarnHelper.Instance.ReceiveDataHandler -= Instance_ReceiveDataHandler;
            ModuleDispather.Instance.Dispose();
            LogHelper.Instance.Dispose();
            AppHelper.CloseKey();
            App.Current.Shutdown();
        }
Exemplo n.º 2
0
 /// <summary>
 /// 窗口关闭事件
 /// </summary>
 /// <param name="e"></param>
 protected override void OnClosed(EventArgs e)
 {
     base.OnClosed(e);
     this.DataContext = null;
     if (!writeShow)
     {
         AppHelper.CloseKey();
     }
 }