public ModelSetupWizardOptionsViewModel() { Worksets = new BindableCollection <WorksetParameter>(); SelectedWorksets = new List <WorksetParameter>(); ProjectInformationReplacements = new BindableCollection <ProjectInformationReplacement>(); NominatedArchitects = new BindableCollection <NominatedArchitect>(); ColourSchemes = new BindableCollection <ColourScheme>(); var loadSystemConfig = ModelSetupWizardSettings.Default.LoadSystemConfigOnStartup; if (loadSystemConfig) { systemConfigFilePath = ModelSetupWizardSettings.Default.SystemConfigFilePath; if (!string.IsNullOrEmpty(systemConfigFilePath)) { if (System.IO.File.Exists(systemConfigFilePath)) { SettingsIO.Import(systemConfigFilePath); ModelSetupWizardSettings.Default.SystemConfigFilePath = systemConfigFilePath; ModelSetupWizardSettings.Default.LoadSystemConfigOnStartup = true; ModelSetupWizardSettings.Default.Save(); } else { SCaddinsApp.WindowManager.ShowWarningMessageBox( "File Not Found", string.Format(System.Globalization.CultureInfo.InvariantCulture, "Config file: {0} not found", systemConfigFilePath)); } } } Init(); }
private void On_CheckedChanged(object sender, EventArgs e) { PetBattleEasy.On = On.Checked; Logging.Write("On_CheckedChanged {0}", On.Checked); SettingsIO.Save(); }
public PersistentSettings(object settings, string keyName) { Settings = settings; KeyName = keyName; SaveSettings = new SaveSettingsToRegistry(KeyName); LoadSettings = new LoadSettingsFromRegistry(KeyName); }
//public void SaveKnownServers() //{ // var sh = new SettingsIO(); // sh.SaveKnownServers(_knownServers); //} public void LoadRecentProjects() { var sh = new SettingsIO(); IList <Sql8rProjectFile> recentProjects = sh.LoadRecentProjects(); for (int i = 0; i < recentProjects.Count; i++) { Sql8rProjectFile project = recentProjects[i]; var pmt = (PopupMenuTool)_view.tbManager.Ribbon.ApplicationMenu.ToolAreaLeft.Tools["pmtRecent"]; var bt = new ButtonTool(project.Path); if (!_view.tbManager.Tools.Exists(bt.Key)) { bt.Tag = project.Path; bt.SharedProps.Caption = project.Name; bt.SharedProps.ToolTipText = project.Path; bt.SharedProps.AppearancesSmall.Appearance.Image = 1; _view.tbManager.Tools.Add(bt); int recentId = pmt.Tools.Add(bt); pmt.Tools[recentId].Tag = bt.Tag; AddKnownServer(project); } } }
public void ImportConfig() { var result = SCaddinsApp.WindowManager.ShowOpenFileDialog(string.Empty, out var filePath); if (!result.HasValue || !result.Value || !System.IO.File.Exists(filePath)) { return; } SettingsIO.Import(filePath); Reset(); }
public void LoadKnownServers() { var sh = new SettingsIO(); IList <ServerConnectionSettings> knownServers = sh.LoadKnownServers(); removeKnownServers(); for (int i = 0; i < knownServers.Count; i++) { ServerConnectionSettings settings = knownServers[i]; AddKnownServer(settings, false); } }
public void SelectSytemConfigFile() { string filePath = string.Empty; bool? result = SCaddinsApp.WindowManager.ShowOpenFileDialog(string.Empty, out filePath); if (result.HasValue && result.Value && System.IO.File.Exists(filePath)) { SettingsIO.Import(filePath); Reset(); } SystemConfigFilePath = filePath; }
public frmMetrolinkHost() { //set frmMetroLinkHost scale factor to account for DPI scaling =====PROBLEM===== //AutoScaleWidthMult = (0 + CurrentAutoScaleDimensions.Width) / 96; //AutoScaleHeightMult = (0 + CurrentAutoScaleDimensions.Height) / 96; SettingsIO.XMLReadElements(); //SettingsIO.FinalizeIO(); InitializeComponent(); RebuildForm(); CreateWPFHost(); }
private void updateRecentProject(string filePath) { string fileName = Path.GetFileName(filePath); var proj = new Sql8rProjectFile(fileName, filePath); var io = new SettingsIO(); IList <Sql8rProjectFile> projs = io.LoadRecentProjects(); if (!projs.Contains(proj)) { projs.Add(proj); io.SaveRecentProjects(projs); } }
//public XElement ParsedXml { get; set; } public MainViewModel() { this.Settings = SettingsIO.LoadSettings<Settings>(); this.HighlightingManager = new SyntaxHighlightingManager(this.Settings); this.ApplicationThemeManager = new ApplicationThemeManager(this.Settings); this.Editor = new EditorViewModel(this.Settings); this.XmlUtility = new XmlUtilityViewModel(this.Settings); this.ToggleEditorModeCommand = new RelayCommand(ToggleEditorModeCommand_Execute); this.MessengerInstance.Register<ApplicationClosingMessage>(this, HandleApplicationClosingMessage); this.MessengerInstance.Register<DisplayApplicationStatusMessage>(this, HandleDisplayApplicationStatusMessage); this.MessengerInstance.Register<DisplayToolInformationMessage>(this, HandleDisplayToolInformationMessage); this.MessengerInstance.Register<DocumentRefreshCompleted>(this, HandleDocumentRefreshCompletedMessage); }
private bool SettingsFile_Save() { bool result = false; try { SettingsIO.Save(settings, File_Path_Settings); result = true; } catch (Exception e) { System.Console.WriteLine("Exception: {0} \nFile Save Error", e.Message); } return(result); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { this._gameSettings = SettingsIO.LoadGameSettings(); this._spriteBatch = new SpriteBatch(GraphicsDevice); this._debugText = Content.Load <SpriteFont>(Constants.Fonts.TelegramaSmall); this.IsMouseVisible = false; this.Window.IsBorderless = _gameSettings.Borderless; this.Window.AllowUserResizing = false; this._currentState = new TitleState(Content); this._graphics.PreferredBackBufferWidth = (int)_gameSettings.Resolution.X; this._graphics.PreferredBackBufferHeight = (int)_gameSettings.Resolution.Y; this.IsFixedTimeStep = this._gameSettings.Vsync; this._graphics.SynchronizeWithVerticalRetrace = this._gameSettings.Vsync; this._graphics.ApplyChanges(); this._camera = new Camera(GraphicsDevice.Viewport, GraphicsDevice.Viewport.Bounds.Center.ToVector2(), 0f, 1f); }
private void ApplySettings(object settings, SettingsIO settingsIO) { if (settingsIO.Begin()) { Type classType = settings.GetType(); PropertyInfo[] fi = classType.GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo info in fi) { object[] customAttributes = info.GetCustomAttributes(typeof(UserScopedSettingAttribute), false); if (customAttributes.Length > 0) { settingsIO.Process(settings, info); } } settingsIO.End(); } }
private bool SettingsFile_Load() { bool result = false; try { SettingsDictionary settingsDict = SettingsIO.Load(File_Path_Settings); if (settingsDict != null) { settings = settingsDict; result = true; } } catch (Exception e) { System.Console.WriteLine("Exception: {0} \nFile Load Error", e.Message); } return(result); }
private void Slot3Swap_CheckedChanged(object sender, EventArgs e) { PetBattleEasy.Slot3Swap = Slot3Swap.Checked; Logging.Write("Slo3Swap.Checked; {0}", Slot3Swap.Checked); SettingsIO.Save(); }
private void HandleApplicationClosingMessage(ApplicationClosingMessage message) { SettingsIO.SaveSettings(this.Settings); }
public PersistentSettings(object settings, string keyName) { Settings = settings; KeyName = keyName; SaveSettings = new SaveSettingsToRegistry(KeyName); LoadSettings = new LoadSettingsFromRegistry(KeyName); }
private void ApplySettings(object settings, SettingsIO settingsIO) { if(settingsIO.Begin()) { Type classType = settings.GetType(); PropertyInfo[] fi = classType.GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (PropertyInfo info in fi) { object[] customAttributes = info.GetCustomAttributes(typeof(UserScopedSettingAttribute), false); if (customAttributes.Length > 0) { settingsIO.Process(settings, info); } } settingsIO.End(); } }
public void ExportConfig() { Apply(); SCaddinsApp.WindowManager.ShowSaveFileDialog(@"config.xml", "*.xml", "XML |*.xml", out var filePath); SettingsIO.Export(filePath); }
private void Nonstop_CheckedChanged(object sender, EventArgs e) { PetBattleEasy.Nonstop = Nonstop.Checked; Logging.Write("Nonstop_CheckedChanged {0}", Nonstop.Checked); SettingsIO.Save(); }
internal static void CustomClass_OnLoad() { SettingsIO.Load(); }
private void OK_Click(object sender, EventArgs e) { SettingsIO.Save(); Visible = false; }
private void Solo_CheckedChanged(object sender, EventArgs e) { PetBattleEasy.Solo = Solo.Checked; Logging.Write("Solo.Checked; {0}", Solo.Checked); SettingsIO.Save(); }
private void Slot1SwapLevel_ValueChanged(object sender, EventArgs e) { PetBattleEasy.Slot1SwapLevel = (int)Slot1SwapLevel.Value; Logging.Write("Slot1SwapLevel; {0}", Slot1SwapLevel.Value); SettingsIO.Save(); }
private void NameReg_Change(object sender, EventArgs e) { PetBattleEasy.NameReg = NameReg.Text; Logging.Write("NameReg; {0}", NameReg.Text); SettingsIO.Save(); }
public IState UpdateState(ref GameSettings gameSettings, GameTime gameTime, Camera camera, KeyboardState currentKey, KeyboardState prevKey, MouseState currentMouse, MouseState prevMouse) { if (currentKey.IsKeyDown(Keys.Escape) && prevKey.IsKeyUp(Keys.Escape)) { return(this._prevState); } if (currentKey.IsKeyDown(Keys.Up) && prevKey.IsKeyUp(Keys.Up)) { _selectedOption -= 1; if (_selectedOption < 0) { _selectedOption = Enum.GetNames(typeof(Options)).Length - 1; } if (_selectedOption > Enum.GetNames(typeof(Options)).Length - 1) { _selectedOption = 0; } } if (currentKey.IsKeyDown(Keys.Down) && prevKey.IsKeyUp(Keys.Down)) { _selectedOption += 1; if (_selectedOption < 0) { _selectedOption = Enum.GetNames(typeof(Options)).Length - 1; } if (_selectedOption > Enum.GetNames(typeof(Options)).Length - 1) { _selectedOption = 0; } } if (currentKey.IsKeyDown(Keys.Left) && prevKey.IsKeyUp(Keys.Left) && _optionItems[_selectedOption].OptionsCollection != null) { _optionItems[_selectedOption].Selection -= 1; if (_optionItems[_selectedOption].Selection < 0) { _optionItems[_selectedOption].Selection = _optionItems[_selectedOption].OptionsCollection.Count - 1; } if (_optionItems[_selectedOption].Selection >= _optionItems[_selectedOption].OptionsCollection.Count) { _optionItems[_selectedOption].Selection = 0; } } if (currentKey.IsKeyDown(Keys.Right) && prevKey.IsKeyUp(Keys.Right) && _optionItems[_selectedOption].OptionsCollection != null) { _optionItems[_selectedOption].Selection += 1; if (_optionItems[_selectedOption].Selection < 0) { _optionItems[_selectedOption].Selection = _optionItems[_selectedOption].OptionsCollection.Count - 1; } if (_optionItems[_selectedOption].Selection >= _optionItems[_selectedOption].OptionsCollection.Count) { _optionItems[_selectedOption].Selection = 0; } } if (currentKey.IsKeyDown(Keys.Enter) && prevKey.IsKeyUp(Keys.Enter)) { switch (_selectedOption) { case (int)Options.ACCEPT_CHANGES: this._gameSettings.Resolution = (Vector2)_optionItems[(int)Options.RESOLUTION].OptionsCollection[_optionItems[(int)Options.RESOLUTION].Selection]; this._gameSettings.Borderless = (bool)_optionItems[(int)Options.BORDERLESS_WINDOW].OptionsCollection[_optionItems[(int)Options.BORDERLESS_WINDOW].Selection]; this._gameSettings.Vsync = (bool)_optionItems[(int)Options.VSYNC].OptionsCollection[_optionItems[(int)Options.VSYNC].Selection]; SettingsIO.SaveGameSettings(ref this._gameSettings); return(this._prevState); case (int)Options.DEFAULT_SETTINGS: SettingsIO.ResetGameSettings(); gameSettings = SettingsIO.LoadGameSettings(); return(new SettingsState(ref gameSettings, this._content, this._prevState)); case (int)Options.CANCEL: return(this._prevState); } } return(this); }
private void checkBox4_CheckedChanged(object sender, EventArgs e) { PetBattleEasy.LeaveGame = LeaveGame.Checked; Logging.Write("LeaveGame {0}", LeaveGame.Checked); SettingsIO.Save(); }
private void ImpruvedLogic_CheckedChanged(object sender, EventArgs e) { PetBattleEasy.ImpruvedLogic = ImpruvedLogic.Checked; SettingsIO.Save(); }
public void SaveKnownServers() { var sh = new SettingsIO(); sh.SaveKnownServers(_knownServers); }