Inheritance: System.Windows.Forms.Form
Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            // ========================= RUN COMMAND ===============================
            Cursor.Current = Cursors.WaitCursor;

            this.Text = "Encoding... Please wait...";
            this.Refresh();

            SaveSettings();

            string textseparator = "===================================================================== \r\n";

            Globals.consolelog = textseparator + DateTime.Now.ToString() + " - Start encoding... \r\n" + textseparator + "\r\n";

            if (radioButton_single.Checked)
            {
                Globals.consolelog += ConsoleApp.Run("cwebp.exe", Globals.args).Output.Trim();
            }
            else
            {   // batch mode
                string finalargs;
                int    count   = listBox_batch.Items.Count;
                int    current = 1;

                foreach (string file in listBox_batch.Items)
                {
                    finalargs = Globals.args + " \"" + file + "\" -o \"" + textBox_outputfile.Text + "\\" + Path.GetFileNameWithoutExtension(file) + ".webp\" ";

                    Globals.consolelog += "File " + current + " of " + count + "\r\n";
                    Globals.consolelog += ConsoleApp.Run("cwebp.exe", finalargs).Output.Trim();
                    Globals.consolelog += "\r\n" + textseparator + "\r\n";

                    this.Text = "Encoding... " + current + " of " + count + " Please wait...";
                    this.Refresh();
                    current++;
                }
            }

            Cursor.Current = Cursors.Default;

            this.Text = "WebP encoding tool GUI";
            this.Refresh();

            frmOutput frm = new frmOutput();

            frm.ShowDialog();
        }
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            // ========================= RUN COMMAND ===============================
            Cursor.Current = Cursors.WaitCursor;

            this.Text = "Encoding... Please wait...";
            this.Refresh();

            SaveSettings();

            string textseparator = "===================================================================== \r\n";

            Globals.consolelog = textseparator + DateTime.Now.ToString() + " - Start encoding... \r\n" + textseparator + "\r\n";

            if (radioButton_single.Checked)
            {
                Globals.consolelog += ConsoleApp.Run("cwebp.exe", Globals.args).Output.Trim();
            }
            else
            {   // batch mode
                string finalargs;
                int count = listBox_batch.Items.Count;
                int current = 1;

                foreach (string file in listBox_batch.Items)
                {
                    finalargs = Globals.args + " \"" + file + "\" -o \"" + textBox_outputfile.Text + "\\" + Path.GetFileNameWithoutExtension(file) + ".webp\" ";

                    Globals.consolelog += "File " + current + " of " + count + "\r\n";
                    Globals.consolelog += ConsoleApp.Run("cwebp.exe", finalargs).Output.Trim();
                    Globals.consolelog += "\r\n" + textseparator + "\r\n";

                    this.Text = "Encoding... " + current + " of " + count + " Please wait...";
                    this.Refresh();
                    current++;
                }
            }

            Cursor.Current = Cursors.Default;

            this.Text = "WebP encoding tool GUI";
            this.Refresh();

            frmOutput frm = new frmOutput();
            frm.ShowDialog();
        }