예제 #1
0
        public void Execute(object parameter)
        {
            using (var dialog = new CommonOpenFileDialog())
            {
                dialog.InitialDirectory = "C:\\";
                dialog.IsFolderPicker   = true;

                if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
                {
                    string path = dialog.FileName;
                    string name = path.Split('\\').Last();
                    _service.AddResourceDirectory(new Domain.Models.ResourceDirectory()
                    {
                        Name         = name,
                        Path         = path,
                        LastAccessed = DateTime.Now
                    });

                    _viewModel.RefreshView();
                }
            }
        }
예제 #2
0
        public void Execute(object parameter)
        {
            if (parameter is string && (string)parameter != string.Empty)
            {
                string path = parameter as string;

                // Get file information
                FileInfo file = new FileInfo(path);

                // Is workspace item
                if (file.Extension != string.Empty)
                {
                    _workspaceService.AddItem(new WorkspaceItem()
                    {
                        WorkspaceId    = _workspace.WorkspaceId,
                        Name           = Path.GetFileNameWithoutExtension(path),
                        Extension      = file.Extension,
                        PathToOriginal = file.FullName,
                        LastAccessed   = DateTime.Now
                    });
                    new DialogWindow("Datei gespeichert!", file.FullName).ShowDialog();
                }
                // Is resource directory
                else
                {
                    _resourceDirectoryService.AddResourceDirectory(new ResourceDirectory()
                    {
                        Name         = file.Name,
                        Path         = file.FullName,
                        LastAccessed = DateTime.Now
                    });
                    new DialogWindow("Ressource gespeichert!", file.Name).ShowDialog();
                }

                _viewModel.RefreshView();
            }
        }