public ProjectItemViewModel(T model) { Model = model; RemoveItemCommand = ReactiveCommand.Create(); RemoveItemCommand.Subscribe(o => { }); OpenInExplorerCommand = ReactiveCommand.Create(); OpenInExplorerCommand.Subscribe(o => { if (model is IProjectFolder) { Platform.OpenFolderInExplorer((model as IProjectFolder).Location); } else if (model is IProjectItem) { Platform.OpenFolderInExplorer((model as IProjectItem).Parent.Location); } }); textBoxVisibility = false; labelVisibility = true; }
public SourceFileViewModel(ISourceFile model) : base(model) { OpenInExplorerCommand = ReactiveCommand.Create(); OpenInExplorerCommand.Subscribe(o => { Process.Start(Path.GetDirectoryName(model.Location)); }); RemoveCommand = ReactiveCommand.Create(); RemoveCommand.Subscribe(o => { model.Project.ExcludeFile(model); }); }
public SourceFileViewModel(ISourceFile model) : base(model) { OpenInExplorerCommand = ReactiveCommand.Create(); OpenInExplorerCommand.Subscribe(o => { Platform.OpenFolderInExplorer(model.CurrentDirectory); }); RemoveCommand = ReactiveCommand.Create(); RemoveCommand.Subscribe(o => { model.Project.ExcludeFile(model); }); }
public SolutionViewModel(ISolution model) : base(model) { shell = IoC.Get <IShell>(); Projects = new ObservableCollection <ProjectViewModel>(); IsExpanded = true; Projects.BindCollections(model.Projects, p => { return(ProjectViewModel.Create(this, p)); }, (pvm, p) => pvm.Model == p); NewProjectCommand = ReactiveCommand.Create(); NewProjectCommand.Subscribe(o => { shell.ModalDialog = new NewProjectDialogViewModel(model); shell.ModalDialog.ShowDialog(); }); AddExistingProjectCommand = ReactiveCommand.Create(); AddExistingProjectCommand.Subscribe(async o => { var dlg = new OpenFileDialog(); dlg.Title = "Open Project"; var extensions = new List <string>(); foreach (var projectType in shell.ProjectTypes) { extensions.AddRange(projectType.Extensions); } dlg.Filters.Add(new FileDialogFilter { Name = "AvalonStudio Project", Extensions = extensions }); dlg.InitialFileName = string.Empty; dlg.InitialDirectory = Model.CurrentDirectory; dlg.AllowMultiple = false; var result = await dlg.ShowAsync(); if (result != null && result.Length == 1) { var proj = Solution.LoadProjectFile(model, result[0]); if (proj != null) { model.AddProject(proj); model.Save(); } } }); OpenInExplorerCommand = ReactiveCommand.Create(); OpenInExplorerCommand.Subscribe(o => { Platform.OpenFolderInExplorer(model.CurrentDirectory); }); ConfigurationCommand = ReactiveCommand.Create(); ConfigurationCommand.Subscribe(o => { //Workspace.Instance.ModalDialog = new SolutionConfigurationDialogViewModel(Workspace.Instance.SolutionExplorer.Model); //Workspace.Instance.ModalDialog.ShowDialog(); }); BuildSolutionCommand = ReactiveCommand.Create(); BuildSolutionCommand.Subscribe(o => { BuildSolution(); }); CleanSolutionCommand = ReactiveCommand.Create(); CleanSolutionCommand.Subscribe(o => { CleanSolution(); }); RebuildSolutionCommand = ReactiveCommand.Create(); RebuildSolutionCommand.Subscribe(o => { CleanSolution(); BuildSolution(); }); RunAllTestsCommand = ReactiveCommand.Create(); RunAllTestsCommand.Subscribe(o => { RunTests(); }); }
public ProjectViewModel(SolutionViewModel solutionViewModel, IProject model) : base(model) { shell = IoC.Get <IShell>(); Items = new ObservableCollection <ProjectItemViewModel>(); Items.BindCollections(model.Items, p => { return(ProjectItemViewModel.Create(p)); }, (pivm, p) => pivm.Model == p); ConfigureCommand = ReactiveCommand.Create(); ConfigureCommand.Subscribe(o => { if (configuration == null) { configuration = new ProjectConfigurationDialogViewModel(model, () => { configuration = null; }); shell.AddDocument(configuration); } else { shell.SelectedDocument = configuration; } //shell.ModalDialog.ShowDialog(); }); DebugCommand = ReactiveCommand.Create(); DebugCommand.Subscribe(_ => { //shell.Debug(model); }); BuildCommand = ReactiveCommand.Create(); BuildCommand.Subscribe(o => { shell.Build(model); }); CleanCommand = ReactiveCommand.Create(); CleanCommand.Subscribe(o => { shell.Clean(model); }); ManageReferencesCommand = ReactiveCommand.Create(); ManageReferencesCommand.Subscribe(o => { }); SetProjectCommand = ReactiveCommand.Create(); SetProjectCommand.Subscribe(o => { model.Solution.StartupProject = model; model.Solution.Save(); shell.InvalidateCodeAnalysis(); foreach (var project in solutionViewModel.Projects) { project.Invalidate(); } }); OpenInExplorerCommand = ReactiveCommand.Create(); OpenInExplorerCommand.Subscribe(o => { Process.Start(Model.CurrentDirectory); }); NewItemCommand = ReactiveCommand.Create(); NewItemCommand.Subscribe(_ => { shell.ModalDialog = new NewItemDialogViewModel(model); shell.ModalDialog.ShowDialog(); }); RemoveCommand = ReactiveCommand.Create(); RemoveCommand.Subscribe(async o => { await shell.CloseDocumentsForProjectAsync(Model); Model.Solution.RemoveProject(Model); Model.Solution.Save(); }); }