Beispiel #1
0
 private void RemoveQueue(MonitorSetting setting)
 {
     this.BeginInvoke((MethodInvoker)(() =>
     {
         foreach (DataGridViewRow row in dataGridViewQueue.Rows)
         {
             if (Convert.ToDateTime(row.Cells["colDataTimePriceMonStartTime"].Value) == setting.DateTimePriceMonStartTime
                 && Convert.ToDateTime(row.Cells["colDateTimePickerMonEndTime"].Value) == setting.DateTimePickerMonEndTime
                 && Convert.ToInt32(row.Cells["colTextBoxMonLots"].Value) == setting.TextBoxMonLots
                 && Convert.ToDouble(row.Cells["colTextBoxMonRate"].Value) == setting.TextBoxMonRate)
             {
                 dataGridViewQueue.Rows.Remove(row);
                 break;
             }
         }
     }));
 }
Beispiel #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                bool ischek = false;
                foreach (DataGridViewRow row in dataGridViewData.Rows)
                {
                    if (Convert.ToBoolean(row.Cells["chkCol"].Value))
                    {
                        ischek = true;
                    }
                }
                if (!ischek)
                {
                    MessageBox.Show("请先选择要监听的用户");
                    return;
                }
                double lots;
                double rate;
                if (!double.TryParse(textBoxMonLots.Text, out lots))
                {

                    MessageBox.Show("输入Monlots有误 int!");
                    return;
                }
                if (!double.TryParse(textBoxMonRate.Text, out rate))
                {
                    MessageBox.Show("输入MonRate有误 double!");
                    return;
                }
                if (lots >= 100 || lots <= -50)
                {
                    MessageBox.Show("您设置的手数过大,请重新设置");
                    return;
                }
                loading.ShowLoading();
                MonitorSetting setting = new MonitorSetting();
                setting.DateTimePriceMonStartTime = dateTimePriceMonStartTime.Value;
                setting.DateTimePickerMonEndTime = dateTimePickerMonEndTime.Value;
                setting.TextBoxMonLots = lots;
                setting.TextBoxMonRate = rate;
                foreach (DataGridViewRow row in dataGridViewData.Rows)
                {
                    if (Convert.ToBoolean(row.Cells["chkCol"].Value))
                    {
                        row.Cells["colMonLots"].Value = (row.Cells["colMonLots"].Value == null ? string.Empty : row.Cells["colMonLots"].Value.ToString() + ",") + lots;
                        row.Cells["colMonRate"].Value = (row.Cells["colMonRate"].Value == null ? string.Empty : row.Cells["colMonRate"].Value.ToString() + ",") + rate;
                    }
                }
                queueSetting.Enqueue(setting);
                DisplayQueue(setting);
                loading.HideLoading();
                WriteLogs("设置成功添加到队列");
            }
            catch (Exception ex)
            {
                loading.HideLoading();
                _log.Error(ex);

            }
        }
Beispiel #3
0
 private void DisplayQueue(MonitorSetting setting)
 {
     int index = dataGridViewQueue.Rows.Add();
     dataGridViewQueue.Rows[index].Cells["colDataTimePriceMonStartTime"].Value = setting.DateTimePriceMonStartTime;
     dataGridViewQueue.Rows[index].Cells["colDateTimePickerMonEndTime"].Value = setting.DateTimePickerMonEndTime;
     dataGridViewQueue.Rows[index].Cells["colTextBoxMonLots"].Value = setting.TextBoxMonLots;
     dataGridViewQueue.Rows[index].Cells["colTextBoxMonRate"].Value = setting.TextBoxMonRate;
 }