コード例 #1
0
ファイル: Settings.cs プロジェクト: igprog/kup
    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();
 }