Beispiel #1
0
        /// <summary>
        /// Loads user settings from the user's profile directory
        /// </summary>
        /// <returns>true on success</returns>
        private static bool loadUserPreferences()
        {
            ACATPreferences.PreferencesFilePath        = ProfileManager.GetFullPath("Settings.xml");
            ACATPreferences.DefaultPreferencesFilePath = ProfileManager.GetFullPath("DefaultSettings.xml");

            FileUtils.AppPreferencesDir = ProfileManager.CurrentProfileDir;

            Common.AppPreferences = ACATPreferences.Load();
            if (Common.AppPreferences == null)
            {
                MessageBox.Show("Unable to read preferences from " + FileUtils.AppPreferencesDir);
                return(false);
            }

            Common.AppPreferences.Save();

            CoreGlobals.AppPreferences = Common.AppPreferences;

            ACATPreferences.SaveDefaults <ACATPreferences>(ACATPreferences.DefaultPreferencesFilePath);

            Common.AppPreferences.DebugAssertOnError = false;

            ACATPreferences.ApplicationAssembly = Assembly.GetExecutingAssembly();

            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// Event handler to save settings
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="e">event args</param>
        private void buttonSave_Click(object sender, EventArgs e)
        {
            var prefs = ACATPreferences.Load();

            prefs.SteppingTime = Common.AppPreferences.SteppingTime;

            prefs.Save();
        }
Beispiel #3
0
        /// <summary>
        /// Upgrades from v0.98 of ACAT to the curent version
        /// </summary>
        private static void upgradeFromPreviousVersion()
        {
            var acatUserDir = Path.Combine(FileUtils.GetUsersDir(), "ACAT");

            if (!Directory.Exists(acatUserDir))
            {
                return;
            }

            var acatUserProfileDir = Path.Combine(acatUserDir, "Profiles\\Default");

            if (!Directory.Exists(acatUserProfileDir))
            {
                return;
            }

            MessageBox.Show("User settings from the previous installation of ACAT will be migrated. " +
                            "The default ACAT user name has changed from \"ACAT\" to \"DefaultUser" +
                            "\n\nPress OK to continue",
                            "ACAT",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Information);

            OldPreferences.ACATPreferences.PreferencesFilePath        = Path.Combine(acatUserProfileDir, "Settings.xml");
            OldPreferences.ACATPreferences.DefaultPreferencesFilePath = Path.Combine(acatUserProfileDir, "DefaultSettings.xml");
            if (File.Exists(OldPreferences.ACATPreferences.PreferencesFilePath))
            {
                OldPreferences.ACATPreferences oldPrefs = OldPreferences.ACATPreferences.Load();

                ACATPreferences.PreferencesFilePath = OldPreferences.ACATPreferences.PreferencesFilePath;
                Common.AppPreferences = ACATPreferences.Load();

                Common.AppPreferences.MenuDialogScanTime           = oldPrefs.TabScanTime;
                Common.AppPreferences.ScanTime                     = oldPrefs.SteppingTime;
                Common.AppPreferences.FirstPauseTime               = oldPrefs.HesitateTime;
                Common.AppPreferences.MinActuationHoldTime         = oldPrefs.AcceptTime;
                Common.AppPreferences.GridScanIterations           = oldPrefs.HalfScanIterations;
                Common.AppPreferences.WordPredictionFirstPauseTime = oldPrefs.WordPredictionHesitateTime;
                Common.AppPreferences.ScreenLockPin                = oldPrefs.MutePin;
                Common.AppPreferences.ScreenLockPinMaxDigitValue   = oldPrefs.MutePinDigitMax;
                Common.AppPreferences.WindowSnapSizePercent        = oldPrefs.WindowMaximizeSizePercent;

                setPreferencesPaths();

                var oldPrefsSaveFile = Path.Combine(acatUserProfileDir, "SettingsBak.xml");

                try
                {
                    File.Move(OldPreferences.ACATPreferences.PreferencesFilePath, oldPrefsSaveFile);
                }
                catch
                {
                }
            }

            transferFileFromACATUser("Abbreviations.xml");
            transferFileFromACATUser("LaunchAppSettings.xml");
        }
Beispiel #4
0
        /// <summary>
        /// Event handler when autorepositon scanner stops moving the scanner.
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="e">event handler</param>
        private void PositionSizeController_EvtAutoRepositionScannerStop(object sender, EventArgs e)
        {
            Dispatcher.Scanner.ScannerCommon.PositionSizeController.EvtAutoRepositionScannerStop -= PositionSizeController_EvtAutoRepositionScannerStop;

            if (CoreGlobals.AppPreferences.AutoSaveScannerLastPosition)
            {
                Dispatcher.Scanner.ScannerCommon.PositionSizeController.SaveSettings(ACATPreferences.Load());
            }
        }
Beispiel #5
0
        /// <summary>
        /// Update settings based on what the user has
        /// set in the dialog.  Returns the preferences object
        /// with the settings
        /// </summary>
        /// <returns>Preferences object</returns>
        private ACATPreferences updateSettingsFromUI()
        {
            var rootWidget = PanelCommon.RootWidget;
            var prefs      = ACATPreferences.Load();

            prefs.EnableWordPredictionDynamicModel = Common.AppPreferences.EnableWordPredictionDynamicModel = (rootWidget.Finder.FindChild(pbDynamicLearning.Name) as CheckBoxWidget).GetState();
            prefs.WordPredictionCount = Common.AppPreferences.WordPredictionCount = (rootWidget.Finder.FindChild(tbWordCount.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsOnes);

            return(prefs);
        }
        /// <summary>
        /// Update settings based on what the user has
        /// set in the dialog
        /// </summary>
        private ACATPreferences updateSettingsFromUI()
        {
            var rootWidget = _dialogCommon.GetRootWidget();
            var prefs      = ACATPreferences.Load();

            prefs.EnableWordPredictionDynamicModel = Common.AppPreferences.EnableWordPredictionDynamicModel = WidgetUtils.GetCheckBoxWidgetState(rootWidget, pbDynamicLearning.Name);
            prefs.EnableWordPredictionCorpusModel  = Common.AppPreferences.EnableWordPredictionCorpusModel = WidgetUtils.GetCheckBoxWidgetState(rootWidget, pbUseCorpus.Name);
            prefs.WordPredictionCount = Common.AppPreferences.WordPredictionCount = WidgetUtils.GetSliderState(rootWidget, tbWordCount.Name, WidgetUtils.SliderUnitsOnes);

            return(prefs);
        }
Beispiel #7
0
        public override void OnRunCommand(String command, object commandArg, ref bool handled)
        {
            handled = true;

            Log.Debug(command);
            switch (command)
            {
            case "TalkWindowZoomIn":
                Context.AppTalkWindowManager.ZoomIn();
                break;

            case "TalkWindowZoomOut":
                Context.AppTalkWindowManager.ZoomOut();
                break;

            case "TalkWindowZoomDefault":
                Context.AppTalkWindowManager.ZoomDefault();
                break;

            case "TalkWindowSaveZoom":
                if (DialogUtils.ConfirmScanner(R.GetString("SaveFontSetting")))
                {
                    var prefs = ACATPreferences.Load();
                    prefs.TalkWindowFontSize = Context.AppTalkWindowManager.FontSize;
                    prefs.Save();
                }

                break;

            case "ClearTalkWindowText":
                if (Context.AppTalkWindowManager.IsTalkWindowActive)
                {
                    String text = Context.AppTalkWindowManager.TalkWindowText;
                    if (!String.IsNullOrEmpty(text))
                    {
                        if (DialogUtils.ConfirmScanner(R.GetString("ClearTalkWindow")))
                        {
                            Context.AppTalkWindowManager.Clear();
                        }
                    }
                }

                break;

            default:
                base.OnRunCommand(command, commandArg, ref handled);
                break;
            }
        }
Beispiel #8
0
        /// <summary>
        /// Update settings based on the values set by the
        /// user in the form
        /// </summary>
        private ACATPreferences getSettingsFromUI()
        {
            Widget rootWidget = _dialogCommon.GetRootWidget();
            var    prefs      = ACATPreferences.Load();

            prefs.MouseGridVerticalSpeed    = Common.AppPreferences.MouseGridVerticalSpeed = WidgetUtils.GetSliderState(rootWidget, tbVerticalSpeed.Name, WidgetUtils.SliderUnitsOnes);
            prefs.MouseGridVerticalSweeps   = Common.AppPreferences.MouseGridVerticalSweeps = WidgetUtils.GetSliderState(rootWidget, tbVerticalSweeps.Name, WidgetUtils.SliderUnitsOnes);
            prefs.MouseGridHorizontalSpeed  = Common.AppPreferences.MouseGridHorizontalSpeed = WidgetUtils.GetSliderState(rootWidget, tbHorizontalSpeed.Name, WidgetUtils.SliderUnitsOnes);
            prefs.MouseGridHorizontalSweeps = Common.AppPreferences.MouseGridHorizontalSweeps = WidgetUtils.GetSliderState(rootWidget, tbHorizontalSweeps.Name, WidgetUtils.SliderUnitsOnes);
            prefs.MouseGridLineWidth        = Common.AppPreferences.MouseGridLineWidth = WidgetUtils.GetSliderState(rootWidget, tbLineWidth.Name, WidgetUtils.SliderUnitsOnes);

            prefs.MouseGridStartFromLastCursorPos = Common.AppPreferences.MouseGridStartFromLastCursorPos = WidgetUtils.GetCheckBoxWidgetState(rootWidget, pbStartFromLastCursorPos.Name);

            return(prefs);
        }
Beispiel #9
0
        /// <summary>
        /// Updates settings based on the values set by the
        /// user in the form.  Returns a ACATPreferences object
        /// with the new values.
        /// </summary>
        /// <returns>ACATPreferences object</returns>
        private ACATPreferences getSettingsFromUI()
        {
            var rootWidget = _dialogCommon.GetRootWidget();
            var prefs      = ACATPreferences.Load();

            prefs.MouseGridRectangleSpeed  = Common.AppPreferences.MouseGridRectangleSpeed = (rootWidget.Finder.FindChild(tbRectangleSpeed.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsOnes);
            prefs.MouseGridRectangleCycles = Common.AppPreferences.MouseGridRectangleCycles = (rootWidget.Finder.FindChild(tbRectangleCycles.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsOnes);
            prefs.MouseGridLineSpeed       = Common.AppPreferences.MouseGridLineSpeed = (rootWidget.Finder.FindChild(tbLineSpeed.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsOnes);
            prefs.MouseGridLineCycles      = Common.AppPreferences.MouseGridLineCycles = (rootWidget.Finder.FindChild(tbLineCycles.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsOnes);
            prefs.MouseGridLineThickness   = Common.AppPreferences.MouseGridLineThickness = (rootWidget.Finder.FindChild(tbLineThickness.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsOnes);

            prefs.MouseGridEnableVerticalRectangleScan = Common.AppPreferences.MouseGridEnableVerticalRectangleScan = (rootWidget.Finder.FindChild(pbEnableVerticalRectScan.Name) as CheckBoxWidget).GetState();

            return(prefs);
        }
Beispiel #10
0
        /// <summary>
        /// Update settings based on the values set by the
        /// user in the form
        /// </summary>
        private ACATPreferences updateSettingsFromUI()
        {
            var prefs = ACATPreferences.Load();

            Widget rootWidget = _dialogCommon.GetRootWidget();

            prefs.MouseRadarRotatingSpeed  = Common.AppPreferences.MouseRadarRotatingSpeed = WidgetUtils.GetSliderState(rootWidget, tbRotatingSpeed.Name, WidgetUtils.SliderUnitsOnes);
            prefs.MouseRadarRotatingSweeps = Common.AppPreferences.MouseRadarRotatingSweeps = WidgetUtils.GetSliderState(rootWidget, tbRotatingSweeps.Name, WidgetUtils.SliderUnitsOnes);
            prefs.MouseRadarRadialSpeed    = Common.AppPreferences.MouseRadarRadialSpeed = WidgetUtils.GetSliderState(rootWidget, tbRadialSpeed.Name, WidgetUtils.SliderUnitsOnes);
            prefs.MouseRadarRadialSweeps   = Common.AppPreferences.MouseRadarRadialSweeps = WidgetUtils.GetSliderState(rootWidget, tbRadialSweeps.Name, WidgetUtils.SliderUnitsOnes);
            prefs.MouseRadarLineWidth      = Common.AppPreferences.MouseRadarLineWidth = WidgetUtils.GetSliderState(rootWidget, tbLineWidth.Name, WidgetUtils.SliderUnitsOnes);

            prefs.MouseRadarStartFromLastCursorPos = Common.AppPreferences.MouseRadarStartFromLastCursorPos = WidgetUtils.GetCheckBoxWidgetState(rootWidget, pbStartFromLastCursorPos.Name);

            return(prefs);
        }
Beispiel #11
0
        /// <summary>
        /// Gets the settings with the current state of
        /// widgets in the form and returns a ACATPreferences
        /// object that can be presisted.
        /// </summary>
        /// <returns>Preferences with settings from the form</returns>
        private ACATPreferences getAppPreferencesFromUI()
        {
            var prefs = ACATPreferences.Load();

            var rootWidget = PanelCommon.RootWidget;

            prefs.HideScannerOnIdle = Common.AppPreferences.HideScannerOnIdle = (rootWidget.Finder.FindChild(pbHideScannersOnIdle.Name) as CheckBoxWidget).GetState();
            prefs.ExpandAbbreviationsOnSeparator = Common.AppPreferences.ExpandAbbreviationsOnSeparator = (rootWidget.Finder.FindChild(pbExpandAbbreviationsOnSeparator.Name) as CheckBoxWidget).GetState();
            prefs.ShowTalkWindowOnStartup        = Common.AppPreferences.ShowTalkWindowOnStartup = (rootWidget.Finder.FindChild(pbShowTalkWindowOnStartup.Name) as CheckBoxWidget).GetState();
            prefs.RetainTalkWindowContentsOnHide = Common.AppPreferences.RetainTalkWindowContentsOnHide = (rootWidget.Finder.FindChild(pbRetainTalkWindowText.Name) as CheckBoxWidget).GetState();
            prefs.AutoSaveScannerLastPosition    = Common.AppPreferences.AutoSaveScannerLastPosition = (rootWidget.Finder.FindChild(pbScannerAutoSaveLastPosition.Name) as CheckBoxWidget).GetState();

            if (Common.AppPreferences.AutoSaveScannerLastPosition)
            {
                prefs.ScannerPosition = Common.AppPreferences.ScannerPosition = Context.AppWindowPosition;
            }

            return(prefs);
        }
Beispiel #12
0
        /// <summary>
        /// Gets the values from the form and updates the settings. Returns
        /// the preferences object with the new settings
        /// </summary>
        /// <returns>The </returns>
        private ACATPreferences getSettingsFromUI()
        {
            var rootWidget = _dialogCommon.GetRootWidget();
            var prefs      = ACATPreferences.Load();

            prefs.SelectClick = Common.AppPreferences.SelectClick = (rootWidget.Finder.FindChild(pbSelectingClick.Name) as CheckBoxWidget).GetState();

            prefs.HalfScanIterations           = Common.AppPreferences.HalfScanIterations = (rootWidget.Finder.FindChild(tbEveryHalf.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsOnes);
            prefs.RowScanIterations            = Common.AppPreferences.RowScanIterations = (rootWidget.Finder.FindChild(tbEveryRow.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsOnes);
            prefs.ColumnScanIterations         = Common.AppPreferences.ColumnScanIterations = (rootWidget.Finder.FindChild(tbEveryColumn.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsOnes);
            prefs.WordPredictionScanIterations = Common.AppPreferences.WordPredictionScanIterations = (rootWidget.Finder.FindChild(tbWordPrediction.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsOnes);

            prefs.AcceptTime   = Common.AppPreferences.AcceptTime = (rootWidget.Finder.FindChild(tbAcceptTime.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsThousandths);
            prefs.SteppingTime = Common.AppPreferences.SteppingTime = (rootWidget.Finder.FindChild(tbSteppingTime.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsThousandths);
            prefs.HesitateTime = Common.AppPreferences.HesitateTime = (rootWidget.Finder.FindChild(tbHesitateTime.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsThousandths);
            prefs.WordPredictionHesitateTime = Common.AppPreferences.WordPredictionHesitateTime = (rootWidget.Finder.FindChild(tbWordListHesitateTime.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsThousandths);
            prefs.TabScanTime     = Common.AppPreferences.TabScanTime = (rootWidget.Finder.FindChild(tbTabScanTime.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsThousandths);
            prefs.FirstRepeatTime = Common.AppPreferences.FirstRepeatTime = (rootWidget.Finder.FindChild(tbFirstRepeatTime.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsThousandths);

            return(prefs);
        }
Beispiel #13
0
        /// <summary>
        /// Updates the preferences based on values from
        /// the form (the pincode in this case). Returns a
        /// new Preferences object
        /// </summary>
        /// <returns>ACATPreferences object</returns>
        private ACATPreferences updateSettingsFromUI()
        {
            var   pin = Windows.GetText(tbPINCode);
            Int32 intPinCode;

            Log.Debug("strPINCode=" + pin);

            ACATPreferences prefs = null;

            if (Int32.TryParse(pin, out intPinCode) == false)
            {
                // fail because it is not a number
                Log.Debug("Invalid pincode provided!");
            }
            else
            {
                prefs = ACATPreferences.Load();
                prefs.ScreenLockPin = Common.AppPreferences.ScreenLockPin = pin;
                prefs.ScreenLockPinMaxDigitValue = Common.AppPreferences.ScreenLockPinMaxDigitValue = (byte)(PanelCommon.RootWidget.Finder.FindChild(tbMaxDigit.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsOnes);
            }
            return(prefs);
        }
Beispiel #14
0
        /// <summary>
        /// Update the preferences based on values from
        /// the form (the pincode in this case)
        /// </summary>
        private ACATPreferences updateSettingsFromUI()
        {
            var   strPinCode = Windows.GetText(tbPINCode);
            Int32 intPinCode;

            Log.Debug("strPINCode=" + strPinCode);

            ACATPreferences prefs = null;

            if (Int32.TryParse(strPinCode, out intPinCode) == false)
            {
                // fail because it is not a number
                Log.Debug("Invalid pincode provided!");
            }
            else
            {
                prefs                 = ACATPreferences.Load();
                prefs.MutePin         = Common.AppPreferences.MutePin = strPinCode;
                prefs.MutePinDigitMax = Common.AppPreferences.MutePinDigitMax = (byte)WidgetUtils.GetSliderState(_dialogCommon.GetRootWidget(), tbMaxDigit.Name, WidgetUtils.SliderUnitsOnes);
            }
            return(prefs);
        }
Beispiel #15
0
        /// <summary>
        /// Gets the values from the form and updates the settings. Returns
        /// the preferences object with the new settings
        /// </summary>
        /// <returns>The </returns>
        private ACATPreferences getSettingsFromUI()
        {
            var rootWidget = PanelCommon.RootWidget;
            var prefs      = ACATPreferences.Load();

            prefs.SelectClick = Common.AppPreferences.SelectClick = (rootWidget.Finder.FindChild(pbSelectingClick.Name) as CheckBoxWidget).GetState();

            prefs.GridScanIterations           = Common.AppPreferences.GridScanIterations = (rootWidget.Finder.FindChild(tbEveryHalf.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsOnes);
            prefs.RowScanIterations            = Common.AppPreferences.RowScanIterations = (rootWidget.Finder.FindChild(tbEveryRow.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsOnes);
            prefs.ColumnScanIterations         = Common.AppPreferences.ColumnScanIterations = (rootWidget.Finder.FindChild(tbEveryColumn.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsOnes);
            prefs.WordPredictionScanIterations = Common.AppPreferences.WordPredictionScanIterations = (rootWidget.Finder.FindChild(tbWordPrediction.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsOnes);
            prefs.StripScannerColumnIterations = Common.AppPreferences.StripScannerColumnIterations = (rootWidget.Finder.FindChild(tbStripScanner.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsOnes);

            prefs.MinActuationHoldTime         = Common.AppPreferences.MinActuationHoldTime = (rootWidget.Finder.FindChild(tbAcceptTime.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsThousandths);
            prefs.ScanTime                     = Common.AppPreferences.ScanTime = (rootWidget.Finder.FindChild(tbSteppingTime.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsThousandths);
            prefs.FirstPauseTime               = Common.AppPreferences.FirstPauseTime = (rootWidget.Finder.FindChild(tbHesitateTime.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsThousandths);
            prefs.WordPredictionFirstPauseTime = Common.AppPreferences.WordPredictionFirstPauseTime = (rootWidget.Finder.FindChild(tbWordListHesitateTime.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsThousandths);
            prefs.MenuDialogScanTime           = Common.AppPreferences.MenuDialogScanTime = (rootWidget.Finder.FindChild(tbTabScanTime.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsThousandths);
            prefs.FirstRepeatTime              = Common.AppPreferences.FirstRepeatTime = (rootWidget.Finder.FindChild(tbFirstRepeatTime.Name) as SliderWidget).GetState(SliderWidget.SliderUnitsThousandths);

            return(prefs);
        }
Beispiel #16
0
        /// <summary>
        /// Get the settings with the current state of
        /// widgets in the form
        /// </summary>
        /// <returns>Preferences with settings from the form</returns>
        private ACATPreferences getAppPreferencesFromUI()
        {
            var prefs = ACATPreferences.Load();

            var rootWidget = _dialogCommon.GetRootWidget();

            prefs.EnableGlass       = Common.AppPreferences.EnableGlass = WidgetUtils.GetCheckBoxWidgetState(rootWidget, pbShowGlass.Name);
            prefs.HideScannerOnIdle = Common.AppPreferences.HideScannerOnIdle = WidgetUtils.GetCheckBoxWidgetState(rootWidget, pbHideScannersOnIdle.Name);
            prefs.ExpandAbbreviationsOnSeparator = Common.AppPreferences.ExpandAbbreviationsOnSeparator = WidgetUtils.GetCheckBoxWidgetState(rootWidget, pbExpandAbbreviationsOnSeparator.Name);
            prefs.ShowTalkWindowOnStartup        = Common.AppPreferences.ShowTalkWindowOnStartup = WidgetUtils.GetCheckBoxWidgetState(rootWidget, pbShowTalkWindowOnStartup.Name);
            prefs.RetainTalkWindowContentsOnHide = Common.AppPreferences.RetainTalkWindowContentsOnHide = WidgetUtils.GetCheckBoxWidgetState(rootWidget, pbRetainTalkWindowText.Name);
            prefs.DebugMessagesEnable            = Common.AppPreferences.DebugMessagesEnable = WidgetUtils.GetCheckBoxWidgetState(rootWidget, pbEnableDebugTraceLogging.Name);
            prefs.AuditLogEnable = Common.AppPreferences.AuditLogEnable = WidgetUtils.GetCheckBoxWidgetState(rootWidget, pbEnableAuditLog.Name);
            prefs.AutoSaveScannerLastPosition = Common.AppPreferences.AutoSaveScannerLastPosition = WidgetUtils.GetCheckBoxWidgetState(rootWidget, pbScannerAutoSaveLastPosition.Name);
            if (Common.AppPreferences.AutoSaveScannerLastPosition)
            {
                prefs.ScannerPosition = Common.AppPreferences.ScannerPosition = Context.AppWindowPosition;
            }

            prefs.DebugLogMessagesToFile = Common.AppPreferences.DebugLogMessagesToFile = Common.AppPreferences.DebugMessagesEnable;

            return(prefs);
        }
Beispiel #17
0
        /// <summary>
        /// User selected a language from the list.  If reqd,
        /// ask the user to confirm the switch
        /// </summary>
        /// <param name="cultureInfo">Cultureinfo of the language selected</param>
        /// <returns>true on success</returns>
        private void onLanguageSelected(CultureInfo cultureInfo)
        {
            if (DialogUtils.ConfirmScanner(String.Format(R.GetString("ConfirmSwitchLanguage"), cultureInfo.DisplayName)))
            {
                Windows.SetVisible(this, false);

                var toastForm = new ToastForm(R.GetString("PleaseWait"), -1);
                Windows.SetWindowPosition(toastForm, Windows.WindowPosition.CenterScreen);
                toastForm.Show();

                Invoke(new MethodInvoker(delegate
                {
                    Context.ChangeCulture(cultureInfo);
                }));

                toastForm.Close();

                var prefs = ACATPreferences.Load();
                prefs.Language = cultureInfo.Name;
                prefs.Save();

                Windows.CloseAsync(this);
            }
        }
Beispiel #18
0
        /// <summary>
        /// Loads user settings from the user's profile directory
        /// </summary>
        /// <returns>true on success</returns>
        public static bool LoadUserPreferences()
        {
            setPreferencesPaths();

            FileUtils.AppPreferencesDir = ProfileManager.CurrentProfileDir;

            Common.AppPreferences = ACATPreferences.Load();
            if (Common.AppPreferences == null)
            {
                MessageBox.Show(String.Format(R.GetString("UnableToReadPreferences")), FileUtils.AppPreferencesDir);
                return(false);
            }

            if (!Common.AppPreferences.TransferredPreferencesFromV098)
            {
                upgradeFromPreviousVersion();
                Common.AppPreferences.TransferredPreferencesFromV098 = true;
            }

            if (!Common.AppPreferences.TransferredSettingsFromV099)
            {
                if (upgradeFromVersion099())
                {
                    Common.AppPreferences.TransferredSettingsFromV099 = true;
                }
            }

            if (!Common.AppPreferences.TransferredSettingsFromV0991)
            {
                if (upgradeFromVersion0991())
                {
                    Common.AppPreferences.TransferredSettingsFromV0991 = true;
                }
            }

            if (Common.AppPreferences.ShowThemeSelectDialogOnStartup)
            {
                if (ShowThemeSelectDialog())
                {
                    Common.AppPreferences.ShowThemeSelectDialogOnStartup = false;

                    MessageBox.Show(
                        "You can change the preferred color scheme through \"ACAT Config\" in the Dashboard",
                        Common.AppPreferences.AppName,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                }
            }

            Common.AppPreferences.Save();

            CoreGlobals.AppPreferences = Common.AppPreferences;

            CoreGlobals.AppDefaultPreferences = ACATPreferences.LoadDefaultSettings();

            ACATPreferences.SaveDefaults <ACATPreferences>(ACATPreferences.DefaultPreferencesFilePath);

            Common.AppPreferences.DebugAssertOnError = false;

            ACATPreferences.ApplicationAssembly = Assembly.GetEntryAssembly();

            return(true);
        }