Ejemplo n.º 1
0
        public ShellViewModel([ImportMany] IEnumerable <ToolViewModel> importedTools,
                              [ImportMany] IEnumerable <ILanguageService> languageServices, [ImportMany] IEnumerable <ISolutionType> solutionTypes, [ImportMany] IEnumerable <IProject> projectTypes,
                              [ImportMany] IEnumerable <IProjectTemplate> projectTemplates, [ImportMany] IEnumerable <IToolChain> toolChains,
                              [ImportMany] IEnumerable <IDebugger> debuggers, [ImportMany] IEnumerable <ITestFramework> testFrameworks,
                              [ImportMany] IEnumerable <ICodeTemplate> codeTemplates, [ImportMany] IEnumerable <IExtension> extensions,
                              [Import] IMenu mainMenu)
        {
            MainMenu         = mainMenu;
            LanguageServices = languageServices;
            ProjectTemplates = projectTemplates;
            ToolChains       = toolChains;
            Debuggers        = debuggers;
            SolutionTypes    = solutionTypes;
            ProjectTypes     = projectTypes;
            TestFrameworks   = testFrameworks;
            CodeTemplates    = codeTemplates;

            IoC.RegisterConstant(this, typeof(IShell));

            foreach (var extension in extensions)
            {
                extension.BeforeActivation();
            }

            foreach (var extension in extensions)
            {
                extension.Activation();
            }

            CurrentPerspective = Perspective.Editor;

            StatusBar    = new StatusBarViewModel();
            DocumentTabs = new DocumentTabsViewModel();

            Console   = IoC.Get <IConsole>();
            ErrorList = IoC.Get <IErrorList>();

            tools = new ObservableCollection <object>();

            LeftTabs        = new TabControlViewModel();
            RightTabs       = new TabControlViewModel();
            BottomTabs      = new TabControlViewModel();
            BottomRightTabs = new TabControlViewModel();
            RightBottomTabs = new TabControlViewModel();
            RightMiddleTabs = new TabControlViewModel();
            RightTopTabs    = new TabControlViewModel();
            MiddleTopTabs   = new TabControlViewModel();

            foreach (var tool in importedTools)
            {
                tools.Add(tool);

                switch (tool.DefaultLocation)
                {
                case Location.Bottom:
                    BottomTabs.Tools.Add(tool);
                    break;

                case Location.BottomRight:
                    BottomRightTabs.Tools.Add(tool);
                    break;

                case Location.RightBottom:
                    RightBottomTabs.Tools.Add(tool);
                    break;

                case Location.RightMiddle:
                    RightMiddleTabs.Tools.Add(tool);
                    break;

                case Location.RightTop:
                    RightTopTabs.Tools.Add(tool);
                    break;

                case Location.MiddleTop:
                    MiddleTopTabs.Tools.Add(tool);
                    break;

                case Location.Left:
                    LeftTabs.Tools.Add(tool);
                    break;

                case Location.Right:
                    RightTabs.Tools.Add(tool);
                    break;
                }
            }

            LeftTabs.SelectedTool        = LeftTabs.Tools.FirstOrDefault();
            RightTabs.SelectedTool       = RightTabs.Tools.FirstOrDefault();
            BottomTabs.SelectedTool      = BottomTabs.Tools.FirstOrDefault();
            BottomRightTabs.SelectedTool = BottomRightTabs.Tools.FirstOrDefault();
            RightTopTabs.SelectedTool    = RightTopTabs.Tools.FirstOrDefault();
            RightMiddleTabs.SelectedTool = RightMiddleTabs.Tools.FirstOrDefault();
            RightBottomTabs.SelectedTool = RightBottomTabs.Tools.FirstOrDefault();
            MiddleTopTabs.SelectedTool   = MiddleTopTabs.Tools.FirstOrDefault();

            StatusBar.LineNumber     = 1;
            StatusBar.Column         = 1;
            StatusBar.PlatformString = Platform.PlatformString;

            ProcessCancellationToken = new CancellationTokenSource();

            ModalDialog = new ModalDialogViewModelBase("Dialog");

            CurrentPerspective = Perspective.Editor;

            ToolBarDefinition = ToolBarDefinitions.MainToolBar;
        }
Ejemplo n.º 2
0
 public MainDocumentService(DocumentTabsViewModel vm)
 {
     this.VM = vm;
 }