Beispiel #1
0
 private void AddVariable()
 {
     Variables.Add(new EnvironmentVariableViewModel(new GenericEnvironmentVariable {
         Name = GetNewName(), Value = "new value"
     }));
     DirtyService.MarkDirty();
 }
Beispiel #2
0
        private void RemoveVariable()
        {
            if (SelectedVariable.Id != default(int))
            {
                VariablesForDelete.Add(SelectedVariable.Id);
            }

            Variables.Remove(SelectedVariable);
            DirtyService.MarkDirty();
        }
Beispiel #3
0
        private async Task SaveAsync()
        {
            var tasks = new List <Task>();

            // add
            var variablesForAdd = Variables.Where(v => v.Id == default(int)).ToDictionary(v => v.Name, v => v.Value);

            tasks.AddRange(AddVariablesAsync(variablesForAdd));

            // delete
            tasks.AddRange(Client.DeleteEnvironmentVariableAsync(VariablesForDelete));

            // update
            var variablesForUpdate = Variables.Where(v => v.Id != default(int) && v.DirtyService.IsDirty).ToDictionary(v => v.Id, v => v.Value);

            tasks.AddRange(Client.UpdateEnvironmentVariableAsync(variablesForUpdate));

            await Task.WhenAll(tasks);

            DirtyService.MarkClean();
        }
Beispiel #4
0
        public StateMachineDialogWindowViewModel(
            StateMachine stateMachine,
            IViewService viewService,
            IDirtyService parentDirtyService,
            Action <StateMachine> updateParentModel,
            IMessageBoxService messageBoxService
            )
        {
            _viewService        = viewService ?? throw new ArgumentNullException(nameof(viewService));
            _parentDirtyService = parentDirtyService ?? throw new ArgumentNullException(nameof(parentDirtyService));
            _updateParentModel  = updateParentModel;
            _messageBoxService  = messageBoxService ?? throw new ArgumentNullException(nameof(messageBoxService));

            InitiateStateMachineViewModel(stateMachine);

            _undoService = new UndoService <StateMachine>();
            _undoService.Clear(SaveMomento());

            DirtyService.MarkClean();
            InitializeCommands();
        }
Beispiel #5
0
 private void ActionsListChanged(object sender, EventArgs e)
 {
     DirtyService.MarkDirty();
 }