Пример #1
0
    public NewSettings GetSettings()
    {
        NewSettings x    = new NewSettings();
        string      json = ReadFile();

        return(JsonConvert.DeserializeObject <NewSettings>(json));
    }
Пример #2
0
 private void SettingsButton_Click(object sender, EventArgs e)
 {
     if (newSettings == null || newSettings.IsDisposed)
     {
         newSettings = new NewSettings();
     }
     newSettings.Show();
     newSettings.Focus();
 }
Пример #3
0
 private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (newSettings == null || newSettings.IsDisposed)
     {
         newSettings = new NewSettings();
     }
     newSettings.Show();
     newSettings.Focus();
 }
Пример #4
0
 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));
     }
 }
Пример #5
0
    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);
    }
Пример #6
0
        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);
            }
        }
Пример #7
0
 public static void ApplyNewSettings()
 {
     SettingsData = NewSettings.Duplicate();
     updated?.Invoke();
 }