/// <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 string ToDescription(this ArbitragePriceSpreadAlarmType alarmType) { switch (alarmType) { case ArbitragePriceSpreadAlarmType.Open: return("开仓"); case ArbitragePriceSpreadAlarmType.Close: return("平仓"); default: return("未知"); } }
private void btnClose_Click(object sender, EventArgs e) { this.MonitorType = ArbitragePriceSpreadAlarmType.Close; }