Exemplo n.º 1
0
        private async Tasks.Task InstantiateBuildCommandsAsync()
        {
            await RebuildProjectCommand.InstantiateAsync(this);

            await RebuildSolutionCommand.InstantiateAsync(this);

            await CancelBuildCommand.InstantiateAsync(this);
        }
Exemplo n.º 2
0
        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(); });
        }
Exemplo n.º 3
0
 private void InstantiateBuildCommands()
 {
     RebuildProjectCommand.Instantiate(this);
     RebuildSolutionCommand.Instantiate(this);
     CancelBuildCommand.Instantiate(this);
 }