/* * 插入日期 */ internal void insertCAudioToPage(DControl ctl) { string audioUrl = Params.CAudioNotExists; if (ctl.storageId > 0) { StorageFile storageFile = storageFileBll.get(ctl.storageId); audioUrl = storageFile?.url; } string audioCoverUrl = Params.CAudioImageNotExists; if (ctl.storageIdOfCover > 0) { StorageImage storageImage = storageImageBll.get(ctl.storageIdOfCover); audioCoverUrl = storageImage?.url; } CAudio cAudio = NewControlUtil.newCAudio(ctl, pageTemplate.dPage, App.localStorage.cfg, audioUrl, audioCoverUrl, pageTemplate.mqServer); cAudio.Style = pageTemplate.container.TryFindResource("CAudioStyle") as System.Windows.Style; //控件拖动 cAudio.PreviewMouseLeftButtonDown += control_MouseDown; cAudio.PreviewMouseMove += control_MouseMove; cAudio.PreviewMouseLeftButtonUp += control_MouseUp; //控件上右击显示菜单 cAudio.MouseRightButtonUp += control_MouseRightButtonUp; pageTemplate.container.Children.Add(cAudio); }
/* * 3.3插入层叠相册 */ public void insertMarqueLayerToPage(DControl ctl) { List <TurnPictureImagesDto> list = turnPictureImagesBll.getByDControlId(ctl.id); //如果storageImageId=0,则显示替代的Params.TurnPictureNotExists[i] for (int i = 0; i < list.Count; i++) { TurnPictureImagesDto dto = list[i]; if (dto == null) { list.Remove(dto); } string imgNotExists = Params.ImageNotExists; if (i < 6 && dto.storageImageId == 0) { imgNotExists = Params.TurnPictureNotExists[i]; } string imgFullPath = FileUtil.notExistsShowDefault(dto.url, imgNotExists); dto.url = imgFullPath; } MarqueLayer marqueLayer = NewControlUtil.newMarqueLayer(ctl, list, true); System.Windows.Style myStyle = (System.Windows.Style)pageTemplate.container.FindResource("DefaultMarqueLayerStyle"); marqueLayer.Style = myStyle; marqueLayer.PreviewMouseLeftButtonDown += control_MouseDown; marqueLayer.PreviewMouseMove += control_MouseMove; marqueLayer.PreviewMouseLeftButtonUp += control_MouseUp; //控件上右击显示菜单 marqueLayer.MouseRightButtonUp += control_MouseRightButtonUp; pageTemplate.container.Children.Add(marqueLayer); }
/* * 3.4插入视频 Video */ public void insertVideoToPage(DControl ctl) { //获取视频所在的集合 StorageVideo storageVideo = storageVideoBll.get(ctl.storageId); 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; Cfg pageCfg = PageWidthUtil.getPageCfg(pageTemplate.dPage, App.localStorage.cfg); CVideo cVideo = NewControlUtil.newCVideo(ctl, dto, pageCfg, pageTemplate.mqServer, true); System.Windows.Style myStyle = (System.Windows.Style)pageTemplate.container.FindResource("DefaultCVideoStyle"); cVideo.Style = myStyle; cVideo.PreviewMouseLeftButtonDown += control_MouseDown; cVideo.PreviewMouseMove += control_MouseMove; cVideo.PreviewMouseLeftButtonUp += control_MouseUp; //控件上右击显示菜单 cVideo.MouseRightButtonUp += control_MouseRightButtonUp; pageTemplate.container.Children.Add(cVideo); }
/* * 3.4插入视频 Video */ public void insertVideoToPage(DControl ctl) { //获取视频所在的集合 StorageVideo storageVideo = storageVideoBll.get(ctl.storageId); 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; //foreach (Window win in App.appWindowList) //{ // string type = win.GetType().Name; // Console.WriteLine("窗口类型:" + type); //} Cfg pageCfg = PageWidthUtil.getPageCfg(dPage, App.localStorage.cfg); CVideo cVideo = NewControlUtil.newCVideo(ctl, dto, pageCfg, pageTemplate1.mqServer, false); loadAllAnimation(cVideo, ctl); mainContainer.Children.Add(cVideo); }
/* * 3.3插入层叠相册 */ public void insertMarqueLayerToPage(DControl ctl) { List <TurnPictureImagesDto> list = turnPictureImagesBll.getByDControlId(ctl.id); for (int i = 0; i < list.Count; i++) { TurnPictureImagesDto dto = list[i]; if (dto == null) { list.Remove(dto); } string imgNotExists = Params.ImageNotExists; if (i < 6 && dto.storageImageId == 0) { imgNotExists = Params.TurnPictureNotExists[i]; } string imgFullPath = FileUtil.notExistsShowDefault(dto.url, imgNotExists); dto.url = imgFullPath; } MarqueLayer marqueLayer = NewControlUtil.newMarqueLayer(ctl, list, false); loadAllAnimation(marqueLayer, ctl); mainContainer.Children.Add(marqueLayer); marqueLayer.MarqueLayerItemEvent += new MarqueLayerItemHandler(TurnPictureItemFun); }
/* * 3.2插入日期 */ public void insertCCalendarToPage(DControl ctl) { CCalendar cCalendar = NewControlUtil.newCCalendar(ctl, dPage, App.localStorage.cfg); loadAllAnimation(cCalendar, ctl); mainContainer.Children.Add(cCalendar); cCalendar.Visibility = Visibility.Visible; }
/* * 3.2插入一行文字 */ public void insertTextBlockToPage(DControl ctl) { TextBlock textBlock = NewControlUtil.newTextBlock(ctl); loadAllAnimation(textBlock, ctl); textBlock.PreviewMouseUp += textBlock_PreviewMouseUp; textBlock.PreviewTouchUp += textBlock_PreviewTouchUp; mainContainer.Children.Add(textBlock); }
internal void insertHomeButtonToPage(DControl ctl) { StorageImage storageImage = storageImageBll.get(ctl.storageId); Button imageButton = NewControlUtil.newHomeButton(ctl, storageImage); loadAllAnimation(imageButton, ctl); imageButton.Click += homeButtonClick; mainContainer.Children.Add(imageButton); }
/* * 3.2插入一行文字 */ public void insertGifToPage(DControl ctl) { StorageGif storageGif = storageGifBll.get(ctl.storageId); Gif gif = NewControlUtil.newGif(ctl, storageGif, false); loadAllAnimation(gif, ctl); gif.PreviewMouseUp += gif_PreviewMouseUp; gif.PreviewTouchUp += gif_PreviewTouchUp; mainContainer.Children.Add(gif); }
/* * 3.2插入Word */ public void insertWordToPage(DControl ctl) { StorageFile storageFile = storageFileBll.get(ctl.storageId); DocumentViewer docViewer = NewControlUtil.newWord(ctl, storageFile); System.Windows.Style myStyle = (System.Windows.Style)mainContainer.FindResource("DocumentViewerDefaultStyle"); docViewer.Style = myStyle; docViewer.SizeChanged += WordUtil.Word_SizeChanged; docViewer.ManipulationBoundaryFeedback += scrollViewerManipulationBoundaryFeedback; loadAllAnimation(docViewer, ctl); mainContainer.Children.Add(docViewer); }
/* * 插入返回按钮 */ internal void insertBackButtonToPage(DControl ctl) { StorageImage storageImage = storageImageBll.get(ctl.storageId); Button imageButton = NewControlUtil.newBackButton(ctl, storageImage); imageButton.Style = pageTemplate.container.TryFindResource("ImageButtonStyle") as System.Windows.Style; //控件拖动 imageButton.PreviewMouseLeftButtonDown += control_MouseDown; imageButton.PreviewMouseMove += control_MouseMove; imageButton.PreviewMouseLeftButtonUp += control_MouseUp; //控件上右击显示菜单 imageButton.MouseRightButtonUp += control_MouseRightButtonUp; pageTemplate.container.Children.Add(imageButton); }
/* * 插入日期 */ internal void insertCCalendarToPage(DControl ctl) { CCalendar cCalendar = NewControlUtil.newCCalendar(ctl, pageTemplate.dPage, App.localStorage.cfg); cCalendar.Style = pageTemplate.container.TryFindResource("CCalendarStyle") as System.Windows.Style; //控件拖动 cCalendar.PreviewMouseLeftButtonDown += control_MouseDown; cCalendar.PreviewMouseMove += control_MouseMove; cCalendar.PreviewMouseLeftButtonUp += control_MouseUp; //控件上右击显示菜单 cCalendar.MouseRightButtonUp += control_MouseRightButtonUp; pageTemplate.container.Children.Add(cCalendar); }
/*ControlTemplate.TargetType”时引发了异常。”,行号为“8”,行位置为“18”。” * * 3.2插入Word */ public void insertWordToPage(DControl ctl) { StorageFile storageFile = storageFileBll.get(ctl.storageId); DocumentViewer docViewer = NewControlUtil.newWord(ctl, storageFile); System.Windows.Style myStyle = (System.Windows.Style)pageTemplate.container.FindResource("DocumentViewerDesignDefaultStyle"); docViewer.Style = myStyle; docViewer.PreviewMouseLeftButtonDown += control_MouseDown; docViewer.PreviewMouseMove += control_MouseMove; docViewer.PreviewMouseLeftButtonUp += control_MouseUp; //控件上右击显示菜单 docViewer.MouseRightButtonUp += control_MouseRightButtonUp; docViewer.SizeChanged += WordUtil.Word_SizeChanged; pageTemplate.container.Children.Add(docViewer); }
/* * 3.2插入一行文字 */ public void insertTextBlockToPage(DControl ctl) { TextBox textBox = NewControlUtil.newTextBox(ctl); System.Windows.Style myStyle = (System.Windows.Style)pageTemplate.container.FindResource("TextBoxDefaultStyle"); textBox.Style = myStyle; textBox.PreviewMouseLeftButtonDown += control_MouseDown; textBox.PreviewMouseMove += control_MouseMove; textBox.PreviewMouseLeftButtonUp += control_MouseUp; textBox.LostFocus += textBox_LostFocus; //控件上右击显示菜单 textBox.MouseRightButtonUp += control_MouseRightButtonUp; textBox.SizeChanged += WordUtil.Word_SizeChanged; pageTemplate.container.Children.Add(textBox); }
/* * 3.3插入Gif */ public void insertGifToPage(DControl ctl) { StorageGif storageGif = storageGifBll.get(ctl.storageId); string imgFullPath = FileUtil.notExistsShowDefault(storageGif?.url, Params.GifNotExists); imgFullPath = AppDomain.CurrentDomain.BaseDirectory + imgFullPath; Gif gifImage = NewControlUtil.newGif(ctl, storageGif, true); gifImage.Style = pageTemplate.container.TryFindResource("GifImageStyle") as System.Windows.Style; //控件拖动 gifImage.PreviewMouseLeftButtonDown += control_MouseDown; gifImage.PreviewMouseMove += control_MouseMove; gifImage.PreviewMouseLeftButtonUp += control_MouseUp; //控件上右击显示菜单 gifImage.MouseRightButtonUp += control_MouseRightButtonUp; pageTemplate.container.Children.Add(gifImage); }
/* * 3.2插入音频 */ public void insertCAudioToPage(DControl ctl) { string audioUrl = Params.CAudioNotExists; if (ctl.storageId > 0) { StorageFile storageFile = storageFileBll.get(ctl.storageId); audioUrl = storageFile?.url; } string audioCoverUrl = Params.CAudioImageNotExists; if (ctl.storageIdOfCover > 0) { StorageImage storageImage = storageImageBll.get(ctl.storageIdOfCover); audioCoverUrl = storageImage?.url; } CAudio cAudio = NewControlUtil.newCAudio(ctl, dPage, App.localStorage.cfg, audioUrl, audioCoverUrl, pageTemplate1.mqServer); loadAllAnimation(cAudio, ctl); mainContainer.Children.Add(cAudio); cAudio.Visibility = Visibility.Visible; cAudio.PreviewMouseUp += cAudio_PreviewMouseUp; cAudio.PreviewTouchUp += cAudio_PreviewTouchUp; }