Esempio n. 1
0
        public void EndEdit()
        {
            if (!_editing)
            {
                return;
            }

            _editing    = false;
            _backupData = null;
        }
Esempio n. 2
0
        public void BeginEdit()
        {
            if (_editing)
            {
                return;
            }

            _editing    = true;
            _backupData = MemberwiseClone() as KeyValueViewModel;
        }
Esempio n. 3
0
        //private void AppSettingCreatedHandler(AppSettingsCreatedEventArgs e)
        //{
        //    var config = Configuration.Load();

        //    var newSetting = config.ProfileConfigurations[e.ConfigurationName].AppSettings[e.Key];

        //    ProfileConfigsInternal.First(x => x.Name == e.ConfigurationName).AppSettings.Add(new KeyValueViewModel{ Key = e.Key, Value = e.Value, IsSelected = true});
        //}

        public bool DeleteAppSetting(KeyValueViewModel vm)
        {
            if (MessageBox.Show("Are you sure you want to delete this setting?", "Confirm Delete", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
            {
                return(false);
            }

            ConfigurationManager.DeleteAppSetting(SelectedConfig.Name, vm.Key);

            SelectedConfig.AppSettings.Remove(vm);

            return(true);
        }
Esempio n. 4
0
        public bool EditAppSetting(KeyValueViewModel vm)
        {
            if (!string.IsNullOrWhiteSpace(vm.Error))
            {
                vm.CancelEdit();
                return(false);
            }

            vm.EndEdit();

            ConfigurationManager.SaveAppSetting(SelectedConfig.Name, new AppSetting {
                Name = vm.Key, Value = vm.Value
            });

            return(true);
        }
        public bool EditAppSetting(KeyValueViewModel vm)
        {
            if (!string.IsNullOrWhiteSpace(vm.Error))
            {
                vm.CancelEdit();
                return false;
            }

            vm.EndEdit();

            ConfigurationManager.SaveAppSetting(SelectedConfig.Name, new AppSetting { Name = vm.Key, Value = vm.Value });

            return true;
        }
        //private void AppSettingCreatedHandler(AppSettingsCreatedEventArgs e)
        //{
        //    var config = Configuration.Load();
        //    var newSetting = config.ProfileConfigurations[e.ConfigurationName].AppSettings[e.Key];
        //    ProfileConfigsInternal.First(x => x.Name == e.ConfigurationName).AppSettings.Add(new KeyValueViewModel{ Key = e.Key, Value = e.Value, IsSelected = true});
        //}
        public bool DeleteAppSetting(KeyValueViewModel vm)
        {
            if (MessageBox.Show("Are you sure you want to delete this setting?", "Confirm Delete", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
                return false;

            ConfigurationManager.DeleteAppSetting(SelectedConfig.Name, vm.Key);

            SelectedConfig.AppSettings.Remove(vm);

            return true;
        }
        public void BeginEdit()
        {
            if (_editing) return;

            _editing = true;
            _backupData = MemberwiseClone() as KeyValueViewModel;
        }
        public void EndEdit()
        {
            if (!_editing) return;

            _editing = false;
            _backupData = null;
        }