Exemple #1
0
        /*
         * 查看大图
         *
         * 加载动画
         */
        public static void showAnimation(Border borderBg, Canvas currElement, DControlDto ctl, double toTranslateTransformX, double toTranslateTransformY)
        {
            //淡入
            borderBg.RenderTransformOrigin = new Point(0.5, 0.5);
            DoubleAnimation da = new DoubleAnimation(0, borderBg.Opacity, new Duration(TimeSpan.FromMilliseconds(300)));

            borderBg.BeginAnimation(UIElement.OpacityProperty, da);


            //放大
            TransformGroup  group          = (TransformGroup)currElement.RenderTransform;
            ScaleTransform  scaleTransform = TransformGroupUtil.GetScaleTransform(group);
            DoubleAnimation da1            = new DoubleAnimation(scaleTransform.ScaleX, 1.0, new Duration(TimeSpan.FromMilliseconds(300)));

            scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, da1);
            DoubleAnimation da2 = new DoubleAnimation(scaleTransform.ScaleY, 1.0, new Duration(TimeSpan.FromMilliseconds(300)));

            scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, da2);


            // 平移
            TranslateTransform translateTransform = TransformGroupUtil.GetTranslateTransform(group);
            DoubleAnimation    da3 = new DoubleAnimation(0, toTranslateTransformX, new Duration(TimeSpan.FromMilliseconds(300)));

            translateTransform.BeginAnimation(TranslateTransform.XProperty, da3);
            DoubleAnimation da4 = new DoubleAnimation(0, toTranslateTransformY, new Duration(TimeSpan.FromMilliseconds(300)));

            translateTransform.BeginAnimation(TranslateTransform.YProperty, da4);
        }
        /*
         * 12 Gif
         */
        public static Gif newGif(DControl ctl, StorageGif storageGif, Boolean isDesign)
        {
            string imgPath     = FileUtil.notExistsShowDefault(storageGif?.url, Params.GifNotExists);
            string imgFullPath = AppDomain.CurrentDomain.BaseDirectory + imgPath;

            DControlDto dto = DControlUtil.convert(ctl);

            dto.url = imgFullPath;
            Gif gif = new Gif(imgPath, isDesign);

            gif.HorizontalAlignment = HorizontalAlignment.Left;
            gif.VerticalAlignment   = VerticalAlignment.Top;
            gif.Margin     = new Thickness(ctl.left, ctl.top, 0, 0);
            gif.Width      = ctl.width;
            gif.Height     = ctl.height;
            gif.Background = Brushes.Transparent;

            gif.Opacity = ctl.opacity / 100.0;
            Panel.SetZIndex(gif, ctl.idx);
            gif.Focusable = false;
            gif.Tag       = dto;
            TransformGroup group = new TransformGroup();

            gif.RenderTransform       = group;
            gif.RenderTransformOrigin = new Point(0.5, 0.5);
            RotateTransform rotateTransform = TransformGroupUtil.GetRotateTransform(group);

            rotateTransform.Angle = ctl.rotateAngle;
            gif.Visibility        = Visibility.Visible;
            return(gif);
        }
        /*
         * 关闭视频
         *
         * 动画,回到原位,移除大图
         */
        private void closeVideoAnimation(Canvas fullVideoCanvas, DControlDto dControlDto, CVideo cVideo)
        {
            //1.淡出
            DoubleAnimation da = new DoubleAnimation(fullVideoCanvas.Opacity, 0, new Duration(TimeSpan.FromMilliseconds(100)));

            da.BeginTime = TimeSpan.FromMilliseconds(200);
            fullVideoCanvas.BeginAnimation(UIElement.OpacityProperty, da);

            //触摸缩放后
            double         backToScaleX = dControlDto.width / fullVideoCanvas.Width;
            double         backToScaleY = dControlDto.height / fullVideoCanvas.Height;
            Transform      transform    = fullVideoCanvas.RenderTransform;
            TransformGroup group        = (TransformGroup)fullVideoCanvas.RenderTransform;

            //2.缩放
            ScaleTransform  scaleTransform = TransformGroupUtil.GetScaleTransform(group);
            DoubleAnimation da1            = new DoubleAnimation(scaleTransform.ScaleX, backToScaleX, new Duration(TimeSpan.FromMilliseconds(300)));

            scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, da1);
            DoubleAnimation da2 = new DoubleAnimation(scaleTransform.ScaleY, backToScaleY, new Duration(TimeSpan.FromMilliseconds(300)));

            scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, da2);


            // 3.平移
            TranslateTransform translateTransform = TransformGroupUtil.GetTranslateTransform(group);
            DoubleAnimation    da3 = new DoubleAnimation(translateTransform.X, 0, new Duration(TimeSpan.FromMilliseconds(300)));

            translateTransform.BeginAnimation(TranslateTransform.XProperty, da3);
            DoubleAnimation da4 = new DoubleAnimation(translateTransform.Y, 0, new Duration(TimeSpan.FromMilliseconds(300)));

            da4.Completed += (sender, e) => closeVideoAnimation_Completed(fullVideoCanvas, cVideo, dControlDto);
            translateTransform.BeginAnimation(TranslateTransform.YProperty, da4);
        }
        public void ClickShowWeb(DControlDto ctl)
        {
            Int32  maxPagePercent = FrameUtil.getMaxPercent(App.localStorage.cfg.screenWidth, App.localStorage.cfg.screenHeight);
            double screenWidth    = SystemParameters.PrimaryScreenWidth;//得到屏幕整体宽度

            Cfg pageCfg   = PageWidthUtil.getPageCfg(dPage, App.localStorage.cfg);
            int winWidth  = (int)(pageCfg.screenWidth * maxPagePercent / 100);
            int winHeight = (int)(pageCfg.screenHeight * maxPagePercent / 100);

            App.localStorage.currForm1 = new Form1(winWidth, winHeight, ctl.linkToWeb, screenWidth);
            App.localStorage.currForm1.ShowDialog();


            //Int32 maxPagePercent = FrameUtil.getMaxPercent(App.localStorage.cfg.screenWidth, App.localStorage.cfg.screenHeight);
            //double screenWidth = SystemParameters.PrimaryScreenWidth;//得到屏幕整体宽度

            //Cfg pageCfg = PageWidthUtil.getPageCfg(dPage, App.localStorage.cfg);
            //int winWidth = (int)(pageCfg.screenWidth * maxPagePercent / 100);
            //int winHeight = (int)(pageCfg.screenHeight * maxPagePercent / 100);
            //App.localStorage.currForm1 = new Form1(winWidth, winHeight, ctl.linkToWeb, screenWidth);
            //App.localStorage.currForm1.Left = 500;
            //App.localStorage.currForm1.Top = pageTemplate1.screen.Bounds.Top;
            //App.localStorage.currForm1.Show();
            //App.localStorage.currForm1.BringToFront();

            //App.localStorage.currForm1.Click += currForm1_Click;
        }
        /*
         * 7.1 单击gif跳转
         *
         * 1.单击图片跳转到页面
         *
         * 2.跳转到外部网站
         *
         * 3.单击图片全屏播放视频
         *
         * 4.单击图片放大
         *
         *
         */
        private void gifFun(object sender)
        {
            Gif         gif = (Gif)sender;
            DControlDto ctl = (DControlDto)gif.Tag;

            this.DifferentScreenDifferentLinkTo(ctl);
            if (!string.IsNullOrWhiteSpace(ctl.linkToWeb))
            {
                Int32  pagePercent = FrameUtil.getMaxPercent(App.localStorage.cfg.screenWidth, App.localStorage.cfg.screenHeight);
                double screenWidth = SystemParameters.PrimaryScreenWidth;//得到屏幕整体宽度
                int    winWidth    = (int)(App.localStorage.cfg.screenWidth * pagePercent / 100);
                int    winHeight   = (int)(App.localStorage.cfg.screenHeight * pagePercent / 100);

                App.localStorage.currForm1 = new Form1(winWidth, winHeight, ctl.linkToWeb, screenWidth);
                App.localStorage.currForm1.ShowDialog();
            }
            else if (ctl.linkToVideoId > 0)
            {
                insertFullVideoToPage(ctl);
            }
            else if (ctl.isClickShow)
            {
                int frameWidth  = App.localStorage.cfg.screenWidth;
                int frameHeight = App.localStorage.cfg.screenHeight;
                if (dPage.width > 0)
                {
                    frameWidth = dPage.width;
                }
                if (dPage.height > 0)
                {
                    frameHeight = dPage.height;
                }

                Cfg cfg = new Cfg();
                cfg.screenWidth  = frameWidth;
                cfg.screenHeight = frameHeight;

                StorageGif storageGif = storageGifBll.get(ctl.storageId);
                if (storageGif == null)
                {  //默认gif
                    storageGif              = new StorageGif();
                    storageGif.id           = 0;
                    storageGif.url          = Params.GifNotExists;
                    storageGif.actualWidth  = 550;
                    storageGif.actualHeight = 400;
                    storageGif.ext          = ".gif";
                    storageGif.origFilename = "gif.gif";
                    storageGif.size         = 304874;
                    storageGif.folderId     = 1;
                }

                ShowBigGifUtil.showBigImage(storageGif, ctl, mainContainer, cfg);
            }
        }
        public static DControlDto convert(DControl dControl)
        {
            DControlDto dto = new DControlDto();

            dto.id      = dControl.id;
            dto.pageId  = dControl.pageId;
            dto.name    = dControl.name;
            dto.width   = dControl.width;
            dto.height  = dControl.height;
            dto.left    = dControl.left;
            dto.top     = dControl.top;
            dto.type    = dControl.type;
            dto.content = dControl.content;
            dto.idx     = dControl.idx;

            dto.linkToPageId           = dControl.linkToPageId;
            dto.isClickShow            = dControl.isClickShow;
            dto.linkToVideoId          = dControl.linkToVideoId;
            dto.autoplay               = dControl.autoplay;
            dto.loop                   = dControl.loop;
            dto.turnPictureSpeed       = dControl.turnPictureSpeed;
            dto.linkToWeb              = dControl.linkToWeb;
            dto.storageId              = dControl.storageId;
            dto.isShowTurnPictureArrow = dControl.isShowTurnPictureArrow;

            dto.opacity                       = dControl.opacity;
            dto.parentId                      = dControl.parentId;
            dto.contentWidth                  = dControl.contentWidth;
            dto.contentHeight                 = dControl.contentHeight;
            dto.backgroundImageId             = dControl.backgroundImageId;
            dto.isTab                         = dControl.isTab;
            dto.rowNum                        = dControl.rowNum;
            dto.spacing                       = dControl.spacing;
            dto.rotateAngle                   = dControl.rotateAngle;
            dto.isDialogLink                  = dControl.isDialogLink;
            dto.showInWhichCFrame             = dControl.showInWhichCFrame;
            dto.isTransparentDialog           = dControl.isTransparentDialog;
            dto.fontFamily                    = dControl.fontFamily;
            dto.fontSize                      = dControl.fontSize;
            dto.fontLineHeight                = dControl.fontLineHeight;
            dto.fontColor                     = dControl.fontColor;
            dto.fontWeight                    = dControl.fontWeight;
            dto.fontTextAlignment             = dControl.fontTextAlignment;
            dto.storageIdOfCover              = dControl.storageIdOfCover;
            dto.screenCfgId                   = dControl.screenCfgId;
            dto.isHideVideoConsoleOfFirstLoad = dControl.isHideVideoConsoleOfFirstLoad;
            return(dto);
        }
        /*
         *  3.1 委托事件处理程序,链接到
         *
         *  相册、层叠相册、流动相册
         *
         */
        public void TurnPictureItemFun(TurnPictureImagesDto dto, double width, double height, Point point, int pageId)
        {
            if (dto == null)
            {
                return;
            }
            //当前主控件 相册  层叠相册  流动相册
            DControl mainDControl = dControlBll.get(dto.dControlId);

            if (mainDControl == null)
            {
                return;
            }


            DControlDto dControlDto = new DControlDto();

            dControlDto.id     = dto.id;
            dControlDto.width  = Convert.ToInt32(width);
            dControlDto.height = Convert.ToInt32(height);
            dControlDto.left   = Convert.ToInt32(point.X);
            dControlDto.top    = Convert.ToInt32(point.Y);
            dControlDto.pageId = pageId;


            this.DifferentScreenDifferentLinkTo(dControlDto, dto.id);

            if (mainDControl.isClickShow)
            {
                int frameWidth  = App.localStorage.cfg.screenWidth;
                int frameHeight = App.localStorage.cfg.screenHeight;
                if (dPage.width > 0)
                {
                    frameWidth = dPage.width;
                }
                if (dPage.height > 0)
                {
                    frameHeight = dPage.height;
                }

                Cfg cfg = new Cfg();
                cfg.screenWidth  = frameWidth;
                cfg.screenHeight = frameHeight;

                ShowBigImageUtil.showBigImage(dto.url, dControlDto, mainContainer, cfg);
            }
        }
        /*
         * 1 插入图片
         */
        public static Button newImage(DControl ctl, StorageImage storageImage)
        {
            string      imgFullPath = FileUtil.notExistsShowDefault(storageImage?.url, Params.ImageNotExists);
            DControlDto dto         = DControlUtil.convert(ctl);

            dto.url = imgFullPath;


            Button imageButton = new Button();

            imageButton.Name    = ctl.type + dto.id;
            imageButton.Content = ctl.content;
            //imageButton.Background = new ImageBrush
            //{
            //    ImageSource = FileUtil.readImage2(AppDomain.CurrentDomain.BaseDirectory + imgFullPath, ctl.width)
            //    ,
            //    Stretch = Stretch.Fill
            //};
            imageButton.Background = Brushes.Transparent;
            FileUtil.readImage2Button(imageButton, AppDomain.CurrentDomain.BaseDirectory + imgFullPath, ctl.width, Stretch.Fill);
            imageButton.BorderThickness     = new Thickness(0);
            imageButton.Margin              = new Thickness(ctl.left, ctl.top, 0, 0);
            imageButton.Width               = ctl.width;
            imageButton.Height              = ctl.height;
            imageButton.HorizontalAlignment = HorizontalAlignment.Left;
            imageButton.VerticalAlignment   = VerticalAlignment.Top;
            imageButton.Opacity             = ctl.opacity / 100.0;
            Panel.SetZIndex(imageButton, ctl.idx);
            imageButton.Tag       = dto;
            imageButton.Focusable = false;


            TransformGroup  group           = new TransformGroup();
            RotateTransform rotateTransform = TransformGroupUtil.GetRotateTransform(group);

            rotateTransform.Angle             = ctl.rotateAngle;
            imageButton.RenderTransform       = group;
            imageButton.RenderTransformOrigin = new Point(0.5, 0.5);

            return(imageButton);
        }
        /*
         * 1.1 单击图片事件
         *
         * 1.链接到页面
         *
         * 2.跳转到外部网站
         *
         * 3.全屏播放视频
         *
         * 4.查看大图
         *
         *
         */
        public void imageButtonClick(object sender, RoutedEventArgs e)
        {
            Button imageButton = (Button)sender;

            imageButton.IsEnabled = false;
            DControlDto ctl = (DControlDto)imageButton.Tag;

            this.DifferentScreenDifferentLinkTo(ctl);


            if (!string.IsNullOrWhiteSpace(ctl.linkToWeb))
            {
                pageTemplate1.insertToPage.ClickShowWeb(ctl);
            }
            else if (ctl.linkToVideoId > 0)
            {
                pageTemplate1.insertToPage.insertFullVideoToPage(ctl);
            }
            else if (ctl.isClickShow)
            {
                pageTemplate1.insertToPage.ClickShowBigImage(ctl);
            }
            imageButton.IsEnabled = true;
        }
Exemple #10
0
 /*
  * 单击关闭图片
  */
 private static void imageCloseBtnClick(Canvas bigImageCanvas, Border borderBg, Canvas innerCanvas, DControlDto ctl, Grid mainContainer)
 {
     closeAnimation(bigImageCanvas, borderBg, innerCanvas, ctl, mainContainer);
 }
Exemple #11
0
        /*
         * 显示大图
         */
        public static void showBigImage(string imagePath, DControlDto ctl, Grid mainContainer, Cfg cfg)
        {
            FrameworkElement bigImageElement = FrameworkElementUtil.getByName(mainContainer, "bigImageCanvas");

            if (bigImageElement == null)
            {
                Canvas bigImageCanvas = new Canvas();
                bigImageCanvas.Name       = "bigImageCanvas";
                bigImageCanvas.Width      = cfg.screenWidth;
                bigImageCanvas.Height     = cfg.screenHeight;
                bigImageCanvas.Background = Brushes.Transparent;
                Panel.SetZIndex(bigImageCanvas, 10002);

                //图片背景,点击隐藏
                Border borderBg = new Border();
                borderBg.Width               = cfg.screenWidth;
                borderBg.Height              = cfg.screenHeight;
                borderBg.Background          = Brushes.Black;
                borderBg.Opacity             = 0.6;
                borderBg.HorizontalAlignment = HorizontalAlignment.Left;
                borderBg.VerticalAlignment   = VerticalAlignment.Top;
                borderBg.SetValue(Canvas.LeftProperty, 0.0);
                borderBg.SetValue(Canvas.TopProperty, 0.0);
                Panel.SetZIndex(borderBg, 1);
                bigImageCanvas.Children.Add(borderBg);



                //显示大图
                double      maxWidth    = cfg.screenWidth * 0.9;
                double      maxHeight   = cfg.screenHeight * 0.9;
                string      img         = FileUtil.notExistsShowDefault(imagePath, Params.ImageNotExists);
                BitmapImage bitmapImage = FileUtil.readImage(AppDomain.CurrentDomain.BaseDirectory + img);
                double      showWidth   = bitmapImage.Width;
                double      showHeight  = bitmapImage.Height;
                double      w           = bitmapImage.Width / maxWidth;
                double      h           = bitmapImage.Height / maxHeight;
                if (w > 1 && h > 1)
                {
                    if (w > h)
                    {
                        showWidth  = maxWidth;
                        showHeight = bitmapImage.Height / w;
                    }
                    else
                    {
                        showHeight = maxHeight;
                        showWidth  = bitmapImage.Width / h;
                    }
                }
                else if (w > 1)
                {
                    showWidth  = maxWidth;
                    showHeight = bitmapImage.Height / w;
                }
                else if (h > 1)
                {
                    showHeight = maxHeight;
                    showWidth  = bitmapImage.Width / h;
                }

                Canvas innerCanvas = new Canvas();
                innerCanvas.Width  = showWidth;
                innerCanvas.Height = showHeight;
                double left = ctl.left;
                double top  = ctl.top;
                innerCanvas.SetValue(Canvas.LeftProperty, left);
                innerCanvas.SetValue(Canvas.TopProperty, top);
                Panel.SetZIndex(innerCanvas, 2);


                Image image = new Image();
                image.Source = bitmapImage;
                image.Width  = showWidth;
                image.Height = showHeight;
                Panel.SetZIndex(image, 1);
                innerCanvas.Children.Add(image);

                Button closebtn = new Button();
                closebtn.Background = new ImageBrush
                {
                    ImageSource = FileUtil.readImage(AppDomain.CurrentDomain.BaseDirectory + "/myfile/sysimg/ico-image-close.png")
                    ,
                    Stretch = Stretch.Fill
                };

                closebtn.Width               = 50;
                closebtn.Height              = 50;
                closebtn.BorderThickness     = new Thickness(0);
                closebtn.HorizontalAlignment = HorizontalAlignment.Right;
                closebtn.VerticalAlignment   = VerticalAlignment.Top;
                closebtn.SetValue(Canvas.RightProperty, -25.0);
                closebtn.SetValue(Canvas.TopProperty, -25.0);
                Panel.SetZIndex(closebtn, 2);

                closebtn.Click            += (sender, e) => imageCloseBtnClick(bigImageCanvas, borderBg, innerCanvas, ctl, mainContainer);
                closebtn.PreviewTouchDown += imageCloseBtnTouchDown;
                closebtn.PreviewTouchMove += imageCloseBtnTouchMove;
                closebtn.PreviewTouchUp   += (sender, e) => imageCloseBtnClick(bigImageCanvas, borderBg, innerCanvas, ctl, mainContainer);
                innerCanvas.Children.Add(closebtn);


                bigImageCanvas.Children.Add(innerCanvas);
                borderBg.PreviewMouseUp += (sender, e) => imageCloseBtnClick(bigImageCanvas, borderBg, innerCanvas, ctl, mainContainer);
                borderBg.PreviewTouchUp += (sender, e) => imageCloseBtnClick(bigImageCanvas, borderBg, innerCanvas, ctl, mainContainer);

                //手指缩放 移动 旋转
                BehaviorCollection          behaviors = Interaction.GetBehaviors(innerCanvas);
                TranslateZoomRotateBehavior tz        = new TranslateZoomRotateBehavior();
                tz.TranslateFriction       = 0.3;
                tz.RotationalFriction      = 0.4;
                tz.ConstrainToParentBounds = true;
                tz.SupportedGestures       = ManipulationModes.All;
                behaviors.Add(tz);

                TransformGroup group          = new TransformGroup();
                double         scaleX         = ctl.width / innerCanvas.Width;
                double         scaleY         = ctl.height / innerCanvas.Height;
                ScaleTransform scaleTransform = new ScaleTransform();
                scaleTransform.ScaleX = scaleX;
                scaleTransform.ScaleY = scaleY;
                group.Children.Add(scaleTransform);
                innerCanvas.RenderTransform = group;

                //动画,平移到指定位置
                double toLeft = (cfg.screenWidth - innerCanvas.Width) / 2;
                double toTop  = (cfg.screenHeight - innerCanvas.Height) / 2;
                double toTranslateTransformX = toLeft - ctl.left;
                double toTranslateTransformY = toTop - ctl.top;

                ShowBigImageUtil.showAnimation(borderBg, innerCanvas, ctl, toTranslateTransformX, toTranslateTransformY);

                mainContainer.Children.Add(bigImageCanvas);
            }
        }
Exemple #12
0
        /*
         * 关闭大图
         *
         * 动画,回到原位,移除大图
         */
        public static void closeAnimation(Canvas bigImageCanvas, Border borderBg, Canvas innerCanvas, DControlDto ctl, Grid mainContainer)
        {
            //1.淡出
            borderBg.RenderTransformOrigin = new Point(0.5, 0.5);
            DoubleAnimation da = new DoubleAnimation(borderBg.Opacity, 0, new Duration(TimeSpan.FromMilliseconds(300)));

            borderBg.BeginAnimation(UIElement.OpacityProperty, da);

            //触摸缩放后
            double backToScaleX = ctl.width / innerCanvas.Width;
            double backToScaleY = ctl.height / innerCanvas.Height;

            Transform      transform = innerCanvas.RenderTransform;
            TransformGroup group     = null;

            if (transform is TransformGroup)
            {
                group = (TransformGroup)innerCanvas.RenderTransform;
            }
            else
            {
                group = new TransformGroup();
                TranslateTransform translateTransform1 = new TranslateTransform();
                MatrixTransform    matrixTransform     = (MatrixTransform)innerCanvas.RenderTransform;
                translateTransform1.X = matrixTransform.Matrix.OffsetX;
                translateTransform1.Y = matrixTransform.Matrix.OffsetY;
                group.Children.Add(translateTransform1);

                ScaleTransform scaleTransform1 = new ScaleTransform();
                scaleTransform1.ScaleX = matrixTransform.Matrix.M11;
                scaleTransform1.ScaleY = matrixTransform.Matrix.M22;
                group.Children.Add(scaleTransform1);

                innerCanvas.RenderTransform = group;
            }
            //2.缩放
            ScaleTransform  scaleTransform = TransformGroupUtil.GetScaleTransform(group);
            DoubleAnimation da1            = new DoubleAnimation(scaleTransform.ScaleX, backToScaleX, new Duration(TimeSpan.FromMilliseconds(300)));

            scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, da1);
            DoubleAnimation da2 = new DoubleAnimation(scaleTransform.ScaleY, backToScaleY, new Duration(TimeSpan.FromMilliseconds(300)));

            scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, da2);


            // 3.平移
            TranslateTransform translateTransform = TransformGroupUtil.GetTranslateTransform(group);
            DoubleAnimation    da3 = new DoubleAnimation(translateTransform.X, 0, new Duration(TimeSpan.FromMilliseconds(300)));

            translateTransform.BeginAnimation(TranslateTransform.XProperty, da3);
            DoubleAnimation da4 = new DoubleAnimation(translateTransform.Y, 0, new Duration(TimeSpan.FromMilliseconds(300)));

            da4.Completed += (sender, e) => closeBigImageAnimation_Completed(bigImageCanvas, mainContainer);
            translateTransform.BeginAnimation(TranslateTransform.YProperty, da4);
        }
 private void closeVideoAnimation_Completed(Canvas fullVideoCanvas, CVideo cVideo, DControlDto dto)
 {
     pageTemplate1.mqServer.SendMsg(new VideoControlMessage(dto.id, "fullScreenExit"));
     pageTemplate1.mqServer.SendMsg(new VideoControlMessage(dto.id, "pause"));
     cVideo = null;
     pageTemplate1.container.Children.Remove(fullVideoCanvas);
 }
        /*
         *  1.4 链接到全屏视频
         */
        public void insertFullVideoToPage(DControlDto dControlDto)
        {
            StorageVideo storageVideo = storageVideoBll.get(dControlDto.linkToVideoId);


            int frameWidth  = App.localStorage.cfg.screenWidth;
            int frameHeight = App.localStorage.cfg.screenHeight;

            if (dPage.width > 0)
            {
                frameWidth = dPage.width;
            }
            if (dPage.height > 0)
            {
                frameHeight = dPage.height;
            }
            Cfg cfg = new Cfg();

            cfg.screenWidth  = frameWidth;
            cfg.screenHeight = frameHeight;


            if (storageVideo == null)
            {
                storageVideo              = new StorageVideo();
                storageVideo.url          = "/myfile/sysimg/notExists/video.mp4";
                storageVideo.origFilename = "演示视频.mp4";
            }
            StorageVideoDto dto          = StorageVideoUtil.convert(storageVideo);
            StorageImage    storageImage = storageImageBll.get(dto.storageImageId);

            dto.storageImageUrl = storageImage?.url;

            DControl ctl = new DControl();

            ctl.id               = 10003;
            ctl.pageId           = 0;
            ctl.name             = "cVideo";
            ctl.width            = cfg.screenWidth;
            ctl.height           = cfg.screenHeight;
            ctl.left             = 0;
            ctl.top              = 0;
            ctl.type             = "Video";
            ctl.content          = FileUtil.getFilenameTitle(storageVideo?.origFilename);
            ctl.idx              = 0; /////
            ctl.linkToPageId     = 0;
            ctl.isClickShow      = false;
            ctl.linkToVideoId    = 0;
            ctl.autoplay         = true;
            ctl.loop             = false;
            ctl.turnPictureSpeed = 0;
            ctl.storageId        = storageVideo.id;


            Canvas fullVideoCanvas = new Canvas();

            fullVideoCanvas.Name   = "fullVideoCanvas";
            fullVideoCanvas.Width  = ctl.width;
            fullVideoCanvas.Height = ctl.height;
            fullVideoCanvas.HorizontalAlignment = HorizontalAlignment.Left;
            fullVideoCanvas.VerticalAlignment   = VerticalAlignment.Top;
            TransformGroup group          = new TransformGroup();
            double         scaleX         = dControlDto.width / Convert.ToDouble(ctl.width);
            double         scaleY         = dControlDto.height / Convert.ToDouble(ctl.height);
            ScaleTransform scaleTransform = new ScaleTransform();

            scaleTransform.ScaleX = scaleX;
            scaleTransform.ScaleY = scaleY;
            group.Children.Add(scaleTransform);
            fullVideoCanvas.RenderTransform = group;
            double left = dControlDto.left;
            double top  = dControlDto.top;

            fullVideoCanvas.Margin = new Thickness(left, top, 0, 0);
            Panel.SetZIndex(fullVideoCanvas, 10003);

            CVideo cVideo = new CVideo(ctl, true, cfg, dto, pageTemplate1.mqServer, true);

            cVideo.Name = "cVideo";
            cVideo.HorizontalAlignment = HorizontalAlignment.Left;
            cVideo.VerticalAlignment   = VerticalAlignment.Top;
            cVideo.Width      = ctl.width;
            cVideo.Height     = ctl.height;
            cVideo.Background = null;
            cVideo.Tag        = ctl;


            //动画,平移到指定位置
            double toTranslateTransformX = 0 - dControlDto.left;
            double toTranslateTransformY = 0 - dControlDto.top;

            fullVideoCanvas.Children.Add(cVideo);
            AnimationUtil.loadFullVideo(fullVideoCanvas, toTranslateTransformX, toTranslateTransformY);


            pageTemplate1.container.Children.Add(fullVideoCanvas);

            //是否显示关闭按钮
            Button closebtn = cVideo.GetClosebtn();

            closebtn.Visibility = Visibility.Visible;
            closebtn.Tag        = true;
            closebtn.Click     += (object sender, RoutedEventArgs e) => closeVideoAnimation(fullVideoCanvas, dControlDto, cVideo);
        }
        public void ClickShowBigImage(DControlDto ctl)
        {
            Cfg pageCfg = PageWidthUtil.getPageCfg(dPage, App.localStorage.cfg);

            ShowBigImageUtil.showBigImage(ctl.url, ctl, mainContainer, pageCfg);
        }