internal void Close(DialogControl dialog) { lock (_openLock) { dialog.Container = null; _openDialogs.Remove(dialog); ShowMostRecentDialogIfNecessary(); } }
private void BindContentAlignment(DialogControl content) { var hbind = new Binding(HorizontalAlignmentProperty.Name); hbind.Source = content; hbind.NotifyOnSourceUpdated = true; BindingOperations.SetBinding(_presenter, HorizontalAlignmentProperty, hbind); var vbind = new Binding(VerticalAlignmentProperty.Name); vbind.Source = content; vbind.NotifyOnSourceUpdated = true; BindingOperations.SetBinding(_presenter, VerticalAlignmentProperty, vbind); }
static SlideFromDirection DetermineAniDirection(DialogControl content) { if (content != null) { if (content.VerticalAlignment == System.Windows.VerticalAlignment.Stretch) { switch (content.HorizontalAlignment) { case System.Windows.HorizontalAlignment.Left: return(SlideFromDirection.Left); case System.Windows.HorizontalAlignment.Right: return(SlideFromDirection.Right); } } else if (content.HorizontalAlignment == System.Windows.HorizontalAlignment.Stretch && content.VerticalAlignment == System.Windows.VerticalAlignment.Bottom) { return(SlideFromDirection.Bottom); } } return(SlideFromDirection.Top); }
internal void Show(DialogControl dialog) { if (dialog.Container != null && dialog.Container != this) { throw new ArgumentException("This dialog already has a container.", "dialog"); } if (Content == dialog) { return; } lock (_openLock) { if (dialog.Container != null) { // already somewhere in this stack _openDialogs.Remove(dialog); } _openDialogs.Add(dialog); ShowMostRecentDialogIfNecessary(); } }
void DoShowContentAnimation(DialogControl content) { var dir = DetermineAniDirection(content); Animation.SlideIn(_presenter, dir, Animation.TypicalDuration, 200, Animation.TypicalEasing); }
static SlideFromDirection DetermineAniDirection(DialogControl content) { if (content != null) { if (content.VerticalAlignment == System.Windows.VerticalAlignment.Stretch) { switch (content.HorizontalAlignment) { case System.Windows.HorizontalAlignment.Left: return SlideFromDirection.Left; case System.Windows.HorizontalAlignment.Right: return SlideFromDirection.Right; } } else if (content.HorizontalAlignment == System.Windows.HorizontalAlignment.Stretch && content.VerticalAlignment == System.Windows.VerticalAlignment.Bottom) { return SlideFromDirection.Bottom; } } return SlideFromDirection.Top; }