/// <summary> /// Switches what is displayed in the forum page. /// <remarks> /// The different options are either the regular listing view, the view to add a new thread and the view to add a new sub forum. /// </remarks> /// </summary> /// <param name="mode">The view you want to switch to.</param> private void SwitchView(ViewMode mode) { switch (mode) { case ViewMode.ListView: ListThreadPanel.Visible = (bool)(CurrentPage["AllowThreads"] ?? false) || ThreadList.OfType <PageData>().Count() > 0; AddThreadButton.Visible = ((bool)(CurrentPage["AllowThreads"] ?? false)) && IsPoster; ListForumPanel.Visible = (bool)(CurrentPage["AllowForums"] ?? false) || ForumList.OfType <PageData>().Count() > 0; AddForumButton.Visible = ((bool)(CurrentPage["AllowForums"] ?? false)) && IsModerator; InformationPanel.Visible = !String.IsNullOrEmpty((string)CurrentPage["MainBody"]); ErrorPanel.Visible = NewThreadPanel.Visible = NewForumPanel.Visible = false; ButtonPanel.Visible = true; break; case ViewMode.AddThreadView: TitleTextBox.MaxLength = MAX_URL_LENGHT - Request.Path.Length; ListThreadPanel.Visible = ListForumPanel.Visible = NewForumPanel.Visible = InformationPanel.Visible = false; NewThreadPanel.Visible = true; ButtonPanel.Visible = false; break; case ViewMode.AddForumView: ForumTitleTextBox.MaxLength = 255 - Request.Path.Length; ListThreadPanel.Visible = ListForumPanel.Visible = NewThreadPanel.Visible = InformationPanel.Visible = false; NewForumPanel.Visible = true; ButtonPanel.Visible = false; break; case ViewMode.ErrorView: ListThreadPanel.Visible = ListForumPanel.Visible = NewThreadPanel.Visible = InformationPanel.Visible = false; ButtonPanel.Visible = false; ErrorPanel.Visible = true; break; } }