public void Show(ContentControl parent, ButtnClick click) { if (parent.ActualHeight < 1) { return; } _parent = parent; _click = click; Row_Dialog.MinHeight = parent.ActualHeight / 4.0 - 110; Row_Dialog.MaxHeight = parent.ActualHeight; parent.SizeChanged += (s, e) => { Row_Dialog.MinHeight = parent.ActualHeight / 4.0 - 110; Row_Dialog.MaxHeight = parent.ActualHeight; }; _dialogRet = -1; _content = parent.Content; parent.Content = null; parent.Content = this; EventHandler bAnimationCompleted = (sender, e) => { DoubleAnimation dAnimation = new DoubleAnimation(); dAnimation.From = 0; dAnimation.To = 1; dAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.4)); if (Text_Timer.Visibility == Visibility.Visible) { _timer = new Timer(TimerCallback, null, 1000, 1000); } }; DoubleAnimation bAnimation = new DoubleAnimation(); bAnimation.From = 0; bAnimation.To = 1; bAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.4)); bAnimation.Completed += bAnimationCompleted; BeginAnimation(OpacityProperty, bAnimation); }
public static void Show(ContentControl parent, string title, string message, int lpCaption, ButtnClick click = null, int highlight = IDOK, int timer = 0) { new MessageDialog(title, message, lpCaption, highlight, timer).Show(parent, click); }