private void btn_Set_Click(object sender, EventArgs e)
        {
            RealTimeBackupModel realTimeModel = new RealTimeBackupModel();

            realTimeModel.BackupInterval = int.Parse(txtBox_Interval.Text);
            realTimeModel.TimeType       = cmbBox_Interval.SelectedItem.ToString();

            Persistence persistence = new Persistence();

            persistence.SaveRealTimeInfo(realTimeModel);

            this.Close();
        }
Exemple #2
0
        public void SaveRealTimeInfo(RealTimeBackupModel realTimeBackupModel)
        {
            CheckIfJsonFileExist();

            var jsonText = File.ReadAllText(_persistancePath);
            var request  = JsonConvert.DeserializeObject <JsonRequestModel>(jsonText);

            if (request == null)
            {
                request = new JsonRequestModel();
            }

            request.RealTimeBackupModel = realTimeBackupModel;
            var json = JsonConvert.SerializeObject(request);

            File.WriteAllText(_persistancePath, json);
        }