private void Showwindow() { var _1 = Owner as AyWindowBase; if (_1 != null) { _1.MaskColorAnimate.Begin(); } var sc = new AyAniScale(body, () => { isShowAnimatedOK = true; //DropShadowEffect de = new DropShadowEffect(); ////de.BlurRadius = options.ShadowRadius; //body.Effect = de; //de.ShadowDepth = 2; //de.Opacity = 0.3; //de.Color = Colors.Black; //AyAniDouble _1 = new AyAniDouble(body); //_1.AniPropertyPath = new PropertyPath("(FrameworkElement.Effect).(DropShadowEffect.BlurRadius)"); //_1.FromDouble = 0; //_1.ToDouble = 12; //_1.AniEasingMode = 2; //_1.AnimateSpeed = 200; //_1.Begin(); }); sc.AnimateSpeed = 450; sc.ScaleXFrom = 0; sc.ScaleYFrom = 0; sc.ScaleXTo = 1; sc.ScaleYTo = 1; sc.EasingFunction = new System.Windows.Media.Animation.CubicEase { EasingMode = EasingMode.EaseOut }; sc.AutoDestory = true; sc.Begin(); }
private void ScaleTest3_Click(object sender, RoutedEventArgs e) { AyScale3.Begin(); }
private void SetAyLayerBase(object owner, object content, string title, AyLayerOptions options, bool isDiaglog) { if (options == null) { options = AyLayerOptions.DefaultAyLayerOptions; } _options = options; //this.Topmost = true; //this.ShowInTaskbar = true; //if (owner != null) //{ // Owner = owner; //} if (owner == null) { if (Application.Current.MainWindow is AyWindow) { AyWindow mainWindow = Application.Current.MainWindow as AyWindow; Owner = mainWindow.ayLayerArea; } } else { var _Owner = owner as Grid; if (_Owner != null) { Owner = _Owner; } else { var _Wn = owner as AyWindow; if (_Wn.IsNotNull()) { Owner = _Wn.ayLayerArea; } } } userPresenter.Content = content; ItemContent = content; if (options.LayerId.IsNotNull()) { AYUI.Session[options.LayerId] = this; } if (options.Direction.HasValue) { switch (options.Direction.Value) { case AyLayerDockDirect.LT: body.HorizontalAlignment = HorizontalAlignment.Left; body.VerticalAlignment = VerticalAlignment.Top; break; case AyLayerDockDirect.CT: //中间位置计算 body.HorizontalAlignment = HorizontalAlignment.Center; body.VerticalAlignment = VerticalAlignment.Top; break; case AyLayerDockDirect.RT: //中间位置计算 body.HorizontalAlignment = HorizontalAlignment.Right; body.VerticalAlignment = VerticalAlignment.Top; break; case AyLayerDockDirect.LC: body.HorizontalAlignment = HorizontalAlignment.Left; body.VerticalAlignment = VerticalAlignment.Center; break; case AyLayerDockDirect.CC: body.HorizontalAlignment = HorizontalAlignment.Center; body.VerticalAlignment = VerticalAlignment.Center; break; case AyLayerDockDirect.RC: body.HorizontalAlignment = HorizontalAlignment.Right; body.VerticalAlignment = VerticalAlignment.Center; break; case AyLayerDockDirect.LB: body.HorizontalAlignment = HorizontalAlignment.Left; body.VerticalAlignment = VerticalAlignment.Bottom; break; case AyLayerDockDirect.CB: body.HorizontalAlignment = HorizontalAlignment.Center; body.VerticalAlignment = VerticalAlignment.Bottom; break; case AyLayerDockDirect.RB: body.HorizontalAlignment = HorizontalAlignment.Right; body.VerticalAlignment = VerticalAlignment.Bottom; break; default: break; } } if (options.IsContainsTitleBar) { d.Height = "40.00".ToGridLength(); Border b = new Border(); b.SetResourceReference(Border.BorderBrushProperty, "bordercolorlight"); b.BorderThickness = options.TitleBarBorderThickness; if (options.CanDrag) { SetDragMove(b); } if (options.LayerCornerRadius.HasValue) { b.CornerRadius = new CornerRadius(options.LayerCornerRadius.Value.TopLeft, options.LayerCornerRadius.Value.TopRight, 0, 0); } b.HorizontalAlignment = HorizontalAlignment.Stretch; b.VerticalAlignment = VerticalAlignment.Stretch; Grid g = new Grid(); if (!title.IsNullOrWhiteSpace()) { AyText tb = new AyText(); tb.Width = 200; tb.VerticalAlignment = VerticalAlignment.Center; tb.HorizontalAlignment = HorizontalAlignment.Left; tb.Margin = new Thickness(16, 0, 0, 0); tb.TextWrapping = TextWrapping.NoWrap; tb.SetResourceReference(AyText.FontSizeProperty, "WindowTitleFontSize"); tb.TextTrimming = TextTrimming.CharacterEllipsis; tb.Text = title; g.Children.Add(tb); } if (options.CanClose) { Button ab = new Button(); ab.SetResourceReference(Button.StyleProperty, "AYWin_CLOSE"); ab.Click += closewindow_Click; ab.VerticalAlignment = VerticalAlignment.Center; ab.HorizontalAlignment = HorizontalAlignment.Right; ab.Content = Langs.share_close.Lang(); ab.Width = 32; ab.Height = 32; ab.Margin = new Thickness(0, 0, 5, 0); g.Children.Add(ab); } b.Child = g; b.SetResourceReference(Border.BackgroundProperty, "colorwhite"); bodyConent.Children.Add(b); } else { if (options.TitleBar.IsNotNull() && options.CanDrag) { SetDragMove(options.TitleBar); } } if (options.MaskBrush.IsNotNull()) { layoutMain.Background = options.MaskBrush; } if (isDiaglog) { if (options.MaskBrush.IsNull()) { layoutMain.Background = SolidColorBrushConverter.From16JinZhi("#8C000000"); } if (options.WhenShowDialogNeedShake) { layoutMain.MouseLeftButtonDown += LayoutMain_MouseLeftButtonDown; } } if (options.IsShowLayerBorder) { body.SetResourceReference(Border.BorderBrushProperty, "bordercolorlight"); if (options.LayerBorderThickness.HasValue) { body.BorderThickness = options.LayerBorderThickness.Value; } else { body.BorderThickness = new Thickness(1); } } if (options.LayerCornerRadius.HasValue) { body.CornerRadius = options.LayerCornerRadius.Value; } options.LayerBackground.Freeze(); body.Background = options.LayerBackground; if (options.ShowAnimateIndex == 0) { body.Visibility = Visibility.Visible; if (options.Opened.IsNotNull()) { options.Opened(); } body.Loaded += Body_Loaded; DropShadowEffect de = new DropShadowEffect(); de.Color = options.ShadowColor; de.ShadowDepth = options.ShadowDepth; de.Opacity = 0.1; body.Effect = de; de.BlurRadius = options.ShadowRadius; SetRealPoint(options); } else if (options.ShowAnimateIndex == 1) { var sc = new AyAniScale(body, () => { ShowShadow(options); }); sc.AutoDestory = true; sc.AnimateSpeed = 450; sc.ScaleXFrom = 0; sc.ScaleYFrom = 0; sc.ScaleXTo = 1; sc.ScaleYTo = 1; sc.EasingFunction = new System.Windows.Media.Animation.CubicEase { EasingMode = EasingMode.EaseOut }; sc.Begin(); } else if (options.ShowAnimateIndex == 2) { var sc = new AyAniSlideInDown(body, () => { ShowShadow(options); }); sc.AutoDestory = true; sc.AnimateSpeed = 750; sc.FromDistance = -4000; sc.OpacityNeed = false; sc.EasingFunction = new System.Windows.Media.Animation.CubicEase { EasingMode = EasingMode.EaseOut }; sc.Begin(); } else if (options.ShowAnimateIndex == 3) { var sc = new AyAniSlideInUp(body, () => { ShowShadow(options); }); sc.AutoDestory = true; sc.AnimateSpeed = 750; sc.FromDistance = 4000; sc.OpacityNeed = false; sc.EasingFunction = new System.Windows.Media.Animation.CubicEase { EasingMode = EasingMode.EaseOut }; sc.Begin(); } else if (options.ShowAnimateIndex == 4) { var sc = new AyAniSlideInLeft(body, () => { ShowShadow(options); }); sc.AutoDestory = true; sc.AnimateSpeed = 750; sc.FromDistance = -4000; sc.OpacityNeed = false; sc.EasingFunction = new System.Windows.Media.Animation.CubicEase { EasingMode = EasingMode.EaseOut }; sc.Begin(); } else if (options.ShowAnimateIndex == 5) { var sc = new AyAniSlideInRight(body, () => { ShowShadow(options); }); sc.AutoDestory = true; sc.AnimateSpeed = 750; sc.FromDistance = 4000; sc.OpacityNeed = false; sc.EasingFunction = new System.Windows.Media.Animation.CubicEase { EasingMode = EasingMode.EaseOut }; sc.Begin(); } else if (options.ShowAnimateIndex == 6) { var sc = new AyAniBounceInDown(body, () => { ShowShadow(options); }); sc.AutoDestory = true; sc.Begin(); } else if (options.ShowAnimateIndex == 7) { var sc = new AyAniBounceInUp(body, () => { ShowShadow(options); }); sc.AutoDestory = true; sc.Begin(); } else if (options.ShowAnimateIndex == 8) { var sc = new AyAniBounceInLeft(body, () => { ShowShadow(options); }); sc.AutoDestory = true; sc.Begin(); } else if (options.ShowAnimateIndex == 9) { var sc = new AyAniBounceInRight(body, () => { ShowShadow(options); }); sc.AutoDestory = true; sc.Begin(); } else if (options.ShowAnimateIndex == 10) { var sc = new AyAniRotateIn(body, () => { ShowShadow(options); }); sc.AnimateSpeed = 750; sc.EasingFunction = new System.Windows.Media.Animation.CubicEase { EasingMode = EasingMode.EaseOut }; sc.Begin(); } else if (options.ShowAnimateIndex == 11) { var sc = new AyAniBounceIn(body, () => { ShowShadow(options); }); sc.AutoDestory = true; sc.AnimateSpeed = 750; sc.Begin(); } else if (options.ShowAnimateIndex == 12) { var sc = new AyAniBounceInLeft(body, () => { ShowShadow(options); }); sc.AutoDestory = true; sc.AnimateSpeed = 750; sc.Begin(); } else if (options.ShowAnimateIndex == 13) { var sc = new AyAniBounceInRight(body, () => { ShowShadow(options); }); sc.AutoDestory = true; sc.AnimateSpeed = 750; sc.Begin(); } else if (options.ShowAnimateIndex == 14) { var sc = new AyAniBounceInDown(body, () => { ShowShadow(options); }); sc.AutoDestory = true; sc.AnimateSpeed = 750; sc.Begin(); } else if (options.ShowAnimateIndex == 15) { var sc = new AyAniBounceInUp(body, () => { ShowShadow(options); }); sc.AutoDestory = true; sc.AnimateSpeed = 750; sc.Begin(); } }