Esempio n. 1
0
        public void RenameConfigFile(string oldName, string newName)
        {
            var oldPath = MakeCurrentConfigFilePath(oldName);
            var newPath = MakeCurrentConfigFilePath(newName);

            if (File.Exists(oldPath))
            {
                File.Move(oldPath, newPath);
            }
            var index = SettingsList.IndexOf(oldName);

            SettingsList.Insert(index, newName);
            SettingsList.Remove(oldName);
        }
 /// UpdateSettings (command) - Jacob Monger
 /// <summary>
 /// if valid updates setting
 /// </summary>
 /// <param name="message"> user input</param>
 public void UpdateSettings(object message)
 {
     if (SelectedSettingsIndex != -1)
     {
         if (double.TryParse(message.ToString(), out double newValue))
         {
             String SettingsName = SettingsList[SelectedSettingsIndex].SettingsName;
             Properties.Settings.Default[SettingsName] = newValue;
             Properties.Settings.Default.Save();
             SettingsList.Remove(SettingsList[SelectedSettingsIndex]);
             SettingsList.Insert(SelectedSettingsIndex, new SettingsListItemModel(SettingsName));
         }
     }
 }