Exemplo n.º 1
0
        private void 終了XToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult dr;

            dr = MessageBox.Show("終了してよろしいですか?", "終了確認", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            if (dr == DialogResult.Cancel)
            {
                return;
            }
            Environment.Exit(0);
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            double sumlength, weight;

            try{
                sumlength = double.Parse(tb_length1.Text) + double.Parse(tb_length2.Text) + double.Parse(tb_length3.Text);
            }catch {
                MessageBox.Show("3辺の長さを入力してください。", "入力エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try{
                weight = double.Parse(tb_weight.Text);
            }catch {
                MessageBox.Show("重さを入力してください", "入力エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            /*各会社のインスタンス*/
            yamato = new Yamato(comboBox1.Text, comboBox2.Text, sumlength, weight);
            sagawa = new Sagawa(comboBox1.Text, comboBox2.Text, sumlength, weight);
            yupack = new Yupack(comboBox1.Text, comboBox2.Text, sumlength, weight);

            if (yamato.Init(rb_cool.Checked))
            {
                textBox1.Text += yamato.name + yamato.getErrorMessage() + Environment.NewLine;
            }
            else
            {
                if (checkBoxYamato.Checked)
                {
                    textBox1.Text += yamato.name + yamato.charge.ToString() + Environment.NewLine;
                }
            }

            if (sagawa.Init(rb_cool.Checked))
            {
                textBox1.Text += sagawa.name + sagawa.getErrorMessage() + Environment.NewLine;
            }
            else
            {
                if (checkBoxHikyaku.Checked)
                {
                    textBox1.Text += sagawa.name + sagawa.charge.ToString() + Environment.NewLine;
                }
            }

            if (yupack.Init(rb_cool.Checked))
            {
                textBox1.Text += yupack.name + yupack.getErrorMessage() + Environment.NewLine;
            }
            else
            {
                if (checkBoxYupack.Checked)
                {
                    textBox1.Text += yupack.name + yupack.charge.ToString() + Environment.NewLine;
                }
            }
            SaveLog();
            dr = new DispResult(yamato.charge, sagawa.charge, yupack.charge, comboBox1.Text, comboBox2.Text, rb_cool.Checked);
            dr.ShowDialog(this);
            dr.Dispose();
        }