void OpenFile(object sender, EventArgs e) { var openPanel = new NSOpenPanel(); openPanel.ReleasedWhenClosed = true; openPanel.Prompt = "Select File ... "; openPanel.DirectoryUrl = new NSUrl(TestsDir); var result = openPanel.RunModal(); if (result == 1) { var filename = openPanel.Filename; // will switch to .Url later if (Path.GetExtension(filename) == ".cs") { var newText = Extensions.ReadFile(filename); CSharpFilename.StringValue = Path.GetFileName(filename); CSharpTextEditor.Replace(new NSRange(0, CSharpTextEditor.Value.Length), newText); ViewModel.SourceCode = newText; ThreadPool.QueueUserWorkItem((h) => { ViewModel.RecompileSource(); }); } else if ((Path.GetExtension(filename) == ".sln") || (Path.GetExtension(filename) == ".csproj")) { var newText = Extensions.ReadFile(filename); CSharpFilename.StringValue = Path.GetFileName(filename); CSharpTextEditor.Replace(new NSRange(0, CSharpTextEditor.Value.Length), newText); ViewModel.SourceCode = newText; ThreadPool.QueueUserWorkItem((h) => { ViewModel.RecompileSolution(filename); }); // CompileSolution } else { Console.WriteLine("Cannot Load Type " + Path.GetExtension(filename)); } } }
void ReleaseDesignerOutlets() { if (RunAllTests != null) { RunAllTests.Dispose(); RunAllTests = null; } if (ConsoleText != null) { ConsoleText.Dispose(); ConsoleText = null; } if (CppFileList != null) { CppFileList.Dispose(); CppFileList = null; } if (CPPFilename != null) { CPPFilename.Dispose(); CPPFilename = null; } if (CPPRunButton != null) { CPPRunButton.Dispose(); CPPRunButton = null; } if (CPPTextEditor != null) { CPPTextEditor.Dispose(); CPPTextEditor = null; } if (CSharpFilename != null) { CSharpFilename.Dispose(); CSharpFilename = null; } if (CSharpRunButton != null) { CSharpRunButton.Dispose(); CSharpRunButton = null; } if (CSharpTextEditor != null) { CSharpTextEditor.Dispose(); CSharpTextEditor = null; } if (IntermediateText != null) { IntermediateText.Dispose(); IntermediateText = null; } if (OpenFileButton != null) { OpenFileButton.Dispose(); OpenFileButton = null; } if (TestButton != null) { TestButton.Dispose(); TestButton = null; } if (TestStatusButton != null) { TestStatusButton.Dispose(); TestStatusButton = null; } }