Exemplo n.º 1
0
        public void Activate()
        {
            WriterForm frm = new WriterForm();

            frm.Filters = filters.ToArray();
            frm.textBoxFilePath.Text      = filePath;
            frm.checkBoxNeedWrite.Checked = needWrite;
            frm.FormClosing += new System.Windows.Forms.FormClosingEventHandler(frm_FormClosing);
            frm.Show();
        }
Exemplo n.º 2
0
        void frm_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
        {
            bool f = false;

            try
            {
                if (mutex.WaitOne(3000))
                {
                    f = true;

                    WriterForm frm = sender as WriterForm;
                    if (frm.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                    {
                        return;
                    }

                    needWrite = frm.checkBoxNeedWrite.Checked;

                    filters.Clear();
                    filters.AddRange(frm.Filters);

                    if (filePath != frm.textBoxFilePath.Text)
                    {
                        filePath = frm.textBoxFilePath.Text;

                        if (writer != null)
                        {
                            writer.Close();
                            writer.Dispose();
                        }

                        writer           = new StreamWriter(filePath);
                        writer.AutoFlush = true;
                    }

                    f = false;
                    mutex.ReleaseMutex();
                }
            }

            finally
            {
                if (f)
                {
                    mutex.ReleaseMutex();
                }
            }
        }
Exemplo n.º 3
0
        public void Activate()
        {
            WriterForm frm = new WriterForm();

                frm.Filters = filters.ToArray();
                frm.textBoxFilePath.Text = filePath;
                frm.checkBoxNeedWrite.Checked = needWrite;
                frm.FormClosing += new System.Windows.Forms.FormClosingEventHandler(frm_FormClosing);
                frm.Show();
        }