public PostingDetailPage(int postingId, Engine.ClientEngine.PostingDetail postingData) { InitializeComponent(); // 우선은 태그 입력 필드를 안보이게 myTagEntryView.TagEntry.IsVisible = false; otherTagEntryView.TagEntry.IsVisible = false; m_postingID = postingId; m_viewModel = new ViewModel(postingData); BindingContext = m_viewModel; if (!string.IsNullOrEmpty(postingData.postingInfo.sourceURL)) // 링크 추가 { Uri uri = null; try { uri = new Uri(postingData.postingInfo.sourceURL); } catch { } if (uri != null) { var gestureRec = new TapGestureRecognizer(); gestureRec.Tapped += (s, e) => { Device.OpenUri(uri); }; linkToSource.GestureRecognizers.Add(gestureRec); } } }
private async void Handle_ItemTapped(object sender, ItemTappedEventArgs e) { if (e.Item != null) { var data = postList.SelectedItem as ViewModel.Item; postList.SelectedItem = null; // 블라인드 처리된 글은 본인이거나 운영자 아니면 못봄 if (data.isBlinded && !App.instance.isAdmin && data.author != (string)App.Current.Properties["username"]) { await DisplayAlert("오류", "블라인드 처리된 글은 읽을 수 없습니다.", "확인"); } else { Engine.ClientEngine.PostingDetail posting = null; await App.RunLongTask(() => { posting = App.instance.core.post.ShowPosting(data.postid); }); if (posting == null) { await DisplayAlert("오류", "포스팅을 읽어올 수 없습니다.", "확인"); } else { await Navigation.PushAsync(new PostingDetailPage(data.postid, posting)); } } } }
private async void BtnShow_Clicked(object sender, EventArgs e) { Engine.ClientEngine.PostingDetail result = null; await App.RunLongTask(() => { result = App.instance.core.post.ShowPosting(m_viewModel.reportedID); }); if (result != null) { await Navigation.PushAsync(new PostingDetailPage(m_viewModel.reportedID, result)); } }
public ViewModel(Engine.ClientEngine.PostingDetail postdata) { images = new ObservableCollection <ImageItem>(); foreach (var img in postdata.imageArray) { images.Add(new ImageItem { image = img }); } var posting = postdata.postingInfo; title = posting.title; author = posting.author; datetime = posting.datetime.ToString(); detail = posting.desc; origUrl = posting.sourceURL; myTagItems = new ObservableCollection <TagItem>(); foreach (var tag in posting.mytags) { myTagItems.Add(new TagItem() { tag = tag }); } otherTagItems = new ObservableCollection <TagItem>(); foreach (var tag in posting.othertags) { otherTagItems.Add(new TagItem() { tag = tag }); } }