Example #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var layout = this.collectionView.CollectionViewLayout as UICollectionViewFlowLayout;

            this.ViewModel = new RedditViewModel();

            this.ViewModel
            .Bind(this.indicator)
            .IsAnimating(vm => vm.IsUpdating)
            .Visible(vm => vm.IsUpdating)
            .Bind(this.collectionView)
            .Hidden(vm => vm.IsUpdating)
            .Bind(this.collectionView)
            .Source(vm => vm.Items, (vm, v, c) =>
            {
                c.RegisterCellView <PostCollectionCell>("cell", 44, 44);
                c.RegisterHeaderView <PostCollectionHeader>("header", 88, 100);
            });

            this.ViewModel.UpdateCommand.Execute(null);

            this.segmented.ValueChanged += (sender, e) => this.ViewModel.IsGrouped = this.segmented.SelectedSegment > 0;
        }
Example #2
0
 // Constructor
 public browse()
 {
     InitializeComponent();
     _viewModel = (RedditViewModel)Resources["viewModel"];
     resultListBox.ItemRealized += resultListBox_ItemRealized;
     this.Loaded += new RoutedEventHandler(MainPage_Loaded);
 }
Example #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            this.SetContentView(Resource.Layout.activity_recycler);

            this.recycler  = this.FindViewById <RecyclerView>(Resource.Id.recycler);
            this.indicator = this.FindViewById <ProgressBar>(Resource.Id.indicator);

            var layout = new LinearLayoutManager(this);

            recycler.SetLayoutManager(layout);

            this.ViewModel = new RedditViewModel();

            this.ViewModel
            .Bind(this.indicator)
            .Visible(vm => vm.IsUpdating)
            .Bind(this.recycler)
            .Hidden(vm => vm.IsUpdating)
            .Bind(this.recycler)
            .Source(vm => vm.Items, (vm, v, c) =>
            {
                c.RegisterCellView <PostCellHolder>("cell", 44, 44);
                c.RegisterHeaderView <PostHeaderCellHolder>("header", 88, 100);
            });

            this.ViewModel.UpdateCommand.Execute(null);

            this.DisplayToolbar();
        }
Example #4
0
 public RedditService(RedditRepository redditRepository, RedditViewModel redditViewModel)
 {
     this.redditRepository   = redditRepository;
     this.redditViewModel    = redditViewModel;
     redditViewModel.allPost = AllPost();
     redditViewModel.Top10();
     redditViewModel.OtherPosts();
 }
Example #5
0
        public MainPage()
        {
            this.InitializeComponent();

            RedditViewModel viewModel = new RedditViewModel();

            listBox1.ItemsSource = viewModel.Entries;
        }
Example #6
0
        public RedditPostFilter(RedditViewModel vm, bool denyNsfw, List <SubredditInfo> subreddits = null)
        {
            if (subreddits is null)
            {
                subreddits = new List <SubredditInfo>();
            }

            Vm         = vm;
            DenyNsfw   = denyNsfw;
            Subreddits = subreddits;
        }
Example #7
0
        public ActionResult Index()
        {
            var            reddit    = new Reddit();
            Subreddit      subreddit = reddit.GetSubreddit("programming");
            Listing <Post> posts     = subreddit.GetTop(FromTime.Day);
            var            vm        = new RedditViewModel();

            vm.Posts = posts.Take(10).Select(p =>
                                             new RedditPost
            {
                AuthorName = p.AuthorName,
                Score      = p.Score,
                Title      = p.Title,
                Url        = p.Url.AbsoluteUri,
                TopComment = p.Comments.OrderByDescending(c => c.Score).First().Body
            });
            return(View(vm));
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.ViewModel = new RedditViewModel();

            this.ViewModel
            .Bind(this.indicator)
            .IsAnimating(vm => vm.IsUpdating)
            .Visible(vm => vm.IsUpdating)
            .Bind(this.tableView)
            .Hidden(vm => vm.IsUpdating);

            this.UpdateSource();

            this.ViewModel.UpdateCommand.Execute(null);

            this.segmented.ValueChanged += (sender, e) => this.UpdateSource();
        }
Example #9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var layout = this.collectionView.CollectionViewLayout as UICollectionViewFlowLayout;

            layout.ItemSize            = new CoreGraphics.CGSize(60, 60);
            layout.HeaderReferenceSize = new CoreGraphics.CGSize(1000, 40);

            this.ViewModel = new RedditViewModel();

            this.ViewModel
            .Bind(this.indicator)
            .IsAnimating(vm => vm.IsUpdating)
            .Visible(vm => vm.IsUpdating)
            .Bind(this.collectionView)
            .Hidden(vm => vm.IsUpdating);

            this.UpdateSource();

            this.ViewModel.UpdateCommand.Execute(null);

            this.segmented.ValueChanged += (sender, e) => this.UpdateSource();
        }
Example #10
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            RedditViewModel viewModel = new RedditViewModel();

            listBox1.ItemsSource = viewModel.Entries;
        }
 public TemporaryRedditViewModel(IBaconProvider baconProvider)
 {
     _redditViewModel = new RedditViewModel(baconProvider);
 }