コード例 #1
0
ファイル: BeamWindow.xaml.cs プロジェクト: JUSTIVE/beam
        public void showAlert(string message, AlertBox.MessageType type = AlertBox.MessageType.Success)
        {
            AlertBox        alertBox     = new AlertBox();
            DispatcherTimer alertTimeout = new DispatcherTimer();

            alertBox.SetMessage(message, type);
            alertTimeout.Interval = TimeSpan.FromSeconds(5);
            alertTimeout.Tick    += delegate { alertTimeout.Stop(); AlertStack.Children.Remove(alertBox); alertBox = null; alertTimeout = null; };
            alertBox.MouseUp     += delegate { alertTimeout.Stop(); AlertStack.Children.Remove(alertBox); alertBox = null; alertTimeout = null; };
            AlertStack.Children.Add(alertBox);
            alertTimeout.Start();
        }