/// <summary> /// 添加预警 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button_AddNotify_Click(object sender, EventArgs e) { ArbitragePriceSpreadAlarmType monitorType = this.arbitragePriceSpreadMonitorTypeControl.MonitorType; PriceSpreadSide priceSpreadSide = this.priceSpreadSideControl_Alarm.PriceSpreadSide; decimal threshold = this.nudPriceSpreadThreshold_Alarm.Value; ArbitrageAlarmArgument args = new ArbitrageAlarmArgument(); args.MonitorType = monitorType; args.PriceSpreadSide = priceSpreadSide; args.PriceSpreadThreshold = threshold; ArbitrageAlarmArgumentViewModel model = ArbitrageAlarmArgumentViewModel.CreatViewModel(args); ArbitrageAlarmArgumentViewModel hasModel = (from m in m_dataSourceAlarm where m.Equals(model) select m).FirstOrDefault(); if (hasModel != null) { USeFuturesSpiritUtility.ShowWarningMessageBox(this, "不能添加重复的预警"); return; } m_dataSourceAlarm.Add(ArbitrageAlarmArgumentViewModel.CreatViewModel(args)); }
public static ArbitrageAlarmArgument CreatAlarmData(ArbitrageAlarmArgumentViewModel model) { ArbitrageAlarmArgument args = new ArbitrageAlarmArgument(); args.MonitorType = model.MonitorType; args.PriceSpreadSide = model.PriceSpreadSide; args.PriceSpreadThreshold = model.PriceSpreadThreshold; return(args); }
public static ArbitrageAlarmArgumentViewModel CreatViewModel(ArbitrageAlarmArgument args) { ArbitrageAlarmArgumentViewModel model = new ArbitrageAlarmArgumentViewModel(); model.MonitorType = args.MonitorType; model.PriceSpreadSide = args.PriceSpreadSide; model.PriceSpreadThreshold = args.PriceSpreadThreshold; return(model); }