private void Ok(object sender, RoutedEventArgs e)
        {
            if (parent.GetType() == typeof(PostDiscussionPopup))
            {
                PostDiscussionPopup castedParent = (PostDiscussionPopup)parent;
                castedParent.Cancel();
            }
            else if (parent.GetType() == typeof(PostPhotoPopup))
            {
                PostPhotoPopup castedParent = (PostPhotoPopup)parent;
                castedParent.Cancel();
            }

            this.Close();
        }
        public PostCancelPrompt(PostDiscussionPopup parent)
        {
            InitializeComponent();

            this.parent = parent;
        }
예제 #3
0
 protected void Button_Click(Object sender, EventArgs e)
 {
     if ((sender.Equals(followingTab)) || (sender.Equals(logoButton)))
     {
         if (signedIn)
         {
             currFollowingPage      = new FollowingPage(this, followingSomeone);
             contentControl.Content = currFollowingPage;
             HighlightTab();
         }
         else
         {
             contentControl.Content = currPhotosPage;
             HighlightTab();
         }
     }
     else if (sender.Equals(photosTab))
     {
         contentControl.Content = currPhotosPage;
         currPhotosPage.SortByPopular();
         HighlightTab();
     }
     else if (sender.Equals(discussionsTab))
     {
         contentControl.Content = currDiscussionPage;
         currDiscussionPage.SortByMostCommented();
         HighlightTab();
     }
     else if (sender.Equals(savedTab))
     {
         contentControl.Content = currSavedPage;
         HighlightTab();
     }
     else if (sender.Equals(postButton))
     {
         postButtonDropdown.IsOpen = !postButtonDropdown.IsOpen;
     }
     else if (sender.Equals(notificationsButton))
     {
         notificationsButtonDropdown.IsOpen = !notificationsButtonDropdown.IsOpen;
     }
     else if (sender.Equals(messageButton))
     {
         messagesButtonDropdown.IsOpen = !messagesButtonDropdown.IsOpen;
     }
     else if (sender.Equals(accountButton))
     {
         accountButtonDropdown.IsOpen = !accountButtonDropdown.IsOpen;
     }
     else if (sender.Equals(profileButton))
     {
         accountButtonDropdown.IsOpen = false;
         currProfilePage        = new ProfilePage(this, currUser);
         contentControl.Content = currProfilePage;
         HighlightTab();
     }
     else if (sender.Equals(userSettingButton))
     {
         accountButtonDropdown.IsOpen = false;
         contentControl.Content       = new UserSettings(this, currUser);
         HighlightTab();
     }
     else if (sender.Equals(logoutButton))
     {
         //LogoutPromptPopup popup = new LogoutPromptPopup(this);
         //popup.ShowDialog();
         //contentControl.Content = new LoginPage();
         //HighlightTab();
         if (!signedIn)
         {
             accountButtonDropdown.IsOpen = false;
             contentControl.Content       = new LoginPage(this);
             HighlightTab();
         }
         else if (signedIn)
         {
             accountButtonDropdown.IsOpen = false;
             LogoutPromptPopup popup = new LogoutPromptPopup(this);
             popup.ShowDialog();
         }
     }
     else if (sender.Equals(seeAllMessagesButton))
     {
         contentControl.Content        = currMessagesPage;
         messagesButtonDropdown.IsOpen = false;
         HighlightTab();
     }
     else if (sender.Equals(postPhotoButton))
     {
         if (signedIn)
         {
             postButtonDropdown.IsOpen = false;
             PostPhotoPopup photoPopup = new PostPhotoPopup(this);
             photoPopup.SetValue(Grid.RowProperty, 2);
             photoPopup.SetValue(Grid.ColumnSpanProperty, 3);
             mainGrid.Children.Add(photoPopup);
         }
         else if (!signedIn)
         {
             LoginPrompt prompt = new LoginPrompt(this);
             prompt.SetMessage("You must sign in to create posts.");
             prompt.ShowDialog();
             HighlightTab();
         }
     }
     else if (sender.Equals(postDiscussionButton))
     {
         if (signedIn)
         {
             postButtonDropdown.IsOpen = false;
             PostDiscussionPopup discussionPopup = new PostDiscussionPopup(this);
             discussionPopup.SetValue(Grid.RowProperty, 2);
             discussionPopup.SetValue(Grid.ColumnSpanProperty, 3);
             mainGrid.Children.Add(discussionPopup);
         }
         else if (!signedIn)
         {
             LoginPrompt prompt = new LoginPrompt(this);
             prompt.SetMessage("You must sign in to create posts.");
             prompt.ShowDialog();
             HighlightTab();
         }
     }
 }