private void closeExternalFilter() { try { Python.Close(); Python = null; procExternalFilter.Kill(); tsExternalFilter.BackColor = Color.Red; } catch (Exception) { } }
private void frmMain_Load(object sender, EventArgs e) { if (!File.Exists(strDLL)) this.Close(); procExternalFilter = null; Python = null; tsExternalFilter.BackColor = Color.Red; }
private void activateExtenalFilter() { if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "\\scripts\\external_filter_server.py")) { int port = mnuToolsExternalFilter(); if (port == -1) { externalFilter = false; return; } string file = CreateFile(); procExternalFilter = new Process(); procExternalFilter.StartInfo = new ProcessStartInfo() { WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory + "\\scripts", FileName = "python.exe", Arguments ="external_filter_server.py "+ port.ToString() + " " + file, UseShellExecute = false, RedirectStandardOutput = false, RedirectStandardError = false, RedirectStandardInput = false, CreateNoWindow = true }; try { //procExternalFilter.Start(); tsExternalFilter.BackColor = Color.Green; if (Python == null) { procExternalFilter.Start(); timerPython.Start(); Python = new FrmPython(file); Python.Show(); } } catch(Exception ex) { MessageBox.Show("Do you have python installed on your computer?"); //MessageBox.Show(ex.Message); } } }