예제 #1
0
 public void MapTo(PostIconEntity icon, string title, string receiver, string body)
 {
     this.Icon = icon;
     this.Title = title;
     this.Receiver = receiver;
     this.Body = body;
 }
예제 #2
0
 public void MapTo(PostIconEntity icon, string title, string receiver, string body)
 {
     this.Icon     = icon;
     this.Title    = title;
     this.Receiver = receiver;
     this.Body     = body;
 }
예제 #3
0
 public void MapTo(string subject, string content, ForumEntity forumEntity, PostIconEntity postIconEntity)
 {
     Subject = subject;
     Content = content;
     Forum = forumEntity;
     PostIcon = postIconEntity;
     ParseUrl = true;
 }
예제 #4
0
 public void MapTo(string subject, string content, ForumEntity forumEntity, PostIconEntity postIconEntity)
 {
     Subject  = subject;
     Content  = content;
     Forum    = forumEntity;
     PostIcon = postIconEntity;
     ParseUrl = true;
 }
예제 #5
0
 public async Task<IEnumerable<PostIconEntity>> GetPostIconList(ForumEntity forum)
 {
     string url = string.Format(Constants.NEW_THREAD, forum.ForumId);
     WebManager.Result result = await _webManager.GetData(url);
     HtmlDocument doc = result.Document;
     HtmlNode[] pageNodes = doc.DocumentNode.Descendants("div").Where(node => node.GetAttributeValue("class", string.Empty).Equals("posticon")).ToArray();
     var postIconEntityList = new List<PostIconEntity>();
     foreach (var pageNode in pageNodes)
     {
         var postIconEntity = new PostIconEntity();
         postIconEntity.Parse(pageNode);
         postIconEntityList.Add(postIconEntity);
     }
     return postIconEntityList;
 }
예제 #6
0
 public async Task<IEnumerable<PostIconCategoryEntity>> GetPmPostIcons()
 {
     string url = Constants.NEW_PRIVATE_MESSAGE;
     WebManager.Result result = await _webManager.GetData(url);
     HtmlDocument doc = result.Document;
     HtmlNode[] pageNodes = doc.DocumentNode.Descendants("div").Where(node => node.GetAttributeValue("class", string.Empty).Equals("posticon")).ToArray();
     var postIconEntityList = new List<PostIconEntity>();
     foreach (var pageNode in pageNodes)
     {
         var postIconEntity = new PostIconEntity();
         postIconEntity.Parse(pageNode);
         postIconEntityList.Add(postIconEntity);
     }
     var postIconCategoryEntity = new PostIconCategoryEntity("Post Icon", postIconEntityList);
     var postIconCategoryList = new List<PostIconCategoryEntity> { postIconCategoryEntity };
     return postIconCategoryList;
 }
        private void itemGridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            object item = e.ClickedItem;

            if (item.GetType() == typeof(SmileEntity))
            {
                var smile = (SmileEntity)e.ClickedItem;
                ReplyText.Text = ReplyText.Text.Insert(ReplyText.Text.Length, smile.Title);
                return;
            }

            if (item.GetType() == typeof(PostIconEntity))
            {
                _postIcon = (PostIconEntity)e.ClickedItem;
                PostIconImage.Source = new BitmapImage(new Uri(_postIcon.ImageUrl, UriKind.Absolute));
                return;
            }

            if (item.GetType() != typeof(BBCodeEntity)) return;
            var bbcode = (BBCodeEntity)e.ClickedItem;
            if (!string.IsNullOrEmpty(ReplyText.SelectedText))
            {
                string selectedText = "[{0}]" + ReplyText.SelectedText + "[/{0}]";
                ReplyText.SelectedText = string.Format(selectedText, bbcode.Code);
            }
            else
            {
                string text = string.Format("[{0}][/{0}]", bbcode.Code);
                string replyText = string.IsNullOrEmpty(ReplyText.Text) ? string.Empty : ReplyText.Text;
                if (replyText != null) ReplyText.Text = replyText.Insert(ReplyText.SelectionStart, text);
            }
        }
 /// <summary>
 /// Populates the page with content passed during navigation. Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session. The state will be null the first time a page is visited.</param>
 private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     var jsonObjectString = (string)e.NavigationParameter;
     var blankPostIconEntity = new PostIconEntity { Id = 0, Title = "Shit" };
     PostIconImage.Source = new BitmapImage(new Uri("ms-appx://Assets/shitpost.gif"));
     _postIcon = blankPostIconEntity;
     if (string.IsNullOrEmpty(jsonObjectString)) return;
     var privateMessage = JsonConvert.DeserializeObject<PrivateMessageEntity>(jsonObjectString);
     if (privateMessage == null) return;
     SubjectTextBox.Text = string.Format("Re: {0}", privateMessage.Title);
     RecipientTextBox.Text = privateMessage.Sender;
 }
예제 #9
0
 /// <summary>
 /// Populates the page with content passed during navigation. Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session. The state will be null the first time a page is visited.</param>
 private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     var jsonObjectString = (string)e.NavigationParameter;
     var forumInfo = JsonConvert.DeserializeObject<ForumEntity>(jsonObjectString);
     if (forumInfo == null) return;
     pageTitle.Text = string.Format("New Thread - {0}", forumInfo.Name);
     _forumEntity = forumInfo;
     _newThreadEntity = await _threadManager.GetThreadCookies(forumInfo.ForumId);
     if (_newThreadEntity == null)
     {
         var msgDlg = new MessageDialog("You can't make a new thread in this forum!");
         await msgDlg.ShowAsync();
         Frame.GoBack();
         return;
     }
     var blankPostIconEntity = new PostIconEntity {Id = 0, Title = "Shit"};
     PostIconImage.Source = new BitmapImage(new Uri("ms-appx://Assets/shitpost.gif"));
     _postIcon = blankPostIconEntity;
 }