Beispiel #1
0
        public void Activation()
        {
            _studio  = IoC.Get <IStudio>();
            _console = IoC.Get <IConsole>();

            var started        = Observable.FromEventPattern(this, nameof(TargetStarted)).Select(e => true);
            var stopped        = Observable.FromEventPattern(this, nameof(TargetStopped)).Select(e => false);
            var sessionStarted = Observable.FromEventPattern(this, nameof(DebugSessionStarted)).Select(e => true);
            var sessionEnded   = Observable.FromEventPattern(this, nameof(DebugSessionEnded)).Select(e => false);

            var hasSession = sessionStarted.Merge(sessionEnded).StartWith(false);

            var isRunning = hasSession.Merge(started).Merge(stopped).StartWith(false);

            var canRun = _studio.OnSolutionLoaded().CombineLatest(isRunning, hasSession, _studio.OnCurrentTaskChanged(), (loaded, running, session, hasTask) =>
            {
                return(loaded && !running && (!hasTask || (hasTask && session)));
            });

            var canPause = _studio.OnSolutionLoaded().CombineLatest(isRunning, (loaded, running) => loaded && running);

            var canStop = _studio.OnSolutionLoaded().CombineLatest(sessionStarted.Merge(sessionEnded), (loaded, sessionActive) => loaded && SessionActive);

            var canStep = canStop.CombineLatest(isRunning, (stop, running) => stop && !running);

            CanStart = canRun.StartWith(false);

            CanPause = canPause.StartWith(false);

            CanStop = canStop.StartWith(false);

            CanStep = canStep.StartWith(false);

            _studio.OnSolutionChanged.Subscribe(_ => LoadBreakpoints());
        }
        public IntellisenseManager(ITextEditor editor, IIntellisenseControl intellisenseControl, ICompletionAssistant completionAssistant, ILanguageService languageService, ISourceFile file, Action <int> onSetSignatureHelpPosition)
        {
            intellisenseJobRunner   = new JobRunner();
            intellisenseQueryRunner = new JobRunner(1);

            _cancelRunners = new CancellationTokenSource();

            _onSetSignatureHelpPosition = onSetSignatureHelpPosition;

            Task.Factory.StartNew(() => { intellisenseJobRunner.RunLoop(_cancelRunners.Token); });
            Task.Factory.StartNew(() => { intellisenseQueryRunner.RunLoop(_cancelRunners.Token); });

            this.intellisenseControl = intellisenseControl;
            this.completionAssistant = completionAssistant;
            this.languageService     = languageService;
            this.file   = file;
            this.editor = editor;
            _hidden     = true;

            _studio  = IoC.Get <IStudio>();
            _console = IoC.Get <IConsole>();

            var snippetManager = IoC.Get <SnippetManager>();

            _snippets = snippetManager.GetSnippets(languageService, file.Project?.Solution, file.Project);
        }
        public SolutionExplorerViewModel(
            [ImportMany] IEnumerable <Lazy <ISolutionType, SolutionTypeMetadata> > solutionTypes)
        {
            _shell  = IoC.Get <IShell>();
            _studio = IoC.Get <IStudio>();

            _studio.SolutionChanged += (sender, e) => { Model = _studio.CurrentSolution; };

            _solutionTypes = solutionTypes;

            Title = "Solution Explorer";

            this.WhenAnyValue(x => x.SelectedItem).OfType <SourceFileViewModel>().Subscribe(async item =>
            {
                await IoC.Get <IStudio>().OpenDocumentAsync((ISourceFile)item.Model, 1);
            });

            this.WhenAnyValue(x => x.SelectedItem).OfType <ProjectViewModel>().Subscribe(async item =>
            {
                if (item.Model is IProject p)
                {
                    var sourceFile = FileSystemFile.FromPath(p, null, p.Location);

                    await IoC.Get <IStudio>().OpenDocumentAsync(sourceFile, 1);
                }
            });
        }
Beispiel #4
0
 protected bool Deactivate(IStudio entity)
 {
     // Deactivate it
     StudiosRepository.Deactivate(entity);
     // Try to Save Changes
     StudiosRepository.SaveChanges();
     // Finished!
     return(true);
 }
 public virtual bool AreEqual(IStudioModel model, IStudio entity)
 {
     return NameableEntityMapper.AreEqual(model, entity)
         // Studio Properties
         // <None>
         // Related Objects
         // <None>
         ;
 }
Beispiel #6
0
 public virtual bool AreEqual(IStudioModel model, IStudio entity)
 {
     return(NameableEntityMapper.AreEqual(model, entity)
            // Studio Properties
            // <None>
            // Related Objects
            // <None>
            );
 }
 public virtual IStudioModel MapToModelListing(IStudio entity, int currentDepth = 1)
 {
     currentDepth++;
     var model = NameableEntityMapper.MapToModelListing<IStudio, StudioModel>(entity);
     // Studio Properties
     // <None>
     // Related Objects
     // <None>
     // Return Entity
     return model;
 }
Beispiel #8
0
        public EditorViewModel(ISourceFile file)
        {
            _studio = IoC.Get <IStudio>();

            _sourceFile = file;

            var settings = GlobalSettings.Settings.GetSettings <EditorSettings>();

            _colorScheme = ColorScheme.LoadColorScheme(settings.ColorScheme);

            Title = file?.Name;
        }
Beispiel #9
0
 public virtual void MapToEntity(IStudioModel model, ref IStudio entity, int currentDepth = 1)
 {
     currentDepth++;
     // Assign Base properties
     NameableEntityMapper.MapToEntity(model, ref entity);
     // Studio Properties
     // <None>
     // Related Objects
     // <None>
     // Associated Objects
     entity.MovieStudios = model.MovieStudios?.Where(i => i.Active).Select(MovieStudioMapperExtensions.MapToEntity).ToList();
 }
 public virtual void MapToEntity(IStudioModel model, ref IStudio entity, int currentDepth = 1)
 {
     currentDepth++;
     // Assign Base properties
     NameableEntityMapper.MapToEntity(model, ref entity);
     // Studio Properties
     // <None>
     // Related Objects
     // <None>
     // Associated Objects
     entity.MovieStudios = model.MovieStudios?.Where(i => i.Active).Select(MovieStudioMapperExtensions.MapToEntity).ToList();
 }
Beispiel #11
0
        public virtual IStudioModel MapToModelListing(IStudio entity, int currentDepth = 1)
        {
            currentDepth++;
            var model = NameableEntityMapper.MapToModelListing <IStudio, StudioModel>(entity);

            // Studio Properties
            // <None>
            // Related Objects
            // <None>
            // Return Entity
            return(model);
        }
 public virtual IStudioModel MapToModel(IStudio entity, int currentDepth = 1)
 {
     currentDepth++;
     var model = NameableEntityMapper.MapToModel<IStudio, StudioModel>(entity);
     // Studio Properties
     // <None>
     // Related Objects
     // <None>
     // Associated Objects
     model.MovieStudios = entity.MovieStudios?.Where(i => i.Active).Select(MovieStudioMapperExtensions.MapToModelLite).ToList();
     // Return Entity
     return model;
 }
Beispiel #13
0
 protected bool Remove(IStudio entity)
 {
     if (entity == null)
     {
         return(true);
     }                                    // No entity found to remove, consider it passed
     // Remove it
     StudiosRepository.Remove(entity);
     // Try to Save Changes
     StudiosRepository.SaveChanges();
     // Finished!
     return(true);
 }
Beispiel #14
0
        public virtual IStudioModel MapToModel(IStudio entity, int currentDepth = 1)
        {
            currentDepth++;
            var model = NameableEntityMapper.MapToModel <IStudio, StudioModel>(entity);

            // Studio Properties
            // <None>
            // Related Objects
            // <None>
            // Associated Objects
            model.MovieStudios = entity.MovieStudios?.Where(i => i.Active).Select(MovieStudioMapperExtensions.MapToModelLite).ToList();
            // Return Entity
            return(model);
        }
        private void CreateConnection(string workingDirectory = null)
        {
            lock (_createLock)
            {
                if (workingDirectory == null)
                {
                    _studio = IoC.Get <IStudio>();

                    workingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);

                    var solution = _studio.CurrentSolution;

                    if (solution != null)
                    {
                        if (solution?.StartupProject != null)
                        {
                            workingDirectory = solution.StartupProject.CurrentDirectory;
                        }
                        else
                        {
                            workingDirectory = solution.CurrentDirectory;
                        }
                    }
                }

                CloseConnection();

                var args = new List <string>();

                if (Platform.PlatformIdentifier == Platforms.PlatformID.MacOSX)
                {
                    args.Add("-l");
                }

                var shellExecutable = PlatformSupport.ResolveFullExecutablePath((Platform.PlatformIdentifier == Platforms.PlatformID.Win32NT ? "powershell" : "bash") + Platform.ExecutableExtension);

                if (shellExecutable != null)
                {
                    var terminal = s_provider.Create(80, 32, workingDirectory, null, shellExecutable, args.ToArray());

                    Connection = new PsuedoTerminalConnection(terminal);

                    TerminalVisible = true;

                    Connection.Closed += Connection_Closed;
                }
            }
        }
Beispiel #16
0
        public FileCommands(CommandIconService commandIconService)
        {
            _studio = IoC.Get <IStudio>();
            _shell  = IoC.Get <IShell>();

            SaveCommand = new CommandDefinition(
                "Save",
                commandIconService.GetCompletionKindImage("Save"),
                ReactiveCommand.Create(Save, _shell.WhenAnyValue(x => x.SelectedDocument).Select(doc => doc != null)));

            SaveAllCommand = new CommandDefinition(
                "Save All",
                commandIconService.GetCompletionKindImage("SaveAll"),
                ReactiveCommand.Create(SaveAll));

            ExitCommand = new CommandDefinition("Exit", null, ReactiveCommand.Create(Exit));
        }
Beispiel #17
0
        public BuildCommands(
            ISolutionExplorer solutionExplorer,
            CommandIconService commandIconService)
        {
            _studio           = IoC.Get <IStudio>();
            _solutionExplorer = solutionExplorer;

            var shellCanRunTask = _studio.CanRunTask();

            BuildCommand = new CommandDefinition(
                "Build",
                commandIconService.GetCompletionKindImage("Build"),
                ReactiveCommand.Create(_studio.Build, shellCanRunTask));

            CleanCommand = new CommandDefinition(
                "Clean",
                commandIconService.GetCompletionKindImage("Clean"),
                ReactiveCommand.Create(_studio.Clean, shellCanRunTask));
        }
        public SolutionExplorerCommands(ISolutionExplorer solutionExplorer)
        {
            _shell            = IoC.Get <IShell>();
            _studio           = IoC.Get <IStudio>();
            _solutionExplorer = solutionExplorer;

            NewSolutionCommand = new CommandDefinition(
                "New Solution", null, ReactiveCommand.Create(_solutionExplorer.NewSolution));

            OpenSolutionCommand = new CommandDefinition(
                "Open Solution", null, ReactiveCommand.Create(_solutionExplorer.OpenSolution));

            CloseSolutionCommand = new CommandDefinition(
                "Close Solution", null, ReactiveCommand.Create(
                    _studio.CloseSolutionAsync, _studio.OnSolutionChanged.Select(s => s != null)));

            ViewSolutionExplorerCommand = new CommandDefinition("Solution Explorer", null,
                                                                ReactiveCommand.Create(() =>
            {
                _shell.CurrentPerspective.AddOrSelectTool(_solutionExplorer);
            }));
        }
Beispiel #19
0
 public static IObservable <bool> OnCurrentTaskChanged(this IStudio studio) => studio.TaskRunner.OnTaskChanged.Select(t => t != null).StartWith(false);
 public void Add(IStudio entity)
 {
     Context.Studios.Add((Studio)entity);
 }
Beispiel #21
0
 public StudioController(IStudio studio)
 {
     _studio = studio;
 }
 protected bool Deactivate(IStudio entity)
 {
     // Deactivate it
     StudiosRepository.Deactivate(entity);
     // Try to Save Changes
     StudiosRepository.SaveChanges();
     // Finished!
     return true;
 }
        public NewProjectDialogViewModel()
            : base("New Project", true, true)
        {
            _studio          = IoC.Get <IStudio>();
            _templateManager = IoC.Get <TemplateManager>();

            _allProjectTemplates = new Lazy <IDictionary <string, IEnumerable <ITemplate> > >(_templateManager.GetProjectTemplates);

            location = Platform.ProjectDirectory;

            SelectedLanguage = Languages.FirstOrDefault();
            SelectedTemplate = ProjectTemplates.FirstOrDefault();

            BrowseLocationCommand = ReactiveCommand.Create(async() =>
            {
                var ofd = new OpenFolderDialog
                {
                    InitialDirectory = location
                };

                var result = await ofd.ShowAsync();

                if (!string.IsNullOrEmpty(result))
                {
                    Location = result;
                }
            });

            OKCommand = ReactiveCommand.Create(async() =>
            {
                Close();

                bool loadNewSolution = false;

                if (_solutionFolder == null)
                {
                    IoC.Get <IStatusBar>().SetText("Creating new Solution...");
                    loadNewSolution = true;

                    var destination = Path.Combine(location, solutionName);
                    location        = destination;
                    _solutionFolder = VisualStudioSolution.Create(destination, solutionName, false, VisualStudioSolution.Extension);
                }
                else
                {
                    IoC.Get <IStatusBar>().SetText("Creating new project...");
                }

                var templateManager = IoC.Get <TemplateManager>();

                var templateDestination = Path.Combine(Location, name);

                if (await templateManager.CreateTemplate(selectedTemplate, templateDestination, ("name", name)) == CreationResult.Success)
                {
                    var projectFiles = GetProjectFiles(templateDestination);

                    bool defaultSet = _solutionFolder.Solution.StartupProject != null;

                    foreach (var projectFile in projectFiles)
                    {
                        var projectTypeGuid = ProjectUtils.GetProjectTypeGuidForProject(projectFile);

                        if (projectTypeGuid.HasValue)
                        {
                            var project = await ProjectUtils.LoadProjectFileAsync(
                                _solutionFolder.Solution, projectTypeGuid.Value, projectFile);

                            if (project != null)
                            {
                                _solutionFolder.Solution.AddItem(project, projectTypeGuid, _solutionFolder);
                            }

                            if (!defaultSet)
                            {
                                defaultSet = true;
                                _solutionFolder.Solution.StartupProject = project;
                            }

                            if (!loadNewSolution)
                            {
                                await project.LoadFilesAsync();

                                await project.ResolveReferencesAsync();
                            }
                        }
                        else
                        {
                            IoC.Get <Utils.IConsole>().WriteLine(
                                $"The project '{projectFile}' isn't supported by any installed project type!");
                        }
                    }
                }

                _solutionFolder.Solution.Save();

                if (loadNewSolution)
                {
                    await _studio.OpenSolutionAsync(_solutionFolder.Solution.Location);
                }
                else
                {
                    await _solutionFolder.Solution.RestoreSolutionAsync();
                }

                _solutionFolder = null;

                IoC.Get <IStatusBar>().ClearText();
            },
                                               this.WhenAny(x => x.Location, x => x.SolutionName, (location, solution) => solution.Value != null && !Directory.Exists(Path.Combine(location.Value, solution.Value))));

            UpdateTemplatesCommand = ReactiveCommand.Create(async() =>
            {
                var templateManager = IoC.Get <TemplateManager>();

                await Task.Run(() =>
                {
                    templateManager.UpdateDefaultTemplates();

                    _allProjectTemplates = new Lazy <IDictionary <string, IEnumerable <ITemplate> > >(_templateManager.GetProjectTemplates);

                    SelectedLanguage = SelectedLanguage;
                });
            });
        }
        public void Activation()
        {
            studio = IoC.Get <IStudio>();

            IoC.Get <IShell>().CurrentPerspective.AddOrSelectTool(this);
        }
Beispiel #25
0
 public static IStudioModel MapToModelListing(this IStudio entity, int currentDepth = 1)
 {
     return(Mapper.MapToModelListing(entity, currentDepth));
 }
 public void Deactivate(IStudio entity)
 {
     entity.Active = false;
     Update(entity);
 }
 public void Remove(IStudio entity)
 {
     Context.Studios.Remove((Studio)entity);
 }
 public void Add(IStudio entity)
 {
     Context.Studios.Add((Studio)entity);
 }
Beispiel #29
0
 public void Add(IStudio studio)
 {
     StudioCollectieRepository.Add(new StudioStruct(studio.Naam, studio.Straat, studio.HuisNummer, studio.PostCode,
                                                    studio.WoonPlaats, studio.EmailAdres, studio.TelefoonNummer,
                                                    studio.Gebruikersnaam, studio.Wachtwoord));
 }
Beispiel #30
0
 public static IObservable <bool> CanRunTask(this IStudio studio) => studio.OnSolutionLoaded().CombineLatest(studio.OnCurrentTaskChanged(), (loaded, running) => loaded & !running);
Beispiel #31
0
 public static IObservable <bool> OnSolutionLoaded(this IStudio studio) => studio.OnSolutionChanged.Select(s => s != null).StartWith(false);
 protected bool Remove(IStudio entity)
 {
     if (entity == null) { return true; } // No entity found to remove, consider it passed
     // Remove it
     StudiosRepository.Remove(entity);
     // Try to Save Changes
     StudiosRepository.SaveChanges();
     // Finished!
     return true;
 }
 public void Remove(IStudio entity)
 {
     Context.Studios.Remove((Studio)entity);
 }
 public void Update(IStudio entity)
 {
     Context.SetModified(entity);
 }
Beispiel #35
0
 public static void MapToEntity(this IStudioModel model, ref IStudio entity, int currentDepth = 1)
 {
     Mapper.MapToEntity(model, ref entity, currentDepth);
 }
Beispiel #36
0
        public ProjectViewModel(ISolutionParentViewModel parent, IProject model)
            : base(parent, model)
        {
            studio = IoC.Get<IStudio>();
            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(() =>
            {
                if (configuration == null)
                {
                    configuration = new ProjectConfigurationDialogViewModel(model, () =>
                    {
                        configuration = null;
                    });

                    shell.AddDocument(configuration, false);
                }
                else
                {
                    shell.SelectedDocument = configuration;
                }
                //shell.ModalDialog.ShowDialog();
            });

            DebugCommand = ReactiveCommand.Create(() =>
            {
                //shell.Debug(model);
            });

            BuildCommand = ReactiveCommand.CreateFromTask(async () => await studio.BuildAsync(model));

            CleanCommand = ReactiveCommand.Create(() => studio.Clean(model));

            ManageReferencesCommand = ReactiveCommand.Create(() => { });

            SetProjectCommand = ReactiveCommand.Create(() =>
            {
                model.Solution.StartupProject = model;
                model.Solution.Save();

                studio.InvalidateCodeAnalysis();

                var root = this.FindRoot();

                if (root != null)
                {
                    root.VisitChildren(solutionItem =>
                    {
                        solutionItem.RaisePropertyChanged(nameof(FontWeight));
                    });
                }

            });

            OpenInExplorerCommand = ReactiveCommand.Create(() => Platform.OpenFolderInExplorer(Model.CurrentDirectory));

            NewItemCommand = ReactiveCommand.Create(() =>
            {
                shell.ModalDialog = new NewItemDialogViewModel(model);
                shell.ModalDialog.ShowDialogAsync();
            });

            RemoveCommand = ReactiveCommand.Create(() =>
            {
                studio.CloseDocumentsForProject(Model);
                Model.Solution.RemoveItem(Model);
                Model.Solution.Save();
            });

            DevConsoleCommand = ReactiveCommand.Create(() =>
            {
                PlatformSupport.LaunchShell(Model.CurrentDirectory, Model.ToolChain?.BinDirectory, Model.Debugger2?.BinDirectory);
            });
        }
Beispiel #37
0
 public static bool AreEqual(this IStudioModel model, IStudio entity)
 {
     return(Mapper.AreEqual(model, entity));
 }
 public static bool AreEqual(this IStudioModel model, IStudio entity)
 {
     return Mapper.AreEqual(model, entity);
 }
 public static void MapToEntity(this IStudioModel model, ref IStudio entity, int currentDepth = 1)
 {
     Mapper.MapToEntity(model, ref entity, currentDepth);
 }
 public void Deactivate(IStudio entity)
 {
     entity.Active = false;
     Update(entity);
 }
 public void Update(IStudio entity)
 {
     Context.SetModified(entity);
 }
Beispiel #42
0
 public void UpdateStudio(IStudio studio)
 {
     StudioRepository.Update(new StudioStruct(studio.Id, studio.Naam, studio.Straat, studio.HuisNummer, studio.PostCode,
                                              studio.WoonPlaats, studio.EmailAdres, studio.TelefoonNummer));
 }