Beispiel #1
0
        private static void OnImagePathPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ChatImage target = d as ChatImage;

            if (string.IsNullOrEmpty(target.ImagePath) || !System.IO.File.Exists(target.ImagePath))
            {
                return;
            }
            target.LoadImg();
        }
Beispiel #2
0
        private static void OnMsessageStatePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ChatImage target = d as ChatImage;

            switch (target.State)
            {
            case MessageStates.Fail:
                if (target.DataContext is MessageModel msg)
                {
                    //if (target.messageModel != null)
                    //{
                    if (msg.IsMine)
                    {
                        if (msg.IsSync)
                        {
                            target.pathResend.Visibility = Visibility.Visible;
                            Grid.SetColumn(target.pathResend, 0);
                            target.pathResend.Margin   = new Thickness();
                            target.pathResend.ToolTip  = "重新接收";
                            target.gridFail.Visibility = Visibility.Visible;
                        }
                    }
                    else
                    {
                        target.pathResend.Visibility = Visibility.Visible;
                        Grid.SetColumn(target.pathResend, 2);
                        target.pathResend.Margin   = new Thickness(5);
                        target.pathResend.ToolTip  = "重新接收";
                        target.gridFail.Visibility = Visibility.Visible;
                    }
                }
                //}

                target.aniLoading.Stop();
                target.gridLayout.Children.Remove(target.gridLoading);
                break;

            case MessageStates.Success:
                target.LoadImg();
                break;

            case MessageStates.Loading:
                target.Loading();
                break;

            case MessageStates.Warn:
                if (target.gridLayout.Children.Contains(target.gridLoading))
                {
                    target.gridLayout.Children.Remove(target.gridLoading);
                }
                break;

            case MessageStates.ExpiredFile:
                target.gridLoading.Visibility = Visibility.Collapsed;
                target.gridFail.Visibility    = Visibility.Visible;
                target.tbLoadFail.Visibility  = Visibility.Visible;
                target.gridFail.ToolTip       = "图片已过期";
                target.tbLoadFail.Text        = "图片已过期";
                break;
            }
        }