public CompositionsEditorViewModel( IViewModelNavigator navigator, IDialogService dialogService, CheckableCompositionViewModel compositionViewModel ) { _navigator = navigator; _dialogService = dialogService; _originalObject = compositionViewModel; Composition = _originalObject.Copy(); _canRemoveBackground = Composition.Background != null; _canRemoveOverlay = Composition.Overlay != null; }
private void AddComposition() { var viewModel = new ObjectNameViewModel("Введите имя композиции"); bool result = _dialogService.ShowResultDialog(viewModel); if (!result) { return; } string name = viewModel.Name; _updatedComposition = CheckableCompositionViewModel.CreateEmpty(name, SelectedTemplate); _navigator.NavigateForward <CompositionsEditorViewModel>(this, _updatedComposition); }
public override void Initialize() { if (!_dataLoaded) { IsBusyLoading = true; var compositionsTask = Task.Factory.StartNew(() => _providerFactory.CompositionsProvider.GetCompositionsAsync().Result) .ContinueWith(t => t.Result.Select(x => x.ToCheckable()).CopyTo(Compositions), TaskScheduler.FromCurrentSynchronizationContext()); var templatesTask = Task.Factory.StartNew(() => _providerFactory.TemplateProvider.GetTemplatesAsync().Result) .ContinueWith(t => { t.Result.CopyTo(Templates); }, TaskScheduler.FromCurrentSynchronizationContext()); Task.WhenAll(compositionsTask, templatesTask) .ContinueWith(result => { IsBusyLoading = false; _dataLoaded = true; }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()); } if (_updatedComposition == null || _updatedComposition.State == ItemState.Unchanged) { return; } if (!Compositions.Contains(_updatedComposition)) { Compositions.Add(_updatedComposition); } CheckItem(); _updatedComposition = null; }
private void UpdateCompositions() { _updatedComposition = SelectedComposition; _navigator.NavigateForward <CompositionsEditorViewModel>(this, _updatedComposition); }
private void UpdateCompositions() { _updatedComposition = SelectedComposition; _navigator.NavigateForward<CompositionsEditorViewModel>(this, _updatedComposition); }
private void AddComposition() { var viewModel = new ObjectNameViewModel("Введите имя композиции"); bool result = _dialogService.ShowResultDialog(viewModel); if (!result) return; string name = viewModel.Name; _updatedComposition = CheckableCompositionViewModel.CreateEmpty(name, SelectedTemplate); _navigator.NavigateForward<CompositionsEditorViewModel>(this, _updatedComposition); }
public override void Initialize() { if (!_dataLoaded) { IsBusyLoading = true; var compositionsTask = Task.Factory.StartNew(() => _providerFactory.CompositionsProvider.GetCompositionsAsync().Result) .ContinueWith(t => t.Result.Select(x => x.ToCheckable()).CopyTo(Compositions), TaskScheduler.FromCurrentSynchronizationContext()); var templatesTask = Task.Factory.StartNew(() => _providerFactory.TemplateProvider.GetTemplatesAsync().Result) .ContinueWith(t => { t.Result.CopyTo(Templates); }, TaskScheduler.FromCurrentSynchronizationContext()); Task.WhenAll(compositionsTask, templatesTask) .ContinueWith(result => { IsBusyLoading = false; _dataLoaded = true; }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()); } if (_updatedComposition == null || _updatedComposition.State == ItemState.Unchanged) { return; } if (!Compositions.Contains(_updatedComposition)) Compositions.Add(_updatedComposition); CheckItem(); _updatedComposition = null; }