Beispiel #1
0
        public void calibratePressureAuto()
        {
            PressureItem setting = (PressureItem)settings.CurrentSettings.GetComponent(ID);

            Double phV     = aDConverter.GetADVoltage(sensorId);
            Double vCutoff = 2.8;

            Console.WriteLine("Calibrating Pressure: " + phV.ToString());

            if (phV >= vCutoff)
            {
                if (MessageBox.Show("110 PSI ? @ " + phV.ToString() + "V", "Calibrate 110PSI", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    pressure110         = phV;
                    setting.pressure110 = phV;
                    settings.Save();
                }
            }
            else
            {
                if (MessageBox.Show("80 PSI ? @ " + phV.ToString() + "V", "Calibrate 80PSI", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    pressure80         = phV;
                    setting.pressure80 = phV;
                    settings.Save();
                }
            }
        }
Beispiel #2
0
        public void CalibratePHAuto()
        {
            PHAnalogItem setting = (PHAnalogItem)settings.CurrentSettings.GetComponent(ID);

            if (setting != null)
            {
                Double phV     = aDConverter.GetADVoltage(sensorId);
                Double vCutoff = 1.5;

                if (phV <= vCutoff)
                {
                    if (MessageBox.Show("4 PH ? @ " + phV.ToString() + "V", "Calibrate 4 PH", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        setting.ph4Voltage = phV;
                        settings.Save();
                    }
                }
                else
                {
                    if (MessageBox.Show("7 PH ? @ " + phV.ToString() + "V", "Calibrate 70 PH", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        setting.ph7Voltage = phV;
                        settings.Save();
                    }
                }


                settings.Save();
            }
        }
Beispiel #3
0
 public void InitializeTest( )
 {
     if (string.IsNullOrEmpty(mSettings.DefaultPath))
     {
         mSettings.DefaultPath = mDefault;
         mSettings.Save();
     }
 }
        private void ButtonSettingsApply_Click(object sender, RoutedEventArgs e)
        {
            settingsInstance.AutoRefresh         = (bool)checkBoxAutoRefresh.IsChecked;
            settingsInstance.AutoRefreshInterval = Convert.ToInt32(numericUpDownRefreshInterval.Text);
            settingsInstance.AdvancedMode        = (bool)checkBoxAdvancedMode.IsChecked;
            settingsInstance.CheckForUpdates     = (bool)checkBoxCheckUpdate.IsChecked;

            settingsInstance.Save();

            timerInstance.Interval = TimeSpan.FromMilliseconds(settingsInstance.AutoRefreshInterval);
            _DarkMode = settingsInstance.DarkMode;


            if (notificationTimer != null)
            {
                if (notificationTimer.IsEnabled)
                {
                    notificationTimer.Stop();
                }
            }

            notificationTimer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(6000)
            };

            notificationTimer.Tick += new EventHandler((s, x) =>
            {
                notificationTimer.Stop();
                myPopup.IsOpen = false;
            });

            notificationTimer.Start();

            if (checkBoxAutoRefresh.IsEnabled)
            {
                if (settingsInstance.AutoRefresh && !timerInstance.IsEnabled)
                {
                    timerInstance.Start();
                }
                else if (!settingsInstance.AutoRefresh && timerInstance.IsEnabled)
                {
                    timerInstance.Stop();
                }
            }

            if (_AdvancedMode != settingsInstance.AdvancedMode)
            {
                buttonSettingsRestart.Visibility = Visibility.Visible;
                settingsInstance.IsRestarting    = true;
                settingsInstance.Save();
                popupText.Text = "Advanced Mode will be applied on next launch.";
            }

            myPopup.Width  = OptionWindowContent.ActualWidth;
            myPopup.IsOpen = true;
        }
 /// <summary>
 /// Signals from MainForm that the form is ready to gather information
 /// </summary>
 public async Task Ready()
 {
     // goqsane: This is to prevent the settings being empty bug
     if (Settings.Values.UltimaPath == String.Empty)
     {
         Settings.Values.UltimaPath = RegistryChecker.GetUoPath();
         Settings.Save();
     }
     await DownloadServerInformationAsync();
 }
Beispiel #6
0
        public void VerifyEncryptedValue()
        {
            const string testValue = "whatever";

            var settings = new AppSettings(); // will simply overwrite any existing settings

            settings.SensitiveValue = testValue;
            settings.Save();

            // inspect the json directly
            string fileName = settings.GetFullPath();

            using (StreamReader reader = File.OpenText(fileName))
            {
                string      json = reader.ReadToEnd();
                AppSettings test = JsonConvert.DeserializeObject <AppSettings>(json);

                // the sensitive value on disk is not the same as in memory and not just empty
                Assert.IsTrue(!settings.SensitiveValue.Equals(test.SensitiveValue) && !string.IsNullOrEmpty(test.SensitiveValue));
            }

            // when we load from disk, the sensitive value is what we started with
            settings = JsonSettingsBase.Load <AppSettings>();
            Assert.IsTrue(settings.SensitiveValue.Equals(testValue));
        }
        public static void Main()
        {
            FileInfo fi = new FileInfo("settings.json");

            if (fi.Exists)
            {
                Settings = new AppSettings(fi);
            }
            else
            {
                Settings = new AppSettings();
                Settings.Save(AppDomain.CurrentDomain.BaseDirectory);
            }

            ProjectHistory.TriggerAlso("IsHistoryEmpty");

            LoadCollections();
            LoadHistory();

            App app = new App()
            {
                ShutdownMode = ShutdownMode.OnMainWindowClose
            };

            app.InitializeComponent();
            app.Run();
        }
 private void OnSaveClick(object sender, RoutedEventArgs e)
 {
     _settings.ChatSettings.IgnoreWords    = _tbIgnore.Text.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries);
     _settings.ChatSettings.HighlightWords = _tbHighlight.Text.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries);
     _settings.Save();
     MessageBox.Show("Done");
 }
        public void And_settings_file_does_not_exist_it_should_be_created()
        {
            var fileName = Guid.NewGuid() + ".config";
            var fullPathToConfigurationFile = TestHelpers.GetFullPathToConfigurationFile(fileName);

            try
            {
                Assert.IsFalse(System.IO.File.Exists(fullPathToConfigurationFile));

                var settings = new AppSettings(fullPathToConfigurationFile, FileOption.None);

                settings.SetValue("string", "a");
                settings.SetValue<int>("int", 1);
                settings.SetValue<int?>("nullableint", null);

                settings.Save();

                Assert.IsTrue(System.IO.File.Exists(fullPathToConfigurationFile));
                Assert.IsTrue(settings.FileExists);
            }
            finally
            {
                TestHelpers.DeleteIfExists(fullPathToConfigurationFile);
            }
        }
Beispiel #10
0
        private void SaveSettings()
        {
            Settings.Locations.ResetBindings();
            Settings.Variables.ResetBindings();

            if (Settings.Locations.Any(m => string.IsNullOrEmpty(m.CopyToFolder) || string.IsNullOrEmpty(m.FriendlyName) || string.IsNullOrEmpty(m.WatchFolder)))
            {
                MetroFramework.MetroMessageBox.Show(this, "Please fill out all fields", "Save", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TabControl.SelectedTab = configTabPage;
                return;
            }

            if (Settings.Variables.Any(v => string.IsNullOrEmpty(v.Name) || string.IsNullOrEmpty(v.Value)))
            {
                MetroFramework.MetroMessageBox.Show(this, "Please fill out all fields", "Save", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TabControl.SelectedTab = variablesTabPage;
                return;
            }

            if (Settings.Variables.Count(v => v.Name == variableName.Text) > 1)
            {
                MetroFramework.MetroMessageBox.Show(this, "Oops, the variable name already exists. Variable names must be unique.", "Save", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TabControl.SelectedTab = variablesTabPage;
                return;
            }

            AppSettings.Save(Settings, _saveFile);
        }
Beispiel #11
0
        public void OnSaveOptions()
        {
            _Saving = true;

            OptionsSaving?.Invoke(this, EventArgs.Empty);

            foreach (SettingsProperty sett in Settings)
            {
                try
                {
                    AppSettings[sett.Name] = sett.DefaultValue;
                }
                catch
                {
                }
            }

            if (AutomaticSaveSettings)
            {
                AppSettings.Save();
                AppSettings.Reload();

                OptionsSaved?.Invoke(this, EventArgs.Empty);
            }

            _Saving = false;
        }
Beispiel #12
0
        async void searchDataForRootTable()
        {
            if (null != SelectedRootDataView)
            {
                if (!AppSettings.SearchValues.Contains(SelectedSearchCriteria))
                {
                    AppSettings.SearchValues.Add(SelectedSearchCriteria);
                    AppSettings.Save();
                    OnPropertyChanged("AppSettings");
                    ClearSearchHistoryCommand.AsRelay().RaiseCanExecuteChanged();
                }

                if (!IsBusy)
                {
                    Common.Extensions.TraceLog.Information("Searching data for table {name} with {SelectedColumn} {SelectedOperator} {SearchCriteria}",
                                                           WorkingTable.Root.ConfigTable.name,
                                                           SelectedColumn,
                                                           SelectedOperator,
                                                           SearchCriteria
                                                           );

                    IsBusy = true;
                    var table = await WorkingTable.Root.ConfigTable
                                .Query(SelectedOperator.ToArray(),
                                       "".ToArray(),
                                       true,
                                       new SqlParameter(SelectedColumn, SearchCriteria));

                    IsBusy       = false;
                    WorkingTable = table;
                    SearchCommand.AsRelay().RaiseCanExecuteChanged();
                    CopyCommand.AsRelay().RaiseCanExecuteChanged();
                }
            }
        }
Beispiel #13
0
 private static void SaveSettings(AppSettings settings)
 {
     try
     {
         if (Monitor.TryEnter(ConfigFileName, 2000))
         {
             try
             {
                 using (var file = IsolatedStorageFile.GetUserStoreForAssembly())
                 {
                     using (var stream = new IsolatedStorageFileStream(ConfigFileName, FileMode.Create, file))
                     {
                         settings.Save(stream);
                     }
                 }
             }
             finally
             {
                 Monitor.Exit(ConfigFileName);
             }
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show("Ошибка при сохранении настроек программы: " + exc.Message, AppSettings.ProductName, MessageBoxButton.OK, MessageBoxImage.Exclamation);
     }
 }
Beispiel #14
0
        private async void Window_Closing(object sender, CancelEventArgs e)
        {
            Hide();

            AppSettings.Set("MainWindow", "GridSplitter", ColumnLocal.ActualWidth);

            AppSettings.SaveGridView("ServerList", ServerList.View);
            AppSettings.SaveGridView("DetailList", DetailList.View);

            this.SaveWidthHeight("MainWindow");
            this.SaveTopLeft("MainWindow");

            if (WindowState == WindowState.Normal)
            {
                AppSettings.Set("MainWindow", "Maximized", false);
            }
            else if (WindowState == WindowState.Maximized)
            {
                AppSettings.Set("MainWindow", "Maximized", true);
            }

            await AppSettings.Save();

            await ClientHelper.DisconnectAsync();
        }
        public AudioSettingsPanel()
        {
            this.Title = "TXT_S_AUDIOSETTINGS";
            InitializeComponent();

            double[] freqws = MediaRenderer.DefaultInstance.EqFrequencies;

            lblCautionRealtime.OverrideForeColor = ThemeManager.HighlightColor;

            cgBalance.Value            = AppSettings.LastBalance + 2000;
            cgBalance.PositionChanged += (b) =>
            {
                AppSettings.LastBalance = (int)cgBalance.Value - 2000;
                MediaRenderer.DefaultInstance.AudioBalance = AppSettings.LastBalance;
                AppSettings.Save();
            };

            cgVolume.Value            = AppSettings.LastVolume;
            cgVolume.PositionChanged += (v) =>
            {
                AppSettings.LastVolume = (int)cgVolume.Value;
                MediaRenderer.DefaultInstance.AudioVolume = AppSettings.LastVolume;
                AppSettings.Save();
            };

            tenBandEqualizer1.EqBandFreqChanged += (b) =>
            {
            };
            tenBandEqualizer1.EqBandLevelChanged += (b) =>
            {
            };
        }
        void Browser_Navigating(object sender, NavigatingEventArgs e)
        {
            if (e.Uri.AbsoluteUri.Contains("http://www.goodreads.com/m/home"))
            {
                RequestToken();
            }

            if (!e.Uri.AbsoluteUri.Contains(_callbackUrl))
            {
                return;
            }

            e.Cancel = true;

            // The browser will show an ugly empty gray navigation failure
            // because we canceled the navigation above.  Hide the browser
            // while we finish authenticating.
            _viewModel.IsBusy      = true;
            _viewModel.BusyMessage = "Authenticating...";
            Browser.Visibility     = Visibility.Collapsed;

            var values = Helpers.ParseQueryString(e.Uri.Query);
            var token  = values["oauth_token"];

            if (token != _requestToken.Token)
            {
                throw new Exception("Tokens don't match");
            }

            string verifier;

            values.TryGetValue("oauth_verifier", out verifier);
            GoodreadsClient.Current.GetAccessToken(
                _requestToken,
                verifier,
                accessToken =>
            {
                // Save settings
                AppSettings.Save(AppSettings.GoodreadsAuth, accessToken);

                // At this point we're fully authenticated.  Authenticate the
                // current client and get the UserId & name while we're at it.
                GoodreadsClient.Current.AuthenticateWith(accessToken.Token, accessToken.TokenSecret);
                GoodreadsClient.Current.AuthenticateUser(
                    user =>
                {
                    // don't navigate away until the Authorized user info has
                    // been set, every other page needs the UserId so we'll just
                    // park here until it's set.
                    Debug.Assert(user.Id != null);
                    NavigationController.Current.NavigateTo(View.Home);
                },
                    error =>
                {
                    //TODO: Better error handling here.
                    MessageBox.Show("Hmm, something has gone horribly wrong");
                });
            });
        }
        private void shutdownButton_Click(object sender, EventArgs e)
        {
            _owner.NotifyIcon.Visible = false;
            _owner.NotifyIcon.Icon    = null;

            Settings.Default.Save();
            AppSettings.Save();
            Environment.Exit(1);
        }
        private void SaveSettings()
        {
            AppSettings.Instance.OpenLastProject = generalOpenLastProject.Checked == true;

            AppSettings.Instance.PreviewModeRunMethod = previewModeRunMethod.SelectedIndex;
            AppSettings.Instance.GameExe    = previewModeRunExecutable.Text;
            AppSettings.Instance.EnableRcon = previewModeEnableRemoteConsole.Checked == true;

            AppSettings.Save();
        }
Beispiel #19
0
        public virtual void WillClose(NSNotification notification)
        {
            GuiPanelWireguardConfigDetails?.Close();

            UnfocusElement(); // update bindings
            __Settings.NetworkActions.Actions = __NetworksViewModel.GetNetworkActionsInUse();
            __Settings.Save();

            __MainViewModel.ApplySettings();
        }
        private bool browseNewFileFolder()
        {
            var res           = System.Windows.Forms.DialogResult.Yes;
            var browser       = new System.Windows.Forms.FolderBrowserDialog();
            var projectFileOK = false;

            while (!projectFileOK && res == System.Windows.Forms.DialogResult.Yes)
            {
                browser.Description = "Specify a folder to store the project file";
                browser.ShowDialog();

                if (!Directory.Exists(browser.SelectedPath) || string.IsNullOrEmpty(browser.SelectedPath))
                {
                    res = System.Windows.Forms.MessageBox.Show("Selected path is invalid, do you want to specify a new one?", "Error", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question);
                    if (res == System.Windows.Forms.DialogResult.No)
                    {
                        return(false);
                    }
                }
                else
                {
                    projectFileOK = true;
                }
            }

            var fileName = browser.SelectedPath + "\\Projects.xml";
            var file     = File.Create(fileName);

            file.Close();

            appSettings.ProjectsXmlPath = fileName;
            appSettings.Save();

            var writer          = new WriteXml();
            var projectDataList = new List <ProjectData>();

            projectDataList.Add(new ProjectData {
                ProjectName = "New Project"
            });
            writer.writeProjectXml(projectDataList);

            return(true);
        }
Beispiel #21
0
        private async void Window_Closed(object sender, System.EventArgs e)
        {
            if ((bool)CheckBoxEnableProxy.IsChecked)
            {
                AppSettings.Set("Proxy", "Server", TextBoxProxyServer.Text);
                AppSettings.Set("Proxy", "Port", TextBoxProxyPort.Text);
            }

            await AppSettings.Save();
        }
Beispiel #22
0
        protected override void OnClosing(CancelEventArgs e)
        {
            e.Cancel = true;

            AppSettings.Put("plugins", Model.Plugins.ToArray());
            AppSettings.Put("theme", App.Current.MainViewModel.Theme);
            AppSettings.Save();

            Hide();
        }
        public static void Restart()
        {
            if (appInstance != null)
            {
                appInstance.DoTerminate();
            }

            AppSettings.Save();
            Application.Restart();
            Process.GetCurrentProcess().Kill();
        }
Beispiel #24
0
        private void removeVariable_Click(object sender, System.EventArgs e)
        {
            if (variables.SelectedIndex < 0)
            {
                return;
            }

            Settings.Variables.RemoveAt(variables.SelectedIndex);

            AppSettings.Save(Settings, _saveFile);
        }
Beispiel #25
0
        private void removeLocation_Click(object sender, System.EventArgs e)
        {
            if (locations.SelectedIndex < 0)
            {
                return;
            }

            Settings.Locations.RemoveAt(locations.SelectedIndex);

            AppSettings.Save(Settings, _saveFile);
        }
        public static void SaveSettings(ColorThemes colorTheme)
        {
#if JSON
            MainSettings            = AppSettings.Load();
            MainSettings.ThemeColor = colorTheme;
            MainSettings.Save();
#endif
#if REGEDIT
            Regedit.SetValue("HKEY_CURRENT_USER\\Software\\Elektrum\\Master\\Continent", "ThemeColor", (int)colorTheme);
#endif
        }
Beispiel #27
0
        public async void SaveSettings()
        {
            string raw = await new StreamReader(HttpContext.Request.Body).ReadToEndAsync();

            JsonConvert.DeserializeObject(raw, typeof(AppSettings), new JsonSerializerSettings()
            {
                ObjectCreationHandling = ObjectCreationHandling.Replace
            });

            AppSettings.Save();
        }
Beispiel #28
0
 private void SaveSettings()
 {
     if (fileAccess != null)
     {
         AppSettings.SetString("PFF_PATH", fileAccess.ConstructionParams);
     }
     AppSettings.SetPoint3D("CAM_POS", camera.Position);
     AppSettings.SetVector3D("CAM_UP", camera.Up);
     AppSettings.SetVector3D("CAM_FORWARD", camera.Forward);
     AppSettings.Save();
 }
Beispiel #29
0
        private async void PushTokenChanged(object sender, EventArgs args)
        {
            var pushToken = PlatformAccess.Current.GetPushToken();

            if (pushToken != null && pushToken != _appSettings.DevicePushToken)
            {
                // If we have a device token, send up the new push token,
                // otherwise it should happen in POST /device.
                if (_appSettings.DeviceToken != null)
                {
                    var result = await this.UpdateDeviceAsync(pushToken);

                    if (result)
                    {
                        _appSettings.DevicePushToken = pushToken;
                        _appSettings.Save();
                    }
                }
            }
        }
Beispiel #30
0
        private void SaveCommandHandler(object sender, ExecutedRoutedEventArgs e)
        {
            AppSettings.Repeat     = comboBoxRepeat.SelectedIndex + 1;
            AppSettings.Wait       = comboBoxWait.SelectedIndex * 5;
            AppSettings.Translator = comboBoxTranslator.SelectedIndex;
            AppSettings.TextZoom   = ((KeyValuePair <int, string>)comboBoxZoom.SelectedValue).Key;

            AppSettings.Save();

            this.Close();
        }
Beispiel #31
0
 private void AdonisWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (appSettings.SaveWindowPosition)
     {
         appSettings.SysInfoWindowLeft   = Left;
         appSettings.SysInfoWindowTop    = Top;
         appSettings.SysInfoWindowHeight = Height;
         appSettings.SysInfoWindowWidth  = Width;
         appSettings.Save();
     }
 }
        public void Then_read_and_write_should_succeed()
        {
            var fileName = Guid.NewGuid() + ".config";
            var fullPathToConfigurationFile = TestHelpers.GetFullPathToConfigurationFile(fileName);

            try
            {
                var settings = new AppSettings(fullPathToConfigurationFile, FileOption.None);
                var mySettings = new TempSettings()
                    {
                        NonEmptyStringValue = "aaa",
                        IntValue = 123,
                        DoubleValue = 123.12d,
                        LocalizedValue = 456.789
                    };

                settings.ReadFrom(mySettings);

                Assert.AreEqual("aaa", settings.GetValue("NonEmptyStringValue"));
                Assert.IsFalse(settings.HasAppSetting("IntValue"));
                Assert.AreEqual(null, settings.GetValue<int?>("EmptyIntValue"));
                Assert.AreEqual(123.12d, settings.GetValue<double>("DoubleValue"));
                Assert.AreEqual(456.789, settings.GetValue<double>("DoubleFinnishLocale", CultureInfo.GetCultureInfo("fi-FI")));
                Assert.AreEqual("456,789", settings.GetValue("DoubleFinnishLocale"));

                settings.Save();

                var otherSettings = new TempSettings();
                settings.WriteInto(otherSettings);

                Assert.AreEqual("aaa", otherSettings.NonEmptyStringValue);
                Assert.AreEqual(0, otherSettings.IntValue);
                Assert.AreEqual(null, otherSettings.NullableIntValue);
                Assert.AreEqual(123.12d, otherSettings.DoubleValue);
                Assert.AreEqual(456.789, otherSettings.LocalizedValue);
            }
            finally
            {
                TestHelpers.DeleteIfExists(fullPathToConfigurationFile);
            }
        }
        public void Then_values_should_be_saved_using_invariant_culture()
        {
            var originalFile = SimpleConfig.AbsolutePathToConfigFile;
            var tempFile = TestHelpers.CreateCopyOfFile(originalFile);

            try
            {
                var settings = new AppSettings(tempFile, FileOption.FileMustExist);
                settings.SetValue<double>("OtherDouble", 1.1);

                settings.Save();

                var otherSettings = new AppSettings(tempFile, FileOption.FileMustExist);
                var value = otherSettings.GetValue<double>("OtherDouble");

                Assert.AreEqual(1.1d, value);
            }
            finally
            {
                TestHelpers.DeleteIfExists(tempFile);
            }
        }
        public void Should_succeed()
        {
            var originalFile = SimpleConfig.AbsolutePathToConfigFile;
            var tempFile = TestHelpers.CreateCopyOfFile(originalFile);

            try
            {
                var settings = new AppSettings(tempFile, FileOption.FileMustExist);

                // Read existing settings
                settings.GetValue(SimpleConfig.NonEmptyStringValue);
                settings.GetValue<int>(SimpleConfig.IntValue);
                settings.GetValue<int?>(SimpleConfig.EmptyIntValue);
                settings.GetValue<double>(SimpleConfig.DoubleValue);

                // Modify settings
                settings.SetValue(SimpleConfig.NonEmptyStringValue, "nonEmptyValue");
                settings.SetValue<int>(SimpleConfig.IntValue, int.MinValue);
                settings.SetValue<int?>(SimpleConfig.EmptyIntValue, 1);
                settings.SetConnectionString("MyDatabase", "db");

                settings.Save();

                var otherSettings = new AppSettings(tempFile, FileOption.FileMustExist);
                var nonEmptyString = otherSettings.GetValue(SimpleConfig.NonEmptyStringValue);
                var intValue = otherSettings.GetValue<int>(SimpleConfig.IntValue);
                var emptyIntValue = otherSettings.GetValue<int?>(SimpleConfig.EmptyIntValue);
                var doubleValue = otherSettings.GetValue<double>(SimpleConfig.DoubleValue);

                Assert.AreEqual("nonEmptyValue", nonEmptyString);
                Assert.AreEqual(int.MinValue, intValue);
                Assert.AreEqual(1, emptyIntValue);
                Assert.AreEqual(1.1d, doubleValue);
            }
            finally
            {
                TestHelpers.DeleteIfExists(tempFile);
            }
        }
Beispiel #35
0
        public static void Main(string[] args)
        {
            try
            {
                // Open the default app.config file which in this case is SimpleExample.exe.config
                // and it is located in the same folder as the SimpleExample.exe.
                settings = AppSettings.CreateForAssembly(Assembly.GetEntryAssembly(), FileOption.FileMustExist);

                // Write all the settings into our own object
                var mySettings = new MyApplicationSettings();
                settings.WriteInto(mySettings);

                mySettings.StringValue = new string(mySettings.StringValue.Reverse().ToArray());

                // Read everything back into settings and save
                settings.ReadFrom(mySettings);
                settings.Save();
            }
            catch (Exception exp)
            {
                Console.Error.WriteLine(exp.Message);
                throw;
            }
        }
Beispiel #36
0
        private void VoiceCommandButton_Click(object sender, EventArgs e)
        {
            TeardownPage();
            AppSettings settings = new AppSettings();

            if (settings.SpeechCommandReminderSetting)
            {
                messageBox = new CustomMessageBox()
                {
                    ContentTemplate = (DataTemplate)this.Resources["PivotContentTemplate"],
                    LeftButtonContent = "Speak",
                    RightButtonContent = "Don't Show",
                    IsFullScreen = true // Pivots should always be full-screen.
                };

                messageBox.Dismissed += (s1, e1) =>
                {
                    switch (e1.Result)
                    {
                        case CustomMessageBoxResult.LeftButton:
                            getCommand();
                            break;
                        case CustomMessageBoxResult.RightButton:
                            AppSettings settingsUpdate = new AppSettings();
                            settingsUpdate.SpeechCommandReminderSetting = false;
                            settingsUpdate.Save();
                            getCommand();
                            break;
                        case CustomMessageBoxResult.None:
                            break;
                        default:
                            break;
                    }
                };

                messageBox.Show();
            }
            else
            {
                getCommand();
            }
        }