Example #1
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            TranslationHelper.Instance.TranslatorInstance.Translate(this);

            ApplicationNameText.Text = "PDFCreator " + VersionHelper.Instance.FormatWithTwoDigits();

            // Apply company name for customized setups
            ApplyCustomization();

            if (!EditionFactory.Instance.Edition.ShowWelcomeWindow)
            {
                return;
            }

            var welcomeSettingsHelper = new WelcomeSettingsHelper();

            if (welcomeSettingsHelper.IsFirstRun())
            {
                welcomeSettingsHelper.SetCurrentApplicationVersionAsWelcomeVersionInRegistry();
                WelcomeWindow.ShowDialogTopMost();
            }
            else
            {
                var plushelper = new PlusHintHelper();
                if (plushelper.DisplayHint())
                {
                    PlusHintWindow.ShowTopMost(plushelper.CurrentJobCounter);
                }
            }
        }
        public void FirstRunTestWithEnabledGPO_WelcomeVersionIsSmallerThanCurrentVersion_IsRequiredReturnsTrue()
        {
            SetVersionInRegistryStub("Not the current version");

            var welcomeSettingsHelper = new WelcomeSettingsHelper(_registry, _versionHelper, _gpoSettings);

            Assert.IsTrue(welcomeSettingsHelper.CheckIfRequiredAndSetCurrentVersion(), "Enabled GPO settnig should not hide the Welcome Window");
        }
        public void FirstRunTest_WelcomeVersionIsTheCurrentVersion_IsRequiredReturnsFalse()
        {
            SetVersionInRegistryStub(_versionHelper.FormatWithBuildNumber()); //current version

            var welcomeSettingsHelper = new WelcomeSettingsHelper(_registry, _versionHelper, _gpoSettings);

            Assert.IsFalse(welcomeSettingsHelper.CheckIfRequiredAndSetCurrentVersion(), "Current Version as WelcomeVersion detected as FirstRun.");
        }
        public void FirstRunTest_WelcomeVersionIsSmallerThanCurrentVersion_IsRequiredReturnsTrue()
        {
            SetVersionInRegistryStub("0.0.0");

            var welcomeSettingsHelper = new WelcomeSettingsHelper(_registry, _versionHelper, _gpoSettings);

            Assert.IsTrue(welcomeSettingsHelper.CheckIfRequiredAndSetCurrentVersion(), "Smaller WelcomeVersion in registry not detected as FirstRun.");
        }
        public void FirstRunTest_NoWelcomeVersionSet_IsFirstRun()
        {
            SetVersionInRegistryStub("");

            var welcomeSettingsHelper = new WelcomeSettingsHelper(_registry, _versionHelper, _gpoSettings);

            Assert.IsTrue(welcomeSettingsHelper.CheckIfRequiredAndSetCurrentVersion(), "Empty registry value for WelcomeVersion not detected as FirstRun.");
        }
        public void SetCurrentVersionAsWelcomeVersionTest_RegistrySetValueGetsCalled()
        {
            var welcomeSettingsHelper = new WelcomeSettingsHelper(_registry, _versionHelper, _gpoSettings);
            var currentVersion        = _versionHelper.FormatWithBuildNumber();

            welcomeSettingsHelper.SetCurrentApplicationVersionAsWelcomeVersionInRegistry();

            _registry.Received(1).SetValue(WelcomeSettingsHelper.RegistryKeyForWelcomeSettings,
                                           WelcomeSettingsHelper.RegistryValueForWelcomeVersion, currentVersion);
        }
Example #7
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            TranslationHelper.Instance.TranslatorInstance.Translate(this);

            ApplicationNameText.Text = "clawPDF " + VersionHelper.Instance.FormatWithTwoDigits();

            var welcomeSettingsHelper = new WelcomeSettingsHelper();

            if (welcomeSettingsHelper.IsFirstRun())
            {
                welcomeSettingsHelper.SetCurrentApplicationVersionAsWelcomeVersionInRegistry();
            }
        }
Example #8
0
        public void SetCurrentVersionAsWelcomeVersionTest_RegistrySetValueGetsCalled()
        {
            var registryMock = MockRepository.GenerateMock <IRegistry>();

            var welcomeSettingsHelper = new WelcomeSettingsHelper(registryMock, _versionHelper);
            var currentVersion        = _versionHelper.FormatWithBuildNumber();

            welcomeSettingsHelper.SetCurrentApplicationVersionAsWelcomeVersionInRegistry();

            registryMock.AssertWasCalled(
                x => x.SetValue(WelcomeSettingsHelper.RegistryKeyForWelcomeSettings,
                                WelcomeSettingsHelper.RegistryValueForWelcomeVersion, currentVersion),
                options => options.Repeat.Once());
        }
Example #9
0
        public void FirstRunTest_WelcomeVersionIsSmallerThanCurrentVersion_IsFirstRun()
        {
            var registryMock = MockRepository.GenerateMock <IRegistry>();

            registryMock.Stub(x => x.GetValue(WelcomeSettingsHelper.RegistryKeyForWelcomeSettings, WelcomeSettingsHelper.RegistryValueForWelcomeVersion, null)).Return("0.0.0");

            var welcomeSettingsHelper = new WelcomeSettingsHelper(registryMock, _versionHelper);

            Assert.IsTrue(welcomeSettingsHelper.IsFirstRun(), "Smaller WelcomeVersion in registry not detected as FirstRun.");

            registryMock.AssertWasCalled(
                x => x.GetValue(WelcomeSettingsHelper.RegistryKeyForWelcomeSettings,
                                WelcomeSettingsHelper.RegistryValueForWelcomeVersion, null), options => options.Repeat.Once());
        }
Example #10
0
        public void FirstRunTest_NoWelcomeVersionSet_IsFirstRun()
        {
            IRegistry registryMock = MockRepository.GenerateMock <IRegistry>();

            registryMock.Stub(x => x.GetValue(WelcomeSettingsHelper.RegistryKeyForWelcomeSettings, WelcomeSettingsHelper.RegistryValueForWelcomeVersion, null)).Return("");

            var welcomeSettingsHelper = new WelcomeSettingsHelper(registryMock, _versionHelper);

            Assert.IsTrue(welcomeSettingsHelper.IsFirstRun(), "Empty registry value for WelcomeVersion not detected as FirstRun.");

            registryMock.AssertWasCalled(
                x => x.GetValue(WelcomeSettingsHelper.RegistryKeyForWelcomeSettings,
                                WelcomeSettingsHelper.RegistryValueForWelcomeVersion, null), options => options.Repeat.Once());
        }
Example #11
0
        public void FirstRunTest_WelcomeVersionIsTheCurrentVersion_IsNotFirstRun()
        {
            var registryMock = MockRepository.GenerateMock <IRegistry>();

            var welcomeSettingsHelper = new WelcomeSettingsHelper(registryMock, _versionHelper);
            var currentVersion        = _versionHelper.FormatWithBuildNumber();

            registryMock.Stub(x => x.GetValue(WelcomeSettingsHelper.RegistryKeyForWelcomeSettings, WelcomeSettingsHelper.RegistryValueForWelcomeVersion, null)).Return(currentVersion);

            Assert.IsFalse(welcomeSettingsHelper.IsFirstRun(), "Current Version as WelcomeVersion detected as FirstRun.");

            registryMock.AssertWasCalled(
                x => x.GetValue(WelcomeSettingsHelper.RegistryKeyForWelcomeSettings,
                                WelcomeSettingsHelper.RegistryValueForWelcomeVersion, null), options => options.Repeat.Once());
        }