private void Tiers_Load(object sender, EventArgs e)
 {
     Load_All_Tier(new Tiers());
     Cls_Message.Insatnce().GetAllPorts(comboBox1);
     comboBox2.SelectedIndex = 4;
     comboBox3.SelectedIndex = 1;
     Get_Message();
 }
 private void button2_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(comboBox1.Text) || string.IsNullOrEmpty(comboBox2.Text) || string.IsNullOrEmpty(comboBox3.Text))
     {
         MessageBox.Show("Configuration failed...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Cls_Message.Insatnce().SetData(Convert.ToInt32(comboBox1.Text.Trim()), Convert.ToInt32(comboBox2.Text.Trim()),
                                        Convert.ToInt32(comboBox3.Text.Trim()));
         Cls_Message.Insatnce().Test_port();
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     s.SelectVoiceByHints(VoiceGender.Male);
     if (string.IsNullOrEmpty(text_phone.Text) || string.IsNullOrEmpty(text_message.Text))
     {
         s.Speak("Specify the number or write a message to send");
         MessageBox.Show("Specify the number or write a message to send.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (string.IsNullOrEmpty(comboBox1.Text))
     {
         MessageBox.Show("Ckeck modem port.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Cls_Message.Insatnce().Send(text_message.Text, text_phone.Text.Trim(), "");
         SaveMessage(true);
     }
 }
 void SaveMessage(bool btn)
 {
     try
     {
         Cls_Message message = new Cls_Message();
         message._Message = text_message.Text.Trim();
         message.Reftier  = id_tier;
         if (btn)
         {
             Cls_Message.Insatnce().Save(message);
         }
         else
         {
             MessageBox.Show("Function not fund...", "Message...", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error " + ex.Message, "Error...", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     Get_Message();
 }
 void Get_Message()
 {
     flowLayoutPanel1.Controls.Clear();
     Cls_Message.Insatnce().Get_Message(flowLayoutPanel1, pictureBox5);
 }