protected override void OnClosed(EventArgs e) { base.OnClosed(e); try { _toolClient.DocumentChanged -= OnDocumentChanged; _toolClient.SelectionChanged -= OnSelectionChanged; _toolClient.Dispose(); } // ReSharper disable once EmptyGeneralCatchClause catch { } _toolClient = null; }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); _toolClient = new SkylineToolClient(args[0], "Example Interactive Tool"); // Not L10N OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "All Files (*.*)|*.*"; ofd.FilterIndex = 1; ofd.Multiselect = false; if (ofd.ShowDialog() == DialogResult.OK) { _inputFile = ofd.FileName; } else { Console.WriteLine("Cancelled"); } if (_inputFile != null) { var res = runCommand(); // res = "PrecursorName\tPrecursorMz\tProductMz\tPrecursorCharge\tProductCharge\tMoleculeGroup\tProductName\r\n" + res; if (res.Item1 != 0) { return; } var input = res.Item2.Replace("\t", ","); try { _toolClient.InsertSmallMoleculeTransitionList(input); } catch (Exception ex) { Console.WriteLine(ex); } } _toolClient.Dispose(); Application.Exit(); }