private void OnEnable() { canvasView = CreateInstance <CanvasView>(); toolView = CreateInstance <ToolView>(); model = new MeshDeleterWithTextureModel(); localizedText = new LocalizedText(); ChangeLanguage(localizedText.SelectedLanguage); }
private async void Window_Loaded(object sender, RoutedEventArgs e) { MSBuildLocator.RegisterDefaults(); Project project = null; var args = Environment.GetCommandLineArgs(); if (args.Length >= 3 && File.Exists(args[1])) { string file = args[1]; string suffix = System.IO.Path.GetExtension(file); if (suffix == ".csproj") { this.Workspace = MSBuildWorkspace.Create(); project = await this.Workspace.OpenProjectAsync(file); } } Document document = null; if (args.Length >= 3) { string documentName = args[2]; document = project?.Documents.FirstOrDefault(doc => doc.FilePath.EndsWith(documentName)); } if (document == null) { MessageBox.Show("Please pass a valid project and document to open as an argument of the program"); this.Close(); return; } await this.OpenDocument(document); ToolView toolView = new ToolView(new SimpleIdeServices(this)); this.DataContext = toolView; this.replayWindow.DataContext = toolView.Replay; }