Exemple #1
0
 private void WaterS_Load(object sender, EventArgs e)
 {
     Application_Setting.ApplicationSetting setting = Application_Setting.ApplicationSetting.LoadSetting();
     if (setting != null)
     {
         numericUpDown1.Value = setting.notiStatus.drinkTime;
     }
 }
Exemple #2
0
        public static void SaveSeting(ApplicationSetting setting)
        {
            string data = JsonConvert.SerializeObject(setting);

            if (!Directory.Exists("data"))
            {
                Directory.CreateDirectory("data");
            }

            File.WriteAllText(Application.StartupPath + "/data/setting.json", data);
        }
Exemple #3
0
 private void loadALL()
 {
     works = Time_Management.Work.LoadJson();
     if (works == null)
     {
         works = new List <Time_Management.Work>();
     }
     setting = Application_Setting.ApplicationSetting.LoadSetting();
     if (setting == null)
     {
         setting = new Application_Setting.ApplicationSetting();
     }
 }
Exemple #4
0
        public static ApplicationSetting LoadSetting()
        {
            ApplicationSetting setting = null;

            if (!File.Exists(Application.StartupPath + "/data/setting.json"))
            {
                return(setting);
            }

            string data = File.ReadAllText(Application.StartupPath + "/data/setting.json");

            setting = JsonConvert.DeserializeObject <ApplicationSetting>(data);
            return(setting);
        }
Exemple #5
0
 public SettingApp()
 {
     InitializeComponent();
     setting = Application_Setting.ApplicationSetting.LoadSetting();
     if (setting == null)
     {
         setting = new Application_Setting.ApplicationSetting();
     }
     checkBox1.Checked = setting.notiStatus.BreakE;
     checkBox2.Checked = setting.notiStatus.taskE;
     checkBox3.Checked = setting.notiStatus.drinkE;
     checkBox4.Checked = setting.silenceMode;
     checkBox5.Checked = setting.isAutoStart;
 }
Exemple #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (numericUpDown1.Value > 300)
            {
                MessageBox.Show("Thời gian vượt quá cho phép!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            Application_Setting.ApplicationSetting setting = Application_Setting.ApplicationSetting.LoadSetting();
            if (setting == null)
            {
                setting = new Application_Setting.ApplicationSetting();
            }
            setting.notiStatus.drinkTime = int.Parse(numericUpDown1.Value.ToString());
            Application_Setting.ApplicationSetting.SaveSeting(setting);
            MessageBox.Show("Thiết lập thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }