Пример #1
0
        private void btnstart_Click(object sender, EventArgs e)
        {
            if (txtlabelcount.Text == "")
            {
                MessageBox.Show("請輸入列印份數");
            }
            else
            {
                if (txtdatafolder.Text == "")
                {
                    MessageBox.Show("請指定目錄");
                }
                else if (radusb.Checked == false && radnet.Checked == false && radlpt.Checked == false)
                {
                    MessageBox.Show("請選擇傳輸介面");
                }
                else
                {
                    if (btnstart.Text == "Start")
                    {
                        if (txtip.Text == "" && radnet.Checked == true)
                        {
                            MessageBox.Show("請輸入IP位置");
                        }
                        else
                        {
                            btnstart.Text         = "Pause";
                            configbox.Enabled     = false;
                            btnautostart.Enabled  = false;
                            txtip.Enabled         = false;
                            txtlabelcount.Enabled = false;

                            if (f2 == null)
                            {
                                f2           = new frm2();
                                f2.Disposed += new EventHandler(f2_Disposed);
                            }
                            f2.Show();

                            for (k = 0; k < Convert.ToInt32(txtlabelcount.Text); k++)
                            {
                                readdata();
                            }
                            Deletedata();
                        }
                    }
                    else if (btnstart.Text == "Pause")
                    {
                        labeldata.Clear();
                        datatoprint.Clear();
                        btnstart.Text        = "Start";
                        configbox.Enabled    = true;
                        btnautostart.Enabled = true;
                        txtip.Enabled        = true;
                    }
                }
            }
        }
Пример #2
0
        private void btnautostart_Click(object sender, EventArgs e)
        {
            if (txtdatafolder.Text == "")
            {
                MessageBox.Show("請指定目錄");
            }
            else if (radusb.Checked == false && radnet.Checked == false && radlpt.Checked == false)
            {
                MessageBox.Show("請選擇傳輸介面");
            }
            else
            {
                if (btnautostart.Text == "AutoStart")
                {
                    if (txtip.Text == "" && radnet.Checked == true)
                    {
                        MessageBox.Show("請輸入IP位置");
                    }
                    else
                    {
                        btnautostart.Text = "Pause";
                        configbox.Enabled = false;
                        btnstart.Enabled  = false;

                        if (f2 == null)
                        {
                            f2           = new frm2();
                            f2.Disposed += new EventHandler(f2_Disposed);
                        }
                        f2.Show();
                        timer_autorun.Start();
                    }
                }
                else if (btnautostart.Text == "Pause")
                {
                    timer_autorun.Stop();
                    btnautostart.Text = "AutoStart";
                    configbox.Enabled = true;
                    btnstart.Enabled  = true;
                }
            }
        }
Пример #3
0
 void f2_Disposed(object sender, EventArgs e)
 {
     f2 = null;   //Disposed 後把 f2 設為 null, 下次要用時再建新的
 }