コード例 #1
0
        private async void NotifyIconOnMouseClick(object sender, MouseEventArgs mouseEventArgs)
        {
            WebBrowser wb = new WebBrowser();

            switch (mouseEventArgs.Button)
            {
            case MouseButtons.Left:
                await _signLogHost.Show();

                break;

            case MouseButtons.Right:
                var result = await _contextMenuHost.Show();

                if (result is AppContextMenuAction)
                {
                    switch ((AppContextMenuAction)result)
                    {
                    case AppContextMenuAction.Login:
                        LoginWindow.ShowLoginWindow(ViewModel);
                        break;

                    case AppContextMenuAction.Sign:
                        SignWindow.ShowSignWindow(ViewModel);
                        break;

                    case AppContextMenuAction.Logout:
                        SaveSetting();
                        ViewModel.Session.Logout();
                        ViewModel.Name      = null;
                        ViewModel.AvatarUrl = null;
                        break;

                    case AppContextMenuAction.Setting:
                        SettingWindow.ShowSettingWindow(ViewModel);
                        break;

                    case AppContextMenuAction.AppLog:
                        LogWindow.ShowLogWindow();
                        break;

                    case AppContextMenuAction.About:
                        AboutWindow.ShowAboutWindow();
                        break;

                    case AppContextMenuAction.Close:
                        Shutdown();
                        break;

                    default:
                        break;
                    }
                }
                break;

            default:
                break;
            }
        }
コード例 #2
0
        public static SignWindow ShowSignWindow(ApplicationViewModel applicationViewModel)
        {
            if (_signle != null)
            {
                _signle.Activate();
                return(_signle);
            }

            _signle = new SignWindow
            {
                DataContext = new SignWindowViewModel(applicationViewModel)
            };
            _signle.Show();
            return(_signle);
        }
コード例 #3
0
 protected override void OnClosed(EventArgs e)
 {
     _signle = null;
     base.OnClosed(e);
 }