public WindowAssetSel(string[] FileType, out jg.Editor.Library.AssResInfo Assinfo, bool b = true) { Assinfo = _AssInfo; InitializeComponent(); Bpage = b; filetype = FileType; tvResTree.ItemsSource = Globals.CPDPM_DirSourceClassList; }
public static ToolboxItem GetToolBoxItem(SaveItemInfo info) { Image image; ToolboxItem item = null; item = new ToolboxItem(); item.AssetType = info.assetType; item.ItemName = info.ItemName; item.ItemId = info.ItemId; switch (info.assetType) { case AssetType.Movie: case AssetType.Sound: case AssetType.HTML5: case AssetType.Document: image = new Image() { Source = new BitmapImage(new Uri(info.Thumbnails, UriKind.Absolute)) }; image.Stretch = Stretch.Fill; item.Content = image; break; case AssetType.Topic: TopicControl tc = new TopicControl(true); tc.TopicInfo = XamlReader.Load(XmlReader.Create((TextReader) new StringReader(((ContentText)info.Content).Text))) as TopicInfo; item.Content = tc; break; case AssetType.TopicDrag: ContentTopicDrag contentTopicDrag = info.Content as ContentTopicDrag; if (contentTopicDrag == null) { break; } ControlTopicDrag controlTopicDarg = new ControlTopicDrag(contentTopicDrag.topicDragItemAnswerList, contentTopicDrag.topicDragItemList, new SolidColorBrush((Color)ColorConverter.ConvertFromString(contentTopicDrag.Background)), new SolidColorBrush((Color)ColorConverter.ConvertFromString(contentTopicDrag.Foreground)), true); controlTopicDarg.Score = info.Score; item.Content = controlTopicDarg; break; case AssetType.Text: ControlTextEditor content = new ControlTextEditor(); if (info.LineHeight != 0) { content.mainRTB.Document.LineHeight = info.LineHeight; } content.mainRTB.Document = XamlReader.Load(XmlReader.Create((TextReader) new StringReader(jg.HTMLConverter.HtmlToXamlConverter.ConvertHtmlToXaml(((ContentText)info.Content).Text, true)))) as FlowDocument; //content.mainRTB.Document = XamlReader.Load(XmlReader.Create((TextReader)new StringReader(((ContentText)info.Content).Text))) as FlowDocument; if (info.LineHeight != 0) { content.mainRTB.Document.LineHeight = info.LineHeight; } content.mainRTB.Document.FontSize = info.FontSize; content.mainRTB.Document.FontFamily = new FontFamily(info.FontFamily); item.LineHeight = info.LineHeight; item.FontFamily = new FontFamily(info.FontFamily); item.FontSize = info.FontSize; item.Content = content; break; case AssetType.TextGrid: ControlTextGrid controlTextGrid = new ControlTextGrid(); controlTextGrid.Source = (ContentGrid)info.Content; item.Content = controlTextGrid; break; case AssetType.Shape: System.Windows.Shapes.Path path = new System.Windows.Shapes.Path() { Name = ((ContentText)info.Content).Text }; path.Style = item.FindResource(((ContentText)info.Content).Text) as Style; path.Stretch = Stretch.Fill; item.Content = path; break; case AssetType.Image: image = new Image() { Source = new BitmapImage(new Uri(info.Thumbnails, UriKind.Absolute)) }; image.Stretch = Stretch.Fill; item.Content = image; break; case AssetType.Message: ControlMessage controlMessage = new ControlMessage(true); ContentMessage contentMessage = info.Content as ContentMessage; if (contentMessage == null) { break; } controlMessage.Title = contentMessage.Title; controlMessage.Location = new Point(contentMessage.PointX, contentMessage.PointY); item.Content = controlMessage; break; case AssetType.Line: ControlLine controlLine = new ControlLine(true); ContentLine contentLine = info.Content as ContentLine; if (contentLine == null) { break; } controlLine.Point1 = new Point(contentLine.Point1X, contentLine.Point1Y); item.Content = controlLine; break; case AssetType.TPageGroup: bool dirInfo = false; if (AssResInfoObser.Keys.Count > 0) { foreach (var v in AssResInfoObser.Keys) { if (v == item.ItemId) { dirInfo = true; AssResInfo resInfo = new AssResInfo(); resInfo.ArId = info.ItemId; resInfo.AssetName = "图片" + (DirectoryTpageLoad[v].Children.Count + 1); resInfo.AssetPath = info.AssetPath; resInfo.Thumbnails = info.Thumbnails; AssResInfoObser[v].Add(resInfo); DirectoryTpageLoad[v].Children = AssResInfoObser[v]; DirectoryTpageLoad[v].UpdateImgGroup(); break; } } } if (!dirInfo) { TPageControl page = new TPageControl(); page.Height = info.Height; page.Width = info.Width; page.canvasPageContent.Width = info.Width - 100; page.canvasPageContent.Height = info.Height - 2; AssResInfo resInfo = new AssResInfo(); resInfo.ArId = info.ItemId; resInfo.AssetName = "图片1"; resInfo.AssetPath = info.AssetPath; resInfo.Thumbnails = info.Thumbnails; System.Collections.ObjectModel.ObservableCollection <AssResInfo> observableAssResInfo = new System.Collections.ObjectModel.ObservableCollection <AssResInfo>(); observableAssResInfo.Add(resInfo); page.Children = observableAssResInfo; page.UpdateImgGroup(); AssResInfoObser.Add(item.ItemId, observableAssResInfo); DirectoryTpageLoad.Add(item.ItemId, page); item.Content = DirectoryTpageLoad[item.ItemId]; } break; } item.IsLongText = info.IsLongText; item.IsShowDiv = info.IsShowDiv; item.IsDescPt = info.IsDescPt; item.Opacity = info.Opacity; if (info.Background != null) { item.ItemBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(info.Background)); } if (info.Foreground != null) { item.ItemForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(info.Foreground)); } item.AssetPath = info.AssetPath; item.Thumbnails = info.Thumbnails; return(item); }
public ShowTopicDrag(out AssResInfo assresinfo) : this() { assresinfo = _AssInfo; }