public NewSettings GetSettings() { NewSettings x = new NewSettings(); string json = ReadFile(); return(JsonConvert.DeserializeObject <NewSettings>(json)); }
private void SettingsButton_Click(object sender, EventArgs e) { if (newSettings == null || newSettings.IsDisposed) { newSettings = new NewSettings(); } newSettings.Show(); newSettings.Focus(); }
private void settingsToolStripMenuItem_Click(object sender, EventArgs e) { if (newSettings == null || newSettings.IsDisposed) { newSettings = new NewSettings(); } newSettings.Show(); newSettings.Focus(); }
public string SaveSettings(NewSettings settings) { try { string path = "~/App_Data/json"; string filepath = path + "/settings.json"; CreateFolder(path); WriteFile(filepath, JsonConvert.SerializeObject(settings, Formatting.None)); return(JsonConvert.SerializeObject(settings, Formatting.None)); } catch (Exception e) { return(JsonConvert.SerializeObject(e.Message, Formatting.None)); } }
public NewSettings GetSettingsData() { string jsonStr = GetFile("json", "settings"); NewSettings x = new NewSettings(); if (!string.IsNullOrEmpty(jsonStr)) { x = JsonConvert.DeserializeObject <NewSettings>(jsonStr); } else { x.discount = new Prices.Discount(); } return(x); }
public override Result RunIt(ExternalCommandData commandData, ref string message, ElementSet elements) { try { if (App.Instance.SettingsForm == null || App.Instance.SettingsForm.IsDisposed) { NewSettings settingForm = new NewSettings(App.Instance.settings); commandData.Application.Idling += App.Instance.SettingIdlingHandler; App.Instance.SettingsForm = settingForm; } if (!App.Instance.SettingsForm.Visible) { App.Instance.SettingsForm.Show(); } return(Result.Succeeded); } catch (Exception ex) { MessageBox.Show(ex.Message); return(Result.Failed); } }
public static void ApplyNewSettings() { SettingsData = NewSettings.Duplicate(); updated?.Invoke(); }