private PopUpMessage(RegataCoreMessages.Message msg, int autoCloseIntervalSeconds) { _tdp = new TaskDialogPage(); _tdp.Icon = _statusIcon[msg.Status]; _tdp.AllowCancel = true; _tdp.Caption = msg.Caption; _tdp.SizeToContent = true; _timer = new Timer(); _timer.Interval = 1000; _timer.Tick += _timer_Tick; FillDefaultElements(); _tdp.Heading = msg.Head; _tdp.Text = msg.Text; _tdp.Footnote = _tdf; _tdp.Expander = _tde; _tde.Text = msg.DetailedText; // autoclosing only for info or success if ((msg.Status == Status.Info || msg.Status == Status.Success) && autoCloseIntervalSeconds != 0) { _tdpbar = new TaskDialogProgressBar(); _tdpbar.Maximum = autoCloseIntervalSeconds; _tdpbar.State = TaskDialogProgressBarState.Normal; _tdp.ProgressBar = _tdpbar; _tdp.Created += (s, ev) => { _timer.Start(); }; } TaskDialog.ShowDialog(_tdp); }
public static void Show(RegataCoreMessages.Message msg, int autoCloseIntervalSeconds = 15) { new PopUpMessage(msg, autoCloseIntervalSeconds); }