private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { InDesignController.stop(); IllustratorController.stop(); this.notifyIcon1.Visible = false; Application.Exit(); Process[] pary = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName); foreach (Process p in pary) { p.Kill(); } }
private void button1_Click(object sender, EventArgs e) { String dirIndd = textBox1.Text; String dirIllustrator = textBox2.Text; bool isIndd = checkBox1.Checked; bool isIllustrator = checkBox2.Checked; if (!dirIndd.Trim().Equals("") && !isInddStarted && isIndd) { try { InDesignController.start(dirIndd); isInddStarted = true; this.checkBox1.ForeColor = System.Drawing.Color.Green; button1.Enabled = false; button2.Enabled = true; //MessageBox.Show("InDesign Converter start successfully."); } catch (Exception ex) { MessageBox.Show("InDesign Converter can't be started."); } } if (!dirIllustrator.Trim().Equals("") && !isIllustratorStarted && isIllustrator) { try { IllustratorController.start(dirIllustrator); isIllustratorStarted = true; this.checkBox2.ForeColor = System.Drawing.Color.Green; button1.Enabled = false; button2.Enabled = true; } catch (Exception em) { MessageBox.Show("Illustrator Converter can't be started."); } } }
private void button2_Click(object sender, EventArgs e) { bool isIndd = checkBox1.Checked; bool isIllustrator = checkBox2.Checked; if (isInddStarted && isIndd) { InDesignController.stop(); isInddStarted = false; this.checkBox1.ForeColor = System.Drawing.Color.OrangeRed; button2.Enabled = false; button1.Enabled = true; } if (isIllustratorStarted && isIllustrator) { IllustratorController.stop(); isIllustratorStarted = false; this.checkBox2.ForeColor = System.Drawing.Color.OrangeRed; button2.Enabled = false; button1.Enabled = true; } }
private void startConverter() { String dirIndd = textBox_dir_indesign.Text; String dirIllustrator = textBox_dir_illustrator.Text; bool isIndd = checkBox1.Checked; bool isIllustrator = checkBox2.Checked; if (!isInddStarted && isIndd) { if (!dirIndd.Trim().Equals("")) { if (Directory.Exists(dirIndd)) { try { AppConfig.UpdateAppConfig(keyInddDir, dirIndd); } catch { } try { InDesignController.start(dirIndd); isInddStarted = true; this.checkBox1.ForeColor = System.Drawing.Color.Green; button1.Enabled = false; button2.Enabled = true; //MessageBox.Show("InDesign Converter start successfully."); } catch (Exception ex) { MessageBox.Show(this, "InDesign Converter can't be started."); } } else { MessageBox.Show(this, "InDesign Converter can't be started because of Directory (" + dirIndd + ") does not exists!"); } } else { MessageBox.Show(this, "Please set the conversion directory first"); } } if (!isIllustratorStarted && isIllustrator) { if (!dirIllustrator.Trim().Equals("")) { if (Directory.Exists(dirIllustrator)) { try { AppConfig.UpdateAppConfig(keyIlluDir, dirIllustrator); } catch { } try { IllustratorController.start(dirIllustrator); isIllustratorStarted = true; this.checkBox2.ForeColor = System.Drawing.Color.Green; this.label2.ForeColor = System.Drawing.Color.Green; button2.Enabled = true; } catch (Exception em) { MessageBox.Show(this, "Illustrator Converter can't be started."); } } else { MessageBox.Show(this, "Illustrator Converter can't be started because of Directory (" + dirIllustrator + ") does not exists!"); } } else { MessageBox.Show(this, "Please set the conversion directory first"); } } }