public TemplateEditorViewModel(
            IViewModelNavigator navigator,
            IDialogService dialogService,
            ImageLoadService imageLoadService,
            CheckableTemplateViewModel template)
        {
            OverlayOpacity = 1.0;

            _navigator        = navigator;
            _dialogService    = dialogService;
            _imageLoadService = imageLoadService;
            _originalObject   = template;
            Template          = _originalObject.Copy();

            Init();
        }
        private void AddTemplate()
        {
            var  viewModel = new ObjectNameViewModel("Введите имя шаблона");
            bool result    = _dialogService.ShowResultDialog(viewModel);

            if (!result)
            {
                return;
            }

            string name = viewModel.Name;

            _updatedTemplate = new CheckableTemplateViewModel(name, 500, 500, 0,
                                                              Enumerable.Empty <TemplateImageViewModel>(),
                                                              TemplateEditorViewModel.CreateDefaultBackground(), null, false);

            _updatedTemplate.IsDefaultBackground = true;
            _navigator.NavigateForward <TemplateEditorViewModel>(this, _updatedTemplate);
        }
 private void UpdateTemplate()
 {
     _updatedTemplate = SelectedTemplate;
     _navigator.NavigateForward<TemplateEditorViewModel>(this, _updatedTemplate);
 }
        private void AddTemplate()
        {
            var viewModel = new ObjectNameViewModel("Введите имя шаблона");
            bool result = _dialogService.ShowResultDialog(viewModel);
            if (!result)
                return;

            string name = viewModel.Name;

            _updatedTemplate = new CheckableTemplateViewModel(name, 500, 500, 0,
                Enumerable.Empty<TemplateImageViewModel>(),
                TemplateEditorViewModel.CreateDefaultBackground(), null, false);

            _updatedTemplate.IsDefaultBackground = true;
            _navigator.NavigateForward<TemplateEditorViewModel>(this, _updatedTemplate);
        }
        public override void Initialize()
        {
            if (!_dataLoaded)
            {
                IsBusyLoading = true;

                Task.Factory.StartNew(() => _viewModelProvider.GetTemplatesAsync().Result)
                .ContinueWith(t =>
                {
                    t.Result.Select(x => x.ToCheckable()).CopyTo(Children);
                    IsBusyLoading = false;
                    _dataLoaded = true;
                },
                TaskScheduler.FromCurrentSynchronizationContext());
            }

            if (_updatedTemplate == null || _updatedTemplate.State == ItemState.Unchanged)
            {
                return;
            }

            if (!Children.Contains(_updatedTemplate))
                Children.Add(_updatedTemplate);

            CheckItem();
            _updatedTemplate = null;
        }
        public TemplateEditorViewModel(
            IViewModelNavigator navigator, 
            IDialogService dialogService, 
            ImageLoadService imageLoadService,
            CheckableTemplateViewModel template)
        {
            OverlayOpacity = 1.0;

            _navigator = navigator;
            _dialogService = dialogService;
            _imageLoadService = imageLoadService;
            _originalObject = template;
            Template = _originalObject.Copy();

            Init();
        }