/// <summary> /// Create new instance of class /// </summary> /// <param name="ex">Exception</param> /// <param name="t">type of alert</param> public AlertDialog(Exception ex, TypeOfAlert t) { InitializeComponent(); DataContext = this; Message = ex.Message; _type = t; switch (_type) { case TypeOfAlert.ERROR: BackgroundColor = ERROR_COLOR; break; case TypeOfAlert.WARNING: BackgroundColor = WARNING_COLOR; break; case TypeOfAlert.SUCCES: BackgroundColor = SUCCES_COLOR; break; case TypeOfAlert.INFO: BackgroundColor = INFO_COLOR; break; } _timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(15) }; _timer.Tick += new EventHandler(EventShowMessage); _timer.Start(); }
/// <summary> /// Create new instance of class /// </summary> /// <param name="message">message</param> /// <param name="t">type of alert</param> /// <param name="d">delay to display the alert </param> public AlertDialog(string message, TypeOfAlert t, TimeSpan d) { InitializeComponent(); DataContext = this; Message = message; _type = t; switch (_type) { case TypeOfAlert.ERROR: BackgroundColor = ERROR_COLOR; break; case TypeOfAlert.WARNING: BackgroundColor = WARNING_COLOR; break; case TypeOfAlert.SUCCES: BackgroundColor = SUCCES_COLOR; break; case TypeOfAlert.INFO: BackgroundColor = INFO_COLOR; break; } this.Opacity = 0; _timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) }; _timer.Tick += new EventHandler(EventShowMessage); _timer.Start(); }