/// <summary> /// Deletes the current post's content. /// </summary> private void DeleteCurrentControl() { // Clear out the panel ui_contentRoot.Children.Clear(); // Clear the current post m_currentPost = null; if (m_control != null) { // Destroy it m_control.OnDestroyContent(); // Kill it. m_control = null; } }
/// <summary> /// Creates new post content /// </summary> /// <param name="flipPost"></param> private void CreateNewControl(Post flipPost) { // First figure out who can handle this post. // Important, the order we ask matter since there maybe overlap // in handlers. if (GifImageFliplControl.CanHandlePost(flipPost)) { m_control = new GifImageFliplControl(this); } else if (YoutubeFlipControl.CanHandlePost(flipPost)) { m_control = new YoutubeFlipControl(this); } else if (BasicImageFlipControl.CanHandlePost(flipPost)) { m_control = new BasicImageFlipControl(this); } else if (RedditMarkdownFlipControl.CanHandlePost(flipPost)) { m_control = new RedditMarkdownFlipControl(this); } else if (RedditContentFlipControl.CanHandlePost(flipPost)) { m_control = new RedditContentFlipControl(this); } else if (CommnetSpoilerFlipControl.CanHandlePost(flipPost)) { m_control = new CommnetSpoilerFlipControl(this); } else if (WindowsAppFlipControl.CanHandlePost(flipPost)) { m_control = new WindowsAppFlipControl(this); } else { m_control = new WebPageFlipControl(this); } // Setup the control m_control.OnPrepareContent(flipPost); // Add the control to the UI ui_contentRoot.Children.Add((UserControl)m_control); }
/// <summary> /// Called when a post fails to load, we should fallback to the browser. /// </summary> /// <param name="post"></param> public void FallbackToWebBrowser(Post post) { // Show loading ShowLoading(); // Delete what we have DeleteCurrentControl(); // Reset the post m_currentPost = post; // Make a web control m_control = new WebPageFlipControl(this); // Setup the control m_control.OnPrepareContent(post); // Add the control to the UI ui_contentRoot.Children.Add((UserControl)m_control); }
/// <summary> /// Creates new post content /// </summary> /// <param name="flipPost"></param> private void CreateNewControl(Post flipPost) { // First figure out who can handle this post. // Important, the order we ask matter since there maybe overlap // in handlers. if (GifImageFliplControl.CanHandlePost(flipPost)) { m_control = new GifImageFliplControl(this); } else if (YoutubeFlipControl.CanHandlePost(flipPost)) { m_control = new YoutubeFlipControl(this); } else if (BasicImageFlipControl.CanHandlePost(flipPost)) { m_control = new BasicImageFlipControl(this); } else if (RedditMarkdownFlipControl.CanHandlePost(flipPost)) { m_control = new RedditMarkdownFlipControl(this); } else if (RedditContentFlipControl.CanHandlePost(flipPost)) { m_control = new RedditContentFlipControl(this); } else if (WindowsAppFlipControl.CanHandlePost(flipPost)) { m_control = new WindowsAppFlipControl(this); } else { m_control = new WebPageFlipControl(this); } // Setup the control m_control.OnPrepareContent(flipPost); // Add the control to the UI ui_contentRoot.Children.Add((UserControl)m_control); }