private bool EmoticonShow_EmoticonSelected(EmoticonItem emoticon) { this.InputBox.InsertEmoticon(emoticon.Fileorg, emoticon); if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { return(false); } this.InputBox.Focus(); return(true); }
private void ParseImage(MessagePack msgPack, ImageEx image) { EmoticonItem tag = image.Tag as EmoticonItem; if (tag.IsSysEmoticon) { SysFaceElement element = (SysFaceElement)msgPack.CreateElement(MsgPackCat.ELEMTYPE_SYSFACE); element.Index = Convert.ToByte(tag.Id); } else { ImageElement element2 = (ImageElement)msgPack.CreateElement(MsgPackCat.ELEMTYPE_IMAGE); element2.Path = "OSRoot:" + tag.Fileorg; } }
public static ImageEx CreateImageEx(string file, EmoticonItem item) { ImageEx ex = new ImageEx(); if (item == null) { ex.Tag = EmoticonItem.CreateImageItem(file, null); } else { ex.Tag = item; } ex.Source = file; ex.HorizontalAlignment = HorizontalAlignment.Left; ex.VerticalAlignment = VerticalAlignment.Top; ex.Stretch = Stretch.None; return ex; }
public static ImageEx CreateImageEx(string file, EmoticonItem item) { ImageEx ex = new ImageEx(); if (item == null) { ex.Tag = EmoticonItem.CreateImageItem(file, null); } else { ex.Tag = item; } ex.Source = file; ex.HorizontalAlignment = HorizontalAlignment.Left; ex.VerticalAlignment = VerticalAlignment.Top; ex.Stretch = Stretch.None; return(ex); }
public void InsertEmoticon(string file, EmoticonItem emoticon) { ImageEx image = ReplaceControls.CreateImageEx(file, emoticon); this.InsertImage(image); }
private bool EmoticonShow_EmoticonSelected(EmoticonItem emoticon) { this.InputBox.InsertEmoticon(emoticon.Fileorg, emoticon); if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) { return false; } this.InputBox.Focus(); return true; }
//protected string MaxFileSize //{ // get // { // return ConvertUtil.FormatSize(EmoticonBO.Instance.MaxEmticonFileSize(MyUserID)); // } //} private void upload() { using (ErrorScope es = new ErrorScope()) { int uploadCount = 0, i = 0; MessageDisplay msgDisplay = CreateMessageDisplay(); HttpFileCollection files = Request.Files; int fileCount = 0, savedCount = 0; if (files.Count > 0) { List <EmoticonItem> emoticondDatas = new List <EmoticonItem>(); for (int j = 0; j < files.Count; j++) { if (files[j].ContentLength > 0) { uploadCount++; EmoticonItem item = new EmoticonItem(); i++; byte[] fileData = new byte[files[j].ContentLength]; item.MD5 = IOUtil.GetFileMD5Code(files[j].InputStream); files[j].InputStream.Seek(0, System.IO.SeekOrigin.Begin); files[j].InputStream.Read(fileData, 0, fileData.Length); item.Shortcut = _Request.Get("shortcut" + i, Method.Post); item.Data = fileData; item.FileName = files[j].FileName; emoticondDatas.Add(item); } } if (emoticondDatas.Count > 0) { Dictionary <string, List <EmoticonItem> > groupedDatas = new Dictionary <string, List <EmoticonItem> >(); groupedDatas.Add(string.Empty, emoticondDatas); EmoticonBO.Instance.BatchImportEmoticon(MyUserID, Group.GroupID, groupedDatas, out fileCount, out savedCount); } } if (uploadCount == 0) { message = "没有选择文件"; } else if (fileCount == 0) { message = "没有有效的表情文件"; } else if (savedCount == 0) { if (es.HasUnCatchedError) { es.CatchError <ErrorInfo>(delegate(ErrorInfo error) { message += error.Message; }); } else { message = "没有保存任何文件, 可能的原因:文件类型不正确, 或者文件大小超出限制!"; } } else { string msg = string.Empty; if (es.HasUnCatchedError) { es.CatchError <ErrorInfo>(delegate(ErrorInfo error) { message += "<br />" + error.Message; }); } message = uploadCount == savedCount ? "文件全部保存成功" : "共上传" + uploadCount + "个文件, 成功保存了" + savedCount + "个文件。" + msg; if (!es.HasUnCatchedError) { state = 2; } else { state = 1; } } } }
public static string ReplaceGUIWithClipboardControl(string xaml, TextPointer start, TextPointer end) { List <DependencyObject> userControls = GetUserControls(start, end); if (userControls.Count == 0) { return(xaml); } string input = xaml; foreach (DependencyObject obj2 in userControls) { string str2 = null; UIElement child = null; if (obj2 is BlockUIContainer) { str2 = "BlockUIContainer"; child = (obj2 as BlockUIContainer).Child; } else if (obj2 is InlineUIContainer) { str2 = "InlineUIContainer"; child = (obj2 as InlineUIContainer).Child; } string replacement = null; if (child is ImageEx) { ImageEx ex = child as ImageEx; EmoticonItem tag = ex.Tag as EmoticonItem; string id = ""; if ((tag != null) && tag.IsSysEmoticon) { id = tag.Id; } if (ImageHyperlink.GetEnableCopy(ex)) { ex.Source.Replace("$", "$$"); string str5 = string.Format("<wpfgui:ClipboardControl ControlType=\"{0}\" ImagePath=\"{1}\" SysId=\"{2}\"/>", typeof(ImageEx).FullName, ex.Source, id); string str6 = "Bama.Controls"; string str7 = "Bama.Controls"; string str8 = string.Format("xmlns:wpfgui=\"clr-namespace:{0};assembly={1}\"", str6, str7); replacement = string.Format("<{0} {1}>{2}</{0}>", str2, str8, str5); } else { replacement = ""; } } if (replacement != null) { if (obj2 is BlockUIContainer) { input = blockEmptyUIContainerRegex.Replace(input, replacement, 1); } else { input = inlineEmptyUIContainerRegex.Replace(input, replacement, 1); } } } return(input); }
internal static ImageEx CreateImageExWithId(string file, string id) { EmoticonItem item = EmoticonItem.CreateImageItem(file, id); return(CreateImageEx(file, item)); }