public void HandleSoundAlerts(State.Value value) { var keyName = "HKEY_CURRENT_USER\\ScreenerEmailNotificationsState"; var subkey = String.Format("{0}-SND", value.GetKey()); if (value.IsZero()) { Registry.SetValue(keyName, subkey, 0); } else { var obj = Registry.GetValue(keyName, subkey, null); Int32 candidate; if (obj == null) { candidate = 0; } else { candidate = (int)obj; } if ((value.Val > candidate && candidate >= 0) || (value.Val < candidate && candidate <= 0)) { Registry.SetValue(keyName, subkey, value.Val); Notifications.PlaySound(spaths[value.Name]); } } }
// ------------------------------------------- // ---- Notifications // ------------------------------------------- public void HandleEmailAlerts(State.Value value) { var keyName = "HKEY_CURRENT_USER\\ScreenerEmailNotificationsState"; var subkey = String.Format("{0}-{1}", value.GetKey(), this.TFrame); if (value.IsZero()) { Registry.SetValue(keyName, subkey, 0); } else { var candidate = (int)Registry.GetValue(keyName, subkey, 0); var from = "*****@*****.**"; var to = "*****@*****.**"; if ((value.Val > candidate && candidate >= 0) || (value.Val < candidate && candidate <= 0)) { Registry.SetValue(keyName, subkey, value.Val); var tradeType = value.GetTradeType().ToString(); var subject = String.Format("Trade oportunity: {0} {1} {2}/{3} - Punctuation: {4} ", value.Name, tradeType, value.Symbol, TFrame.AsString(), value.Val); Notifications.SendEmail(from, to, subject, ""); } } }
// ------------------------------------------- // ---- Notifications // ------------------------------------------- public void HandleEmailAlerts(State.Value value) { var keyName = "HKEY_CURRENT_USER\\ScreenerEmailNotificationsState"; var subkey = String.Format("{0}-EMAIL", value.GetKey()); if (value.IsZero()) { Registry.SetValue(keyName, subkey, 0); } else { var obj = Registry.GetValue(keyName, subkey, null); Int32 candidate; if (obj == null) { candidate = 0; } else { candidate = (int)obj; } var from = "*****@*****.**"; var to = "*****@*****.**"; if ((value.Val > candidate && candidate >= 0) || (value.Val < candidate && candidate <= 0)) { Registry.SetValue(keyName, subkey, value.Val); var tradeType = value.GetTradeType().ToString(); var tfStr = TimeFrameAsString(value.TimeFrame); var subject = String.Format("{0} trade oportunity on {1} {2} - Strategy: {3}, Points: {4} ", tradeType, tfStr, value.Symbol, value.Name, value.Val); Notifications.SendEmail(from, to, subject, ""); } } }