Пример #1
0
        void _trayNotify_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Button != System.Windows.Forms.MouseButtons.Right)
            {
                try
                {
                    if (Application.Current.Windows.Count < 1)
                    {
                        ((PBApp)Application.Current).ShowUI();
                    }
                    Window window = null;
                    if (PBData == null || string.IsNullOrWhiteSpace(PBData.ActiveUser))
                    {
                        window = ((PBApp)Application.Current).FindWindow <LoginWindow>();
                        if (window == null)
                        {
                            window = Application.Current.Windows.Count > 0 ? Application.Current.Windows[0] : null;
                        }
                    }
                    else
                    {
                        window = ((PBApp)Application.Current).FindWindow <MainWindow>();
                        if (PBData.Locked)
                        {
                            Logout();
                            return;
                        }
                    }

                    if (!pbData.AnyAccountExists())
                    {
                        StartWindow(window, true, WindowMode.ProductTour);
                    }
                    else
                    {
                        StartWindow(window, true);
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(ex.Message);
                }
            }
        }
Пример #2
0
        private bool ShowLoginWindow(Dictionary <string, object> parameters)
        {
            LoginWindow wLogin = FindWindow <LoginWindow>();

            if (wLogin == null)
            {
                return(false);
            }

            bool openMainUI = true;

            if (parameters != null && parameters.ContainsKey("openMainUI"))
            {
                openMainUI = (bool)parameters["openMainUI"];
            }

            if (openMainUI)
            {
                wLogin.Show();
            }
            else
            {
                if (!pbData.AnyAccountExists())
                {
                    wLogin.NavigateloginScreens("ShowProductTour");
                }
                else
                {
                    wLogin.NavigateloginScreens();
                }
            }

            wLogin.Focus();

            return(true);
        }