public ChatWindow(UserInfo userInfo) { InitializeComponent(); contactUserInfo = userInfo; lastMessageReceivedDateTime = DateTime.Now; isMouseHoveringEmoticonPanel = false; textInputChanged = false; isWindowClosing = false; isShiftDown = false; isWritingMessage = false; lastMessageFrom = ""; LoadEmoticonPanel(); btnSmiley.Source = LoadResource.chatWindowButtonSmileys(ButtonState.None); btnNudge.Source = LoadResource.chatWindowButtonNudge(ButtonState.None); background.Source = new BitmapImage(new Uri(Resource.Images.Identifiers.CHAT_WINDOW_BACKGROUND_SKINNY, UriKind.Absolute)); txtChat.Document.Blocks.Clear(); UpdatePersonal(); UpdateContact(userInfo); Thread threadParseInputText = new Thread(TextInputParser); threadParseInputText.IsBackground = true; threadParseInputText.Start(); }
private void btnNudge_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { btnNudge.Source = LoadResource.chatWindowButtonNudge(ButtonState.Hover); AddNudgeMessage("You have just sent a Nudge!"); Network.Client.SendNudge(contactUserInfo.id); }
UnityEngine.Object LoadRes(string name) { string full_path = root_path + name + ".prefab"; ZLog.I(null, "{0}", full_path); return(LoadResource.LoadAssetAtPath(full_path, typeof(GameObject))); }
public FrmFriendRequest(UserInfo userInfo) { InitializeComponent(); userID = userInfo.id; lblText.Text = "'" + userInfo.name + "' (" + userInfo.id + ") has added you to his/her contact list." + "\n\n" + "Do you want to add this person to your own contact list?"; CroppedBitmap defaultImg = LoadResource.GetDefaultAvatarImage(); if (userInfo.avatar != "") { BitmapImage userImg = LoadResource.GetAvatar(userInfo.avatar); if (userImg != null) { imgUserAvatar.Image = BitmapImage2Bitmap(userImg); } else { imgUserAvatar.Image = BitmapImage2Bitmap(defaultImg); } } else { imgUserAvatar.Image = BitmapImage2Bitmap(defaultImg); } }
public static async void Initialize(TestContext context) #endif { resourceContent = await LoadResource.Read("Resources/RenascenceSV.html"); cache = PageCache.Instance; }
public void Setup() { System.Diagnostics.Debugger.Launch(); _weatherForecast = LoadResource.LoadWeatherForecast(_weatherForecast); _MockDbService = InstantiateMockDbService(); _controller = new WeatherForecastController(null, _MockDbService); }
/// <summary> /// Creates the waiting box. /// </summary> /// User:Ryan CreateTime:2012-8-5 16:22. private void CreateWaitingBox() { if (!this._IsWaitingBoxCreated) { #region CreateWaitingBox this.waitingBox = new System.Windows.Forms.Panel(); //ControlHelper.BindMouseMoveEvent(this.waitingBox); waitingBox.BackColor = Color.FromArgb(234, 244, 252); ////innerpanel waitingBoxInnerPanel = new TXPanel(); waitingBoxInnerPanel.Width = 280; waitingBoxInnerPanel.Height = 80; waitingBoxInnerPanel.CornerRadius = 6; waitingBoxInnerPanel.BackBeginColor = Color.White; waitingBoxInnerPanel.BackEndColor = Color.White; waitingBoxInnerPanel.Padding = new System.Windows.Forms.Padding(8, 5, 5, 5); ////label waitingBoxLab = new Label(); waitingBoxLab.TextAlign = ContentAlignment.MiddleLeft; waitingBoxLab.AutoEllipsis = true; waitingBoxLab.Dock = DockStyle.Fill; //waitingBox.AutoSize = false; //ControlHelper.BindMouseMoveEvent(this.waitingBoxLab); waitingBoxInnerPanel.Controls.Add(waitingBoxLab); ////pictruebox PictureBox pb = new PictureBox(); pb.Dock = DockStyle.Left; pb.Size = new System.Drawing.Size(72, 70); pb.Image = LoadResource.GetRandomLoadImage(); pb.Margin = new System.Windows.Forms.Padding(3, 3, 20, 3); pb.SizeMode = PictureBoxSizeMode.StretchImage; this._waitPicBox = pb; waitingBoxInnerPanel.Controls.Add(pb); ////... waitingBox.Controls.Add(waitingBoxInnerPanel); waitingBox.BringToFront(); if (!this.Controls.Contains(waitingBox)) { this.Controls.Add(waitingBox); } waitingBox.Show(); this._IsWaitingBoxCreated = true; #endregion } Rectangle rect = this.WorkRectangle; waitingBox.Width = rect.Width; waitingBox.Height = rect.Height; waitingBox.Location = new Point(rect.X, rect.Y); this._waitPicBox.Image = LoadResource.GetRandomLoadImage(); waitingBox.BackgroundImage = this.CreateBacgroundImage(); //waitingBox.BackgroundImage = Properties.Resources.logo_mini; waitingBox.BackgroundImageLayout = ImageLayout.Stretch; }
public void Setup() { System.Diagnostics.Debugger.Launch(); _weatherForecast = LoadResource.LoadWeatherForecast(_weatherForecast); _context = new WeatherForecastContext(); _context.WeatherForecast = DbSetExtension.GetQueryableMockDbSet(_weatherForecast); _controller = new WeatherForecastController(_context); }
void Awake() { // Load Data string resource = LoadResource.GetData(); InsultsInstance = JsonUtility.FromJson <Insults>(resource); // Load Instances PointsManager = new PointsCounter(PlayerPointsText, ComputerPointsText); Computer = new Machine(InsultsInstance); Turn = new TurnManager(); }
public async Task Select_Explicit() { Uri uri = new Uri("https://example.com/threads/RenascenceSV.html.100/"); var resourceContent = await LoadResource.Read("Resources/RenascenceSV.html"); HtmlDocument doc = new HtmlDocument(); doc.LoadHtml(resourceContent); var forumType = ForumIdentifier.IdentifyForumTypeFromHtmlDocument(doc); var adapter = forumAdapterFactory.CreateForumAdapter(forumType, uri); Assert.IsInstanceOfType(adapter, typeof(XenForo1Adapter2)); }
public void AddChatMessage(string from, string messageText) { if (from == contactUserInfo.name) { txtLastUpdate.Document.Blocks.Clear(); txtLastUpdate.Document.Blocks.Add(new Paragraph(new Run("Last message received at " + lastMessageReceivedDateTime.ToShortTimeString() + " on " + lastMessageReceivedDateTime.ToShortDateString() + "."))); } Paragraph txtFrom = new Paragraph(); Paragraph txtText = new Paragraph(); txtFrom.LineStackingStrategy = LineStackingStrategy.BlockLineHeight; txtFrom.Inlines.Add(from + " says"); txtFrom.TextAlignment = TextAlignment.Justify; txtFrom.Foreground = (SolidColorBrush)(new BrushConverter().ConvertFrom("#A5A5A5")); txtFrom.FontSize = 14; txtFrom.FontWeight = FontWeights.Normal; txtFrom.Margin = new Thickness(0, 24, 0, 0); txtFrom.Padding = new Thickness(0, 0, 0, 0); txtFrom.LineHeight = 0.1; Image paragraphDot = LoadResource.getParagraphRectangle(); TextPointer pointerParagraphDot = txtChat.CaretPosition.GetInsertionPosition(LogicalDirection.Forward); InlineUIContainer inlineParagraphDot = new InlineUIContainer(paragraphDot, pointerParagraphDot); txtText.Inlines.Add(inlineParagraphDot); paragraphDot.Margin = new Thickness(-20, 0, 0, 2); txtText.Inlines.Add(messageText.TrimEnd()); txtText.LineHeight = 0.1; txtText.Margin = new Thickness(12, 3, 0, 0); if (lastMessageFrom != from) { txtChat.Document.Blocks.Add(txtFrom); TextParser.ProcessInlines(txtChat, txtFrom.Inlines, false); } txtChat.Document.Blocks.Add(txtText); TextParser.ProcessInlines(txtChat, txtText.Inlines, true); txtChat.ScrollToEnd(); lastMessageFrom = from; }
public Main() { listContacts = new List <ContactListEntryData>(); InitializeComponent(); UpdatePersonalInformation(); menuItemIconArrowAvailable.Source = LoadResource.GetSmallIconFromStatus(UserStatus.Available); menuItemIconArrowBusy.Source = LoadResource.GetSmallIconFromStatus(UserStatus.Busy); menuItemIconArrowAway.Source = LoadResource.GetSmallIconFromStatus(UserStatus.Away); menuItemIconArrowOffline.Source = LoadResource.GetSmallIconFromStatus(UserStatus.Offline); isEnterKeyDownInComment = false; isCommentEditSubmitted = false; isCommentBeingEdited = false; }
public TXWaitingBox(WaitWindow parent) { InitializeComponent(); this.MaximizeBox = false; this.MinimizeBox = false; this.ControlBox = false; this.ShowInTaskbar = false; _Parent = parent; this.Opacity = 0.95f; this.labWaitMessage.Text = "正在处理,请稍候..." + "\n" + "Dear,Please wait a moment !"; this.txPanel1.BackEndColor = this.GetRandomColor(); ControlHelper.BindMouseMoveEvent(this.labWaitMessage); //加载的图片 this.loadImage.Image = LoadResource.GetRandomLoadImage(); }
void Start() { //****** GameObject go = new GameObject(); Test test = go.AddComponent <Test>(); MonoBehaviour[] mono = { test }; Destroy(go); //这部分代码是预制体本身需要添加脚本是才需要,这里是添加Test脚本 //****** //这段代码是测试加载预制体 MyCube和MySphere,这两个预制体都打包在名为cube的数据包内 loadResource = gameObject.AddComponent <LoadResource>(); loadResource.InitializePrefabs("cube", "MyCube", mono); loadResource.InitializePrefabs("cube", "MySphere", new Vector3(1f, 0f, 0f), mono); }
/// <summary> /// 使用自定义的加载方式载入一个包。 /// </summary> /// <param name="descData">描述文件数据。</param> /// <param name="assetNamePrefix">资源文件名前缀。如果包含,则载入资源时名称将传入assetNamePrefix@resFileName这样格式。可以为空。</param> /// <param name="loadFunc">载入函数</param> /// <returns></returns> public static UIPackage AddPackage(byte[] descData, string assetNamePrefix, LoadResource loadFunc) { ByteBuffer buffer = new ByteBuffer(descData); UIPackage pkg = new UIPackage(); pkg._loadFunc = loadFunc; if (!pkg.LoadPackage(buffer, "raw data", assetNamePrefix)) { return(null); } _packageInstById[pkg.id] = pkg; _packageInstByName[pkg.name] = pkg; _packageList.Add(pkg); return(pkg); }
public Node <INode> GetNode(string nodeName) { switch (nodeName) { case StreamingAssetsPath.NAME: INode streamingAssetsPath = new StreamingAssetsPath() as INode; return(new Node <INode>(streamingAssetsPath)); case LoadTextFileAtPath.NAME: INode loadTextFileAtPath = new LoadTextFileAtPath() as INode; return(new Node <INode>(loadTextFileAtPath)); case LoadResource.NAME: INode loadResource = new LoadResource() as INode; return(new Node <INode>(loadResource)); default: return(null); } }
/// <summary> /// 使用自定义的加载方式载入一个包。 /// </summary> /// <param name="assetPath">包资源路径。</param> /// <param name="loadFunc">载入函数</param> /// <returns></returns> public static UIPackage AddPackage(string assetPath, LoadResource loadFunc) { if (_packageInstById.ContainsKey(assetPath)) { return(_packageInstById[assetPath]); } DestroyMethod dm; TextAsset asset = (TextAsset)loadFunc(assetPath + "_fui", ".bytes", typeof(TextAsset), out dm); if (asset == null) { if (Application.isPlaying) { throw new Exception("FairyGUI: Cannot load ui package in '" + assetPath + "'"); } else { Debug.LogWarning("FairyGUI: Cannot load ui package in '" + assetPath + "'"); } } ByteBuffer buffer = new ByteBuffer(asset.bytes); UIPackage pkg = new UIPackage(); pkg._loadFunc = loadFunc; pkg.assetPath = assetPath; if (!pkg.LoadPackage(buffer, assetPath, assetPath)) { return(null); } _packageInstById[pkg.id] = pkg; _packageInstByName[pkg.name] = pkg; _packageInstById[assetPath] = pkg; _packageList.Add(pkg); return(pkg); }
public void UpdatePersonal() { imageUserAvatar.Source = LoadResource.GetDefaultAvatarImage(); imageUserFrame.Source = LoadResource.GetAvatarFrameFromStatus((UserStatus)Personal.USER_INFO.status, AvatarSize.Big); if (Personal.USER_INFO.avatar != "") { BitmapImage image = LoadResource.GetAvatar(Personal.USER_INFO.avatar); if (image != null) { imageUserAvatar.Source = image; } else { imageUserAvatar.Source = LoadResource.GetDefaultAvatarImage(); } } else { imageUserAvatar.Source = LoadResource.GetDefaultAvatarImage(); } }
private async Task <string> GetForumResource(ForumType forumType) { string filename = forumType switch { ForumType.vBulletin3 => "vBulletin3.html", ForumType.vBulletin4 => "vBulletin4.html", ForumType.vBulletin5 => "vBulletin5.html", ForumType.XenForo1 => "Xenforo1.html", ForumType.XenForo2 => "Xenforo2.html", ForumType.NodeBB => "NodeBB.html", ForumType.phpBB => "phpBB.html", _ => string.Empty, }; if (string.IsNullOrEmpty(filename)) { return(string.Empty); } filename = $"Resources/{filename}"; return(await LoadResource.Read(filename) ?? ""); }
public void UpdateContact(UserInfo userInfo) { txtName.Text = userInfo.name; TextParser.ParseText(txtName, false); this.Title = userInfo.name; txtStatus.Text = "(" + ((UserStatus)userInfo.status).ToString() + ")"; if (userInfo.status == (int)UserStatus.Offline || Personal.USER_INFO.status == (int)UserStatus.Offline || userInfo.blocked == true) { this.IsEnabled = false; } else { this.IsEnabled = true; } if (userInfo.avatar != "") { BitmapImage image = LoadResource.GetAvatar(userInfo.avatar); if (image != null) { imagePartnerAvatar.Source = image; } else { imagePartnerAvatar.Source = LoadResource.GetDefaultAvatarImage(); } } else { imagePartnerAvatar.Source = LoadResource.GetDefaultAvatarImage(); } imagePartnerFrame.Source = LoadResource.GetAvatarFrameFromStatus((UserStatus)userInfo.status, AvatarSize.Big); contactUserInfo = userInfo; }
private void btnNudge_MouseEnter(object sender, MouseEventArgs e) { btnNudge.Source = LoadResource.chatWindowButtonNudge(ButtonState.Hover); }
public void UpdateContact(UserInfo userInfo) { lock (Personal.USER_CONTACTS) { UserInfo userFound = Personal.USER_CONTACTS.FirstOrDefault(p => p.id == userInfo.id.Trim()); if (userFound == null) { Personal.USER_CONTACTS.Add(userInfo); AddContactToList(userInfo); } else { bool userJustLoggedOn = false; bool userJustLoggedOff = false; ManageChatWindows.UpdateChatWindowUser(userInfo); if (userFound.status != userInfo.status & userFound.status == Convert.ToInt16(UserStatus.Offline) & userInfo.status != Convert.ToInt16(UserStatus.Offline)) { userJustLoggedOn = true; } if (userFound.status != userInfo.status & userFound.status != Convert.ToInt16(UserStatus.Offline) & userInfo.status == Convert.ToInt16(UserStatus.Offline)) { userJustLoggedOff = true; } userFound.name = userInfo.name; userFound.status = userInfo.status; userFound.avatar = userInfo.avatar; userFound.comment = userInfo.comment; userFound = userInfo; foreach (ContactListEntryData contact in listContacts) { if (contact.richTextBox.ToolTip.ToString() == userFound.id.ToString()) { contact.image.Source = LoadResource.GetSmallIconFromStatus((UserStatus)userInfo.status); if (userInfo.comment.Length == 0) { contact.name.Text = userInfo.name; } else { contact.name.Text = userInfo.name + " - "; } if (userJustLoggedOn) { contactListView.Items.Remove(contact.richTextBox); contactListView.Items.Insert(0, contact.richTextBox); } if (userJustLoggedOff) { contactListView.Items.Remove(contact.richTextBox); contactListView.Items.Insert(contactListView.Items.Count, contact.richTextBox); } contact.comment.Text = userInfo.comment; TextParser.ParseText(contact.name, false); TextParser.ParseText(contact.comment, true); break; } } if (userJustLoggedOn & Personal.USER_INFO.status == Convert.ToInt16(UserStatus.Available) & !userInfo.blocked) { Notification.NotificationManager.Showpopup(userInfo.name, "has just signed in.", null); Resource.Sounds.Player.PlaySound(Resource.Sounds.Identifiers.ONLINE); } } } UpdateContactCount(); }
protected override void Handle(LoadResource args) { App.QueueOnMainThread(() => Resources.Load(args.ResourceId, args.Name)); }
public static void ProcessInlines(RichTextBox textBox, InlineCollection inlines, bool findLinks) { for (int inlineIndex = 0; inlineIndex < inlines.Count; inlineIndex++) { Inline i = inlines.ElementAt(inlineIndex); if (i is Run) { Run r = i as Run; string text = r.Text; if (findLinks) { ProcessParagraphLink(textBox, text, i); } string emoticonFound = string.Empty; int index = FindFirstEmoticon(text, 0, out emoticonFound); if (index >= 0) { TextPointer tp = i.ContentStart; bool reposition = false; while (!tp.GetTextInRun(LogicalDirection.Forward).StartsWith(emoticonFound)) { tp = tp.GetNextInsertionPosition(LogicalDirection.Forward); } TextPointer end = tp; for (int j = 0; j < emoticonFound.Length; j++) { end = end.GetNextInsertionPosition(LogicalDirection.Forward); } TextRange tr = new TextRange(tp, end); if (textBox != null) { reposition = textBox.CaretPosition.CompareTo(tr.End) == 0; } tr.Text = string.Empty; Image image = new Image(); image.SnapsToDevicePixels = true; image.Source = LoadResource.GetEmoticon(emoticonFound.ToLower()); image.Width = 19; image.Height = 19; image.Stretch = Stretch.Fill; image.Tag = emoticonFound.ToLower(); RenderOptions.SetBitmapScalingMode(image, BitmapScalingMode.NearestNeighbor); RenderOptions.SetEdgeMode(image, EdgeMode.Aliased); InlineUIContainer iui = new InlineUIContainer(image, tp); iui.BaselineAlignment = BaselineAlignment.TextBottom; if (textBox != null && reposition) { textBox.CaretPosition = tp.GetNextInsertionPosition(LogicalDirection.Forward); } } } } }
private void btnNudge_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { btnNudge.Source = LoadResource.chatWindowButtonNudge(ButtonState.Pressed); }
private void btnSmiley_MouseEnter(object sender, MouseEventArgs e) { btnSmiley.Source = LoadResource.chatWindowButtonSmileys(ButtonState.Hover); }
private void btnSmiley_MouseLeave(object sender, MouseEventArgs e) { btnSmiley.Source = LoadResource.chatWindowButtonSmileys(ButtonState.None); }
private void btnSmiley_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { btnSmiley.Source = LoadResource.chatWindowButtonSmileys(ButtonState.Hover); window.Children.Add(emoticonPanel); }
protected virtual void Handle(LoadResource message) { }
private void btnNudge_MouseLeave(object sender, MouseEventArgs e) { btnNudge.Source = LoadResource.chatWindowButtonNudge(ButtonState.None); }