Ejemplo n.º 1
0
        private void CloseWindow_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxConfirm messageBoxEx = new MessageBoxConfirm((MainWindow)Application.Current.MainWindow);

            messageBoxEx.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("ARE_YOU_SURE_TO_CLOSE_APP"));
            messageBoxEx.ConfirmEvent += PromptWindowConfirmEvent;

            messageBoxEx.ShowDialog();
        }
 private void MyInfoWindow_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (Visibility.Visible == this.Visibility)
     {
         this.displayNameReadOnlyPanel.Visibility = Visibility.Visible;
         this.displayNameEditPanel.Visibility     = Visibility.Collapsed;
         _viewModel.RefreshData();
     }
     else
     {
         Application.Current.Dispatcher.Invoke(() =>
         {
             if (null != _logoutPromptMessageBox)
             {
                 _logoutPromptMessageBox.Close();
                 _logoutPromptMessageBox = null;
             }
         });
     }
 }
        private void Logout_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (null == _logoutPromptMessageBox)
            {
                _logoutPromptMessageBox = new MessageBoxConfirm(this);
            }

            _logoutPromptMessageBox.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("ARE_YOU_SURE_TO_LOGOUT_APP"));
            _logoutPromptMessageBox.ConfirmEvent += new EventHandler(delegate(object sender1, EventArgs e1) {
                log.Info("Confirm to logout");
                LoginManager.Instance.Logout();
                Application.Current.Dispatcher.InvokeAsync(() =>
                {
                    if (null != _logoutPromptMessageBox)
                    {
                        log.Info("Close logout prompt window.");
                        _logoutPromptMessageBox.Close();
                        _logoutPromptMessageBox = null;
                    }
                });
            });
            _logoutPromptMessageBox.ShowDialog();
            _logoutPromptMessageBox = null;
        }