Beispiel #1
0
        public void Execute(object parameter)
        {
            var vm = parameter as ProjectItemViewModel;

            var item = _manuscriptService.GetCategoryById(vm.CtgId).GetItemById(vm.Id);

            var source = _windowsDialogService.ShowOpenFileDialog(TypeWriter.Windows.Services.ItemFilterKey.ImageFiles);

            if (File.Exists(source))
            {
                var id = item.References.Count == 0 ? 0 : item.References[item.References.Count - 1].Id + 1;

                item.AddReference(new ManuscriptItemReference(id, item.Id, source));
            }
        }
        public void Execute(object parameter)
        {
            var vm = parameter as ProjectCategoryViewModel;

            var ctg = _manuscriptService.GetCategoryById(vm.Id);

            var source = _windowsDialogService.ShowOpenFileDialog(TypeWriter.Windows.Services.ItemFilterKey.TextFiles);

            if (File.Exists(source))
            {
                var item = new ManuscriptItem(ctg.Items.Count == 0 ? 0 : ctg.Items.Count + 1, ctg.Id, ctg.ProjectId, Path.GetFileNameWithoutExtension(source), source);

                ctg.AddItem(item);
            }
        }
Beispiel #3
0
        public void Execute(object parameter)
        {
            if (parameter != null)
            {
                var res = _windowsDialogService.ShowConfirmationDialog("Save Current", "Confirmation");

                var proj = parameter as ManuscriptProjectViewModel;

                switch (res)
                {
                case true:
                    var source = _windowsDialogService.ShowSaveFileDialog(TypeWriter.Windows.Services.ItemFilterKey.ProjectFiles);
                    _manuscriptService.SaveToFile(source, proj.ToManuscriptProject(source));
                    break;

                case null:
                    return;

                default:
                    break;
                }
            }

            try
            {
                var source = _windowsDialogService.ShowOpenFileDialog(TypeWriter.Windows.Services.ItemFilterKey.ProjectFiles);

                var project = _manuscriptService.GetFromFile(source);

                _eventAggregator.GetEvent <CurrentProjectChanged>().Publish(project);
            }
            catch (Exception e)
            {
                _windowsDialogService.ShowErrorMessageDialog(e.Message, e.Source);
            }
        }