Пример #1
0
//        private void HideLoading()
//        {
//            var myBrush = new SolidColorBrush();
//            var myColorAnimation = new ColorAnimation
//            {
//                From = Colors.White,
//                To = Colors.Transparent,
//                Duration = new Duration(TimeSpan.FromMilliseconds(1000)),
//                AutoReverse = false
//            };
//            myColorAnimation.Completed += MyColorAnimation_Completed;
//
//            myBrush.BeginAnimation(SolidColorBrush.ColorProperty, myColorAnimation, HandoffBehavior.Compose);
//
//            ScreenLoading.Foreground = myBrush;
//        }


//        private void HideLabel(Label label)
//        {
//            Client.StartAction(async () =>
//            {
//                await Task.Delay(TimeSpan.FromMilliseconds(3 * 1000));
//                Dispatcher.Invoke(() =>
//                {
//                    var myBrush = new SolidColorBrush();
//                    // ScreenLoading.IsActive = false;
//                    var myColorAnimation = new ColorAnimation
//                    {
//                        From = ((SolidColorBrush) label.Foreground).Color,
//                        To = Colors.Transparent,
//                        Duration = new Duration(TimeSpan.FromMilliseconds(1000)),
//                        AutoReverse = false
//                    };
//                    myColorAnimation.Completed += delegate { LogPanel.Children.Remove(label); };
//                    myBrush.BeginAnimation(SolidColorBrush.ColorProperty, myColorAnimation, HandoffBehavior.Compose);
//                    label.Foreground = myBrush;
//                });
//            });
//        }

        public void AddLabel(string msg, Color color)
        {
            OnShowLog?.Invoke(this, msg, color);
//            Dispatcher.Invoke(() =>
//            {
//                if (IsShowLog)
//                {
//                    var label = new Label
//                    {
//                        Content = msg,
//                        Effect = new DropShadowEffect
//                        {
//                            Color = Colors.Black,
//                            Direction = 300,
//                            ShadowDepth = 1,
//                            BlurRadius = 0,
//                            Opacity = 1
//                        },
//                        FontSize = 14,
//                        Foreground = new SolidColorBrush(color),
//                        Style = null
//                    };
//                    LogPanel.Children.Add(label);
//                    HideLabel(label);
//                }
//            });
        }
Пример #2
0
 /// <summary>
 /// 添加日志
 /// </summary>
 /// <param name="msg"></param>
 /// <param name="color"></param>
 public void AddLabel(string msg, Color color)
 {
     OnShowLog?.Invoke(this, msg, color);
 }