Beispiel #1
0
        /// <summary>
        /// For Closing login window
        /// </summary>
        private void CloseWindow(object obj)
        {
            var window = _systemTray.CurrentWindow(CurrentLoginWindow);

            inAppAnalyitics.Get <Events.AccountCreationFlow, AccountCreationFlowItem>().Log(new AccountCreationFlowItem(1, AccountCreationFlowSteps.LanguageSelection, string.Empty, MarketingActionType.Close));
            _systemTray.WindowClose(window);
        }
        private void CloseForgotMasterPasswordDialogClick(object obj)
        {
            mp.Close();
            mp = null;
            ForgotMasterPasswordControlVisibility = false;
            var window = _systemTray.CurrentWindow("LoginWindow");

            if (window != null)
            {
                window.Show();
            }
        }
        /// <summary>
        /// For Closing login window
        /// </summary>
        private void CloseWindow(object sender)
        {
            inAppAnalyitics.Get <Events.AccountCreationFlow, AccountCreationFlowItem>().Log(new AccountCreationFlowItem(3, AccountCreationFlowSteps.ConfirmMP, string.Empty, MarketingActionType.Close));
            var window = _systemTray.CurrentWindow(DefaultProperties.CurrentLoginWindow);

            _systemTray.WindowClose(window);
        }
        private void CloseCommandExecute(object obj)
        {
            LogStep(MarketingActionType.Close);
            var window = _systemTray.CurrentWindow(CurrentLoginWindow);

            _systemTray.WindowClose(window);
        }
Beispiel #5
0
        protected void ShowMainWindow(bool forceOnTop = true)
        {
            SystemTray _systemTray = new SystemTray();
            var        window      = _systemTray.CurrentWindow(DefaultProperties.CurrentLoginWindow);

            _systemTray.WindowClose(window);
            var mainWindow = ((PBApp)Application.Current).FindWindow <MainWindow>();

            if (mainWindow == null)
            {
                mainWindow = new MainWindow(resolver);
            }

            if (forceOnTop)
            {
                mainWindow.Topmost = true;
                mainWindow.Activate();
                mainWindow.Topmost = false;
            }
            else
            {
                mainWindow.Topmost = false;
            }

            mainWindow.Show();
        }
Beispiel #6
0
        private void MainGrid_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var window = tray.CurrentWindow("ForgotMasterPasswordWindow");

            if (window != null)
            {
                window.DragMove();
            }
        }
        private void OnLoginClosing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Window w = _systemTray.CurrentWindow(DefaultProperties.CurrentLoginWindow);

            if (w != null)
            {
                _systemTray.WindowClose(w);
            }
            e.Cancel = true;
        }
        private Window CloseLoginWindow()
        {
            logger.Debug("Closing login window");
            OpenMainUI = true;
            LoginWindow loginWindow = ((PBApp)Application.Current).FindWindow <LoginWindow>();

            if (loginWindow == null)
            {
                loginWindow = new LoginWindow(resolver);
            }
            SystemTray _systemTray = new SystemTray();
            var        window      = _systemTray.CurrentWindow(DefaultProperties.CurrentLoginWindow);

            _systemTray.WindowClose(window);
            logger.Debug("Login window closed");
            return(window);
        }
Beispiel #9
0
        //void GetMergePassword(CredentialsRequiredEventArgs e)
        //{
        //    ManualResetEvent evDone = new ManualResetEvent(false);
        //    Application.Current.Dispatcher.BeginInvoke((Action)(() =>
        //    {
        //        try
        //        {
        //            MasterPwdBox masterDialog = new MasterPwdBox();
        //            bool? res = masterDialog.ShowDialog();
        //            if (res.HasValue && res.Value)
        //            {
        //                e.Password = masterDialog.Password;
        //                masterPasswordDiffers = true;
        //            }
        //            else
        //            {
        //                e.Cancel = true;
        //            }
        //        }
        //        catch (Exception exc)
        //        {
        //            logger.Error(exc.ToString());
        //        }
        //        evDone.Set();
        //    }));
        //    evDone.WaitOne();
        //}

        public void SubmitCompleted(object obj)
        {
            if (successVerification)
            {
                MainWindow mainWindow = ((PBApp)Application.Current).FindWindow <MainWindow>();
                if (mainWindow == null)
                {
                    mainWindow = new MainWindow(resolver);
                }
                else
                {
                    mainWindow.Reload();
                }

                SystemTray _systemTray = new SystemTray();
                var        window      = _systemTray.CurrentWindow(DefaultProperties.CurrentLoginWindow);
                _systemTray.WindowClose(window);
                mainWindow.Show();
            }
        }
        /// <summary>
        /// to drag window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DragGrid_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var window = _systemTray.CurrentWindow(DefaultProperties.CurrentLoginWindow);

            window.DragMove();
        }
        /// <summary>
        /// For Closing login window
        /// </summary>
        private void CloseWindow(object sender)
        {
            var window = _systemTray.CurrentWindow(DefaultProperties.CurrentLoginWindow);

            _systemTray.WindowClose(window);
        }
        /// <summary>
        /// navigate to login page
        /// </summary>
        public void NavigateloginScreens(string parameter = "")
        {
            this.Show();
            this.Topmost       = true;
            this.ShowInTaskbar = true;
            if (parameter == ScreenNames.ShowProductTour && !this.pbData.AnyAccountExists())
            {
                var pTour = resolver.GetAllInstancesOf <IProductTour>().FirstOrDefault();
                if (pTour != null)
                {
                    if (this.IsLoaded)
                    {
                        this.Hide();
                        this.ShowInTaskbar = false;
                    }

                    if (!_isProductTourMode)
                    {
                        _isProductTourMode = true;

                        this.Activate();
                        this.Topmost = true;
                        this.Topmost = false;
                        this.Focus();
                        pTour.Show(null);
                        // HACK:
                        // moved down because pTour object get constructed twice, and in second time we loose this binding, which is actually used.
                        // search for NavigateLoginScreens("ShowProductTour")
                        // pTour.DialogClosed += onDialogClosed;
                    }

                    pTour.DialogClosed += onDialogClosed;

                    if (pTour.ContentPanel is Window)
                    {
                        (pTour.ContentPanel as Window).Show();
                    }

                    return;
                }
            }

            if (parameter == ScreenNames.AccountCreation)
            {
                MainFrame.Navigate(new CreateAccount(resolver, createAccountEmptyTask.Result));
            }
            else if (parameter == ScreenNames.LicenseScreen)
            {
                try
                {
                    var  pbSync = resolver.GetInstanceOf <IPBSync>();
                    bool syncRejectLicenseScreen =
                        pbSync.LastSyncData.SubscriptionInfo.Equals("paid", StringComparison.InvariantCultureIgnoreCase) ||
                        pbSync.LastSyncData.SubscriptionInfo.Equals("third-party", StringComparison.InvariantCultureIgnoreCase);

                    if (syncRejectLicenseScreen)
                    {
                        logger.Debug("NavigateLoginScreens - PBSync.SubscriptionInfo signals to NOT show license screen");
                        NavigateloginScreens(ScreenNames.PersonalInfoScreen);
                        return;
                    }
                }
                catch (Exception ex)
                {
                    logger.Error(ex.ToString());
                }

                var licenseActivationBusinessLayer = new BusinessLayer.License.LicenseActivationBusinessLayer(resolver);
                var licenseFactory = new BusinessLayer.License.LicenseFactory();
                var installType    = licenseActivationBusinessLayer.GetInstallTypeRegistryValue();
                var license        = licenseFactory.CreateLicense(installType, licenseActivationBusinessLayer.GetLicenseTermDaysRegistryValue());

                if (license is BusinessLayer.License.DontShowLicenseType)
                {
                    logger.Debug("NavigateLoginScreens - LicenseScreen. License screen not required to show. skip.");
                    NavigateloginScreens(ScreenNames.PersonalInfoScreen);
                }
                else if (license == null)
                {
                    logger.Error("NavigateLoginScreens - LicenseScreen. Critical! Unable to create license screen!");
                    NavigateloginScreens(ScreenNames.PersonalInfoScreen);
                }
                else
                {
                    var enterLicenseKeyViewModel = new EnterLicenseKeyViewModel(resolver, license, licenseActivationBusinessLayer);
                    var dialog = new EnterLicenseKey(resolver, enterLicenseKeyViewModel);
                    MainFrame.Navigate(dialog);
                }
            }
            else if (parameter == ScreenNames.PersonalInfoScreen)
            {
                MainFrame.Navigate(new PersonalInfoSetup(resolver));
            }
            else if (parameter == ScreenNames.BrowserExtention)
            {
                var setupProvider = ViewModel.BrowserExtentions.SetupProviderFactory.GetDefaultBrowser();
                if (setupProvider != null)
                {
                    MainFrame.Navigate(new BrowserExtentionSetup(resolver, setupProvider));
                }
                else
                {
                    logger.Debug("NavigateLoginScreens - BrowserExtention, unable to get default browser, show main window");
                    SystemTray _systemTray = new SystemTray();
                    var        window      = _systemTray.CurrentWindow(DefaultProperties.CurrentLoginWindow);
                    _systemTray.WindowClose(window);
                    var mainWindow = ((PBApp)Application.Current).FindWindow <MainWindow>();
                    if (mainWindow == null)
                    {
                        mainWindow = new MainWindow(resolver);
                    }
                }
            }
            else
            {
                MainFrame.Navigate(Login);
            }
        }