protected Image GetUserIcon(String iconKey) { try { return(Image.FromStream(VmosoFileUtils.downloadIcon(Session, iconKey, Session.UserKey))); } catch (Exception) { return(Properties.GlobalResources.vmoso_login); } }
private void InitializePicture() { this.picture.Location = new Point(this.personalPaneBlank.Width, this.personalPaneBlank.Height); this.picture.Size = new Size(personalPaneBlank.Width * 8, this.PersonalPane.Height - personalPaneBlank.Height * 4); this.picture.SizeMode = PictureBoxSizeMode.Zoom; string server = displayRecord.server; //this.picture.Image = Image.FromFile(iconLocation + "/Blank_36x36.png"); if (!string.IsNullOrEmpty(displayRecord.iconSmall)) { if (!displayRecord.isRegistered && displayRecord.character.Equals("engage")) { this.picture.Image = FetchPictureFromWeb(server + "/resource/vmoso/default/images/avatar/" + displayRecord.iconSmall + ".png"); } else { //object userImage = imageCache.GetObject(displayRecord.iconSmall + ".png"); object userImage = null; if (userImage != null) { this.picture.Image = (Image)userImage; } else { Stream iconStream = VmosoFileUtils.downloadIcon(Session, displayRecord.iconSmall, Session.UserKey); if (iconStream != null) { this.picture.Image = Image.FromStream(iconStream); } } } } this.picture.Region = RoundPictureBox(this.picture); }