Exemplo n.º 1
0
        private void SetupFields()
        {
            SourceModel editableSource = _source;

            SourceKind   = editableSource?.SourceKind ?? SourceKind.Книга;
            Title        = editableSource?.Title ?? string.Empty;
            Author       = editableSource?.Author ?? "Неизвестен";
            CreationYear = editableSource?.CreationYear ?? 0;
        }
Exemplo n.º 2
0
        private async Task AddSource()
        {
            var source = new SourceModel(SourceKind, Title, Author, CreationYear);

            source = await _sourcesManager.AddSource(source);

            await _sourcesManager.UpdateSource(source);

            _customNavigationService.NavigateTo(PageKeys.SourceAddArchitecture, source);
        }
Exemplo n.º 3
0
        public SourceAddViewModel(ISourcesManager sourcesManager, IArchitecturesManager architecturesManager)
        {
            _sourcesManager       = sourcesManager;
            _architecturesManager = architecturesManager;

            _customNavigationService = ServiceLocator.Current.GetInstance <ICustomNavigationService>("SourceInternal");

            _source = _customNavigationService.CurrentPageParams as SourceModel;

            SaveCommand = _source == null
             ? new RelayCommand(async() => await AddSource())
             : new RelayCommand(async() => await UpdateSource());

            ActionText = _source == null ? "Добавление" : "Редактирование";
            ButtonText = _source == null ? "Добавить" : "Сохранить изменения";

            InitData();
            SetupFields();
        }
        public SourceAddArchitectureViewModel(ISourcesManager sourcesManager, IArchitecturesManager architecturesManager,
                                              IArchitectureSourceManager architectureSourceManager)
        {
            _sourcesManager            = sourcesManager;
            _architecturesManager      = architecturesManager;
            _architectureSourceManager = architectureSourceManager;

            _customNavigationService = ServiceLocator.Current.GetInstance <ICustomNavigationService>("SourceInternal");

            _source = _customNavigationService.CurrentPageParams as SourceModel;

            _architectures = new ObservableCollection <ArchitectureModel>(
                _architecturesManager.GetArchitecturesListBySourceId(_source.Id));

            SaveCommand = new RelayCommand(async() => await AddSourceArchitecture());

            ActionText = "Добавление сооружения";
            ButtonText = "Добавить";

            InitData();
        }