private async void InitializeUser() { usernameText.Text = username; Dictionary <string, string> info = await NetworkControl.QueryUserInfo(username); string imageUrl = info.GetValueOrDefault <string, string>("imageUrl"); var newSrc = new BitmapImage(new Uri(NetworkControl.GetFullPathUrl(imageUrl), UriKind.Absolute)); newSrc.CreateOptions = BitmapCreateOptions.IgnoreImageCache; personPic.ProfilePicture = newSrc; }
private async void InitializePost() { myViewModels.allComments.Clear(); hasThumb = await NetworkControl.CheckUserThumbOrNot(username, id); if (hasThumb) { thumb_click = 1; } Dictionary <string, object> post = await NetworkControl.GetPostFromID(username, password, id); if ((string)post["code"] != "1") { // } else { title.Text = post["title"] as string; author.Text = post["editor"] as string; thumb_num.Text = post["thumbs"] as string; List <KeyValuePair <String, String> > commentDict = post["comment"] as List <KeyValuePair <String, String> >; Run run = new Run { Text = post["content"] as string }; Paragraph paragraph = new Paragraph(); paragraph.Inlines.Add(run); passage.Blocks.Add(paragraph); if ((string)post["image"] != "") { image.Visibility = Windows.UI.Xaml.Visibility.Visible; var imageUrl = (string)post["image"]; var newSrc = new BitmapImage(new Uri(NetworkControl.GetFullPathUrl(imageUrl), UriKind.Absolute)); newSrc.CreateOptions = BitmapCreateOptions.IgnoreImageCache; image.Source = newSrc; } else if ((string)post["media"] != "") { video.Visibility = Windows.UI.Xaml.Visibility.Visible; var videoUrl = (string)post["media"]; video.Source = MediaSource.CreateFromUri(new Uri(NetworkControl.GetFullPathUrl(videoUrl), UriKind.Absolute)); } foreach (var comment in commentDict) { myViewModels.AddComment(comment.Key, comment.Value); } } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { string[] temp = e.Parameter as string[]; username = temp[0]; password = temp[1]; Dictionary <string, string> info = await NetworkControl.QueryUserInfo(username); string imageUrl = info.GetValueOrDefault <string, string>("imageUrl"); string phone = info.GetValueOrDefault <string, string>("phone"); string email = info.GetValueOrDefault <string, string>("email"); var newSrc = new BitmapImage(new Uri(NetworkControl.GetFullPathUrl(imageUrl), UriKind.Absolute)); newSrc.CreateOptions = BitmapCreateOptions.IgnoreImageCache; personPic.ProfilePicture = newSrc; usernameBlock.Text = username; phoneBlock.Text = phone; emailBlock.Text = email; oldPhone = phone; oldEmail = email; }
private async void UserNameBox_LostFocus(object sender, RoutedEventArgs e) { if (UserNameBox.Text.Length != 0) { string name = UserNameBox.Text; var res = await NetworkControl.QueryUserInfo(name); UserNameMsg.Text = ""; if (res["code"] == "0") { UserNameMsg.Text = res["errMessage"]; } else if (res["code"] == "1") { string imgUrl = res["imageUrl"]; var newSrc = new BitmapImage(new Uri(NetworkControl.GetFullPathUrl(imgUrl), UriKind.Absolute)); newSrc.CreateOptions = BitmapCreateOptions.IgnoreImageCache; Logo.Source = newSrc; } } }