Exemple #1
0
        private void SubmitForm_OnClick(object sender, EventArgs e)
        {
            bool        bChecked  = false;
            RadioButton rbChecked = null;

            foreach (Control control in Notifications_Panel.Controls)
            {
                if ((control as RadioButton).Checked)
                {
                    rbChecked = control as RadioButton;
                    bChecked  = true;
                }
            }

            if (String.IsNullOrEmpty(Username_TextBox.Text) || !bChecked)
            {
                Error_TextBox.Show();
            }
            else
            {
                AppSetting.eNotificationsLevel notificationsLevel = getNotificationLevel(rbChecked);
                AppSetting.eInterset           interest           = getInterest(Interests_ComboBox.Text);
                Error_TextBox.Hide();
                AppSetting appSetting = new AppSetting(Username_TextBox.Text, LunceTime_TimePicker.Value,
                                                       DinnerTime_TimePicker.Value, FriendlyTime_TimePicker.Value, interest, notificationsLevel);

                appSetting.SaveToFile();
                this.formDashboard.appSetting = appSetting;
                this.formDashboard.Show();
                this.Hide();
            }
        }
Exemple #2
0
 public FormFirstEntry(FormDashboard formDashboard)
 {
     this.formDashboard = formDashboard;
     InitializeComponent();
     Error_TextBox.Hide();
     setTimePickers(LunceTime_TimePicker);
     setTimePickers(DinnerTime_TimePicker);
     setTimePickers(FriendlyTime_TimePicker);
 }
Exemple #3
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            Timeout_Count++;

            if (Timeout_Count == modbus.Modbus_Timeout)
            {
                if (buffer[modbus.Modbus_Id_Index] != 0)
                {
                    TimeOut_Error_Times++;
                    TimeOut_Count_TextBox.Text = TimeOut_Error_Times.ToString();
                    Error_TextBox.AppendText("Tx: ");
                    Error_TextBox.AppendText(BitConverter.ToString(buffer).Replace("-", " "));
                    Error_TextBox.AppendText(Environment.NewLine);

                    DataRow dr = file.dt.NewRow();   //建立新的Rows
                    dr["TX"]     = BitConverter.ToString(buffer).Replace("-", " ");
                    dr["RESULT"] = "FALSE";
                    file.dt.Rows.Add(dr);
                }
                else
                {
                    Correct_Times++;
                    Correct_Count_TextBox.Text = Correct_Times.ToString();

                    DataRow dr = file.dt.NewRow();   //建立新的Rows
                    dr["TX"]     = BitConverter.ToString(buffer).Replace("-", " ");
                    dr["RESULT"] = "TRUE";
                    file.dt.Rows.Add(dr);
                }

                file.SaveCsv(file.dt, file.GetFileName());
                Is_Need_Receive = false;

                Clear_Timer2_Parameter();
                //s.Stop();//開始計時

                //TimeOut_Count_TextBox.Text = ((s.ElapsedMilliseconds).ToString() + "毫秒");
                //s.Reset();
            }
        }
Exemple #4
0
        private void Display_Error_Text(Byte[] Receive_Buffer)
        {
            Error_TextBox.AppendText("Tx: ");
            Error_TextBox.AppendText(BitConverter.ToString(buffer).Replace("-", " "));
            Error_TextBox.AppendText(Environment.NewLine);
            Error_TextBox.AppendText("Rx: ");
            Error_TextBox.AppendText(BitConverter.ToString(Receive_Buffer).Replace("-", " "));
            Error_TextBox.AppendText(Environment.NewLine);
            Error_TextBox.ForeColor = Color.Red;

            DataRow dr = file.dt.NewRow();   //建立新的Rows

            dr["TX"]     = BitConverter.ToString(buffer).Replace("-", " ");
            dr["RX"]     = BitConverter.ToString(Receive_Buffer).Replace("-", " ");
            dr["RESULT"] = "FALSE";
            file.dt.Rows.Add(dr);

            file.SaveCsv(file.dt, file.GetFileName());

            Error_Times++;
            Error_Count_TextBox.Text = Error_Times.ToString();
            Temp_Receive_Buffer      = new Byte[1024];
        }