private void Reset()
        {
            Setting.PropertyChanged -= Setting_PropertyChanged;
            Setting = originalSetting.DeepClone();
            Setting.PropertyChanged += Setting_PropertyChanged;

            IsDirty = false;
        }
Esempio n. 2
0
        public void UpdateSetting(ApplicationSetting setting)
        {
            Setting = setting.DeepClone();

            if (OnSettingUpdated == null)
            {
                OnSettingUpdated += () => { }
            }
            ;

            OnSettingUpdated();
        }
        public DiffExtractionSettingWindowViewModel()
        {
            originalSetting = App.Instance.Setting;
            Setting         = originalSetting.DeepClone();

            CanRemoveAlternationColor = Setting.AlternatingColorStrings.Count > 1;

            Setting.PropertyChanged += Setting_PropertyChanged;

            DoneCommand  = new DelegateCommand <Window>(Done);
            ResetCommand = new DelegateCommand(Reset);
            ApplyCommand = new DelegateCommand(Apply);

            EditAlternationColorCommand   = new DelegateCommand <object>(EditAlternationColor);
            RemoveAlternationColorCommand = new DelegateCommand <int?>(RemoveAlternationColor);
            AddAlternationColorCommand    = new DelegateCommand <Color?>(AddAlternationColor);
        }
Esempio n. 4
0
        public static void WriteAppSetting(ApplicationSetting appSetting)
        {
            appSetting.ProjectId = ThisApp.Project.Id;
            List <ApplicationSetting> lstSetting = GetListSetting();

            if (lstSetting == null)
            {
                lstSetting = new List <ApplicationSetting>();
            }
            ApplicationSetting exist = lstSetting.FirstOrDefault(p => p.ProjectId == ThisApp.Project.Id);

            if (exist != null)
            {
                lstSetting.Remove(exist);
                exist = appSetting.DeepClone();
                lstSetting.Add(exist);
            }
            else
            {
                lstSetting.Add(appSetting);
            }
            WriteToFileInAppData(AppSettingFile, ConvertAppSettingToJson(lstSetting));
        }