コード例 #1
0
        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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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;
        }
コード例 #4
0
 private void UpdateCompositions()
 {
     _updatedComposition = SelectedComposition;
     _navigator.NavigateForward <CompositionsEditorViewModel>(this, _updatedComposition);
 }
コード例 #5
0
 private void UpdateCompositions()
 {
     _updatedComposition = SelectedComposition;
     _navigator.NavigateForward<CompositionsEditorViewModel>(this, _updatedComposition);
 }
コード例 #6
0
        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);
        }
コード例 #7
0
        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;
        }