Example #1
0
        public void Should_Serialize_FirstComponent()
        {
            var field = new DR
            {
                RangeStartDateTime = new TS {
                    Time = new DTM(2015, 9, 6, 9, 42, 12)
                }
            };

            Assert.AreEqual(First, field.ToString());
        }
Example #2
0
        public void Should_Serialize_LastComponent()
        {
            var field = new DR
            {
                RangeEndDateTime = new TS
                {
                    DegreeOfPrecision = new ID {
                        Value = "DR.RangeEndDateTime.DegreeOfPrecision"
                    }
                }
            };

            Assert.AreEqual(Last, field.ToString());
        }
Example #3
0
        public void Should_Serialize_AllComponents()
        {
            var field = new DR
            {
                RangeStartDateTime = new TS
                {
                    Time = new DTM(2015, 9, 6, 9, 42, 12),
                    DegreeOfPrecision = new ID {
                        Value = "DR.RangeStartDateTime.DegreeOfPrecision"
                    }
                },
                RangeEndDateTime = new TS
                {
                    Time = new DTM(2015, 9, 7, 23, 59, 59, 999, 9, -4),
                    DegreeOfPrecision = new ID {
                        Value = "DR.RangeEndDateTime.DegreeOfPrecision"
                    }
                }
            };

            Assert.AreEqual(All, field.ToString());
        }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                //tratamento de erro, para caso o usuario deixe o campo em branco
                if (txtNum1.Text == "" || txttNum2.Text == "")
                {
                    MessageBox.Show("preencha os campos", "Atenção");
                    if (txtNum1.Text == "")
                    {
                        txtNum1.Focus();
                    }
                    else if (txttNum2.Text == "")
                    {
                        txttNum2.Focus();
                    }
                }
                else
                {
                    //variaveis
                    double num1, num2, MR, SR, VR, DR;
                    num1 = Convert.ToDouble(txtNum1.Text);
                    num2 = Convert.ToDouble(txttNum2.Text);


                    //adição
                    if (radioButton1.Checked == true)
                    {
                        pictureBox1.Image = Properties.Resources._;
                        MR = num1 + num2;
                        MessageBox.Show(num1 + " + " + num2 + " = " + MR);
                    }
                    //subtração
                    if (radioButton2.Checked == true)
                    {
                        pictureBox1.Image = Properties.Resources.m;
                        SR = num1 - num2;
                        MessageBox.Show(num1 + " - " + num2 + " = " + SR);
                    }
                    //multiplicação
                    if (radioButton3.Checked == true)
                    {
                        pictureBox1.Image = Properties.Resources.xx;
                        VR = num1 * num2;
                        MessageBox.Show(num1 + " * " + num2 + " = " + VR);
                    }
                    //divisão
                    if (radioButton4.Checked == true)
                    {
                        //tratamento de erro, para caso o usuario faça divisão por "0"
                        if (num2 == 0)
                        {
                            MessageBox.Show("não é possivel dividir por 0");
                        }
                        else
                        {
                            pictureBox1.Image = Properties.Resources.d;
                            DR = num1 / num2;
                            MessageBox.Show(num1 + " / " + num2 + " = " + DR.ToString("f2"));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }