Beispiel #1
0
        private void nightbutton_Click(object sender, RoutedEventArgs e)
        {
            var post    = new RedditPost(this);
            var comment = new PostComment("", "");

            if (night == 0)
            {
                this.comments.Background = new SolidColorBrush(Windows.UI.Colors.Black);
                this.posts.Background    = new SolidColorBrush(Windows.UI.Colors.Black);
                this.mainPage.Background = new SolidColorBrush(Windows.UI.Colors.Black);
                this.radialMenu.setNightMode();
                change_pivot_header_colors(new SolidColorBrush(Windows.UI.Colors.White));

                post.nightMode();
                comment.nightMode();
                night = 1;
            }
            else
            {
                this.comments.Background = new SolidColorBrush(Windows.UI.Colors.White);
                this.posts.Background    = new SolidColorBrush(Windows.UI.Colors.White);
                this.mainPage.Background = new SolidColorBrush(Windows.UI.Colors.White);

                change_pivot_header_colors(new SolidColorBrush(Windows.UI.Colors.Black));

                this.radialMenu.revertNightMode();
                night = 0;
            }
        }
Beispiel #2
0
        public MainPage()
        {
            this.InitializeComponent();
            for (int i = 0; i < 10; i++)
            {
                var post = new RedditPost(this);
                post.setImage(i.ToString() + ".jpg");
                post.setText(postTitles[i]);
                post.PointerPressed += pressPost;
                this.posts.Items.Add(post);
            }
            for (int i = 0; i < 10; i++)
            {
                var post = new ImageViewCard();
                post.setImage(i.ToString() + ".jpg");
                post.setText(postTitles[i]);
                this.imageview_posts.Items.Add(post);
            }
            for (int i = 0; i < 10; i++)
            {
                this.comments.Items.Add(new PostComment("someone dumb", "This is a super bad comment!!! RAGE!"));
            }

            radialMenu.setMenuOptions("upvote", switchToComments,
                                      "downvote", switchToComments,
                                      "comments", switchToComments);
            radialMenu.PointerExited += (o, e) => { banishRadialMenu(); };
        }
Beispiel #3
0
        public void pressPost(object sender, PointerRoutedEventArgs e)
        {
            var post = sender as RedditPost;

            if (post == null)
            {
                return;
            }

            if (focused == null) // If nothing is currently focused, select this
            {
                // Focus the current post
                focused = post;

                post.focusPost();

                foreach (var p in posts.Items.Select(i => i as RedditPost))
                {
                    if (p != null && p != post)
                    {
                        p.hide();
                        p.IsEnabled = false;
                    }
                }
            }
            else if (post == focused) // The same post has been pressed again
            {
                // Unfocus the current post
                focused = null;

                post.unfocusPost();

                foreach (var p in posts.Items.Select(i => i as RedditPost))
                {
                    if (p != null)
                    {
                        p.IsEnabled = true;
                        p.unhide();
                    }
                }
            }

            // Otherwise the press event is ignored
        }