private void AddContractAutoAlarm(Contract contract, Double margin, AlarmActions action) { //If theres already an alarm then leave it alone if (alarms.Any(a => a.ContractGUID == contract.ContractGuid)) return; //log LogFormatted("Adding new {3} Contract Alarm for: {0}({1})-{2}", contract.Title, contract.ContractGuid, contract.DateExpire, contract.ContractState); //gen the text String AlarmName, AlarmNotes; GenerateContractStringsFromContract(contract, out AlarmName, out AlarmNotes); //create the alarm KACAlarm tmpAlarm = new KACAlarm("", AlarmName, AlarmNotes, contract.DateNext() - margin, margin, KACAlarm.AlarmTypeEnum.ContractAuto, action); //add the contract specifics tmpAlarm.ContractGUID = contract.ContractGuid; tmpAlarm.ContractAlarmType = contract.AlarmType(); //add it to the list alarms.Add(tmpAlarm); }