public BoardPinsPageViewModel(Context context)
     : base(context)
 {
     PinListViewModel     = new PinListViewModel(context, GetData);
     Title                = "画板";
     LeftHeaderVisibility = Visibility.Collapsed;
 }
示例#2
0
 public FollowingViewModel(Context context)
     : base(context)
 {
     Title              = "";
     PinListViewModel   = new PinListViewModel(context, GetPinList);
     BoardListViewModel = new BoardListViewModel(context, GetBoardList);
 }
        private async Task <IEnumerable <Pin> > GetPinList(uint startIndex, int page)
        {
            IsLoading = true;

            List <Pin> list = new List <Pin>();

            try
            {
                list = await Context.API.UserAPI.GetFollowing(PinListViewModel.GetMaxPinID());

                foreach (var item in list)
                {
                    item.Width = PinListViewModel.ColumnWidth;
                    if (item.file != null)
                    {
                        item.Height = ((PinListViewModel.ColumnWidth - 0.8) * item.file.height / item.file.width);
                    }
                }
                return(list);
            }
            catch (Exception ex)
            {
            }
            finally
            {
                IsLoading = false;
            }
            return(list);
        }
        private async Task <IEnumerable <Pin> > GetData(uint startIndex, int page)
        {
            if (CurrentBoard == null)
            {
                return(new List <Pin>());
            }

            IsLoading = true;
            try
            {
                var list = await Context.API.BoardAPI.GetPins(CurrentBoard.board_id, PinListViewModel.GetMaxPinID());

                foreach (var item in list)
                {
                    item.Width = PinListViewModel.ColumnWidth;
                    if (item.file != null)
                    {
                        item.Height = ((PinListViewModel.ColumnWidth - 0.8) * item.file.height / item.file.width);
                    }
                }
                return(list);
            }
            catch (Exception ex)
            {
            }
            finally
            {
                IsLoading = false;
            }
            return(null);
        }
示例#5
0
		public PinDetailViewModel(Context context)
			: base(context)
		{
			BoardListViewModel = new BoardListViewModel(context, GetBoardList);
			UserListViewModel = new UserListViewModel(context, GetLikeList);
			RecommendListViewModel = new PinListViewModel(context, GetRecommendList);
		}
示例#6
0
		public BoardPinsViewModel(Context context)
			: base(context)
		{
			PinListViewModel = new PinListViewModel(context, GetData);
			Title = "画板";
			LeftHeaderVisibility = Visibility.Collapsed;
		}
 public SearchPageViewModel(Context context)
     : base(context)
 {
     LeftHeaderVisibility = Windows.UI.Xaml.Visibility.Collapsed;
     PinListViewModel     = new PinListViewModel(context, GetData);
     KeyWord = "";
 }
示例#8
0
		public FollowingViewModel(Context context)
			: base(context)
		{
			Title = "";
			PinListViewModel = new PinListViewModel(context, GetPinList);
			BoardListViewModel = new BoardListViewModel(context, GetBoardList);
		}
示例#9
0
 public PinDetailViewModel(Context context)
     : base(context)
 {
     BoardListViewModel     = new BoardListViewModel(context, GetBoardList);
     UserListViewModel      = new UserListViewModel(context, GetLikeList);
     RecommendListViewModel = new PinListViewModel(context, GetRecommendList);
 }
示例#10
0
		public SearchViewModel(Context context)
			: base(context)
		{
			LeftHeaderVisibility = Windows.UI.Xaml.Visibility.Collapsed;
			PinListViewModel = new PinListViewModel(context, GetData);
			KeyWord = "";
			Title = "搜索";
		}
示例#11
0
        public HomePageViewModel(Context context)
            : base(context)
        {
            Title            = "发现";
            PinListViewModel = new PinListViewModel(context, GetData);

            SelecterVisibility = Visibility.Collapsed;
        }
示例#12
0
		public UserViewModel(Context context)
			: base(context)
		{
			MyPinListViewModel = new PinListViewModel(context, GetPinList);
			LikePinListViewModel = new PinListViewModel(context, GetLikePinList);
			BoardListViewModel = new BoardListViewModel(context, GetBoardList);
			FollowingListViewModel = new UserListViewModel(context, GetFollowingUserList);
			FollowerListViewModel = new UserListViewModel(context, GetFollowerList);
			//BoardListViewModel.BoardList = context.BoardList;
		}
示例#13
0
        public override void OnNavigatedTo(HBNavigationEventArgs e)
        {
            PinListViewModel model = e.Parameter as PinListViewModel;

            if (model != null)
            {
                PinListViewModel = model;
                PinListViewModel.OnSelectedChanged += PinListViewModel_OnSelectedChanged;
            }
        }
示例#14
0
 public UserPageViewModel(Context context)
     : base(context)
 {
     MyPinListViewModel     = new PinListViewModel(context, GetPinList);
     LikePinListViewModel   = new PinListViewModel(context, GetLikePinList);
     BoardListViewModel     = new BoardListViewModel(context, GetBoardList);
     FollowingListViewModel = new UserListViewModel(context, GetFollowingUserList);
     FollowerListViewModel  = new UserListViewModel(context, GetFollowerList);
     //BoardListViewModel.BoardList = context.BoardList;
 }
示例#15
0
		public HomeViewModel(Context context)
			: base(context)
		{
			Title = "发现";
			PinListViewModel = new PinListViewModel(context, GetData);
			PinListViewModel.TargetName = "HomePage";
			CategoryList = Context.CategoryList;
			SelecterVisibility = Visibility.Collapsed;
			LeftHeaderVisibility = Visibility.Collapsed;
		}
示例#16
0
 public HomeViewModel(Context context)
     : base(context)
 {
     Title                       = "发现";
     PinListViewModel            = new PinListViewModel(context, GetData);
     PinListViewModel.TargetName = "HomePage";
     CategoryList                = Context.CategoryList;
     SelecterVisibility          = Visibility.Collapsed;
     LeftHeaderVisibility        = Visibility.Collapsed;
 }
        public async override void OnNavigatedTo(HBNavigationEventArgs e)
        {
            try
            {
                var board = e.Parameter as Board;
                if (board == null || board == CurrentBoard)
                {
                    return;
                }

                CurrentBoard = await Context.API.BoardAPI.GetBoard(board.board_id);

                await PinListViewModel.ClearAndReload();
            }
            catch (Exception ex)
            { }
        }
示例#18
0
        public async override void Inited()
        {
            base.Inited();

            IsLoading = true;

            try
            {
                await CategoryList.LoadMoreItemsAsync(0);

                CurrentCategory = CategoryList[0];
                await PinListViewModel.ClearAndReload();
            }
            catch (Exception ex)
            { }
            finally
            {
                IsLoading = false;
            }
        }
示例#19
0
		public MessageViewModel(Context context)
			: base(context)
		{
			Title = "消息";
			PinListVM = new PinListViewModel(context, GetData);
		}
 public async override void Inited()
 {
     base.Inited();
     await PinListViewModel.ClearAndReload();
 }
示例#21
0
 public override void Dispose()
 {
     PinListViewModel.Dispose();
     base.Dispose();
 }
 public override Size ArrangeOverride(Size finalSize)
 {
     PinListViewModel.SetWidth(finalSize.Width);
     return(finalSize);
 }
示例#23
0
 public MessageViewModel(Context context)
     : base(context)
 {
     Title     = "消息";
     PinListVM = new PinListViewModel(context, GetData);
 }
示例#24
0
        private async Task <IEnumerable <Pin> > GetData(uint startIndex, int page)
        {
            if (CurrentCategory == null)
            {
                return(new List <Pin>());
            }

            IsLoading = true;
            try
            {
                var list = await CategoryApi.GetCategoryPinList(CurrentCategory.nav_link, 20, PinListViewModel.GetMaxPinID());

                foreach (var item in list)
                {
                    item.Width = PinListViewModel.ColumnWidth;
                    if (item.file != null)
                    {
                        item.Height = ((PinListViewModel.ColumnWidth - 0.8) * item.file.height / item.file.width);
                    }
                }
                if (list.Count == 0)
                {
                    PinListViewModel.PinList.NoMore();
                }
                else
                {
                    PinListViewModel.PinList.HasMore();
                }
                return(list);
            }
            catch (Exception ex)
            {
            }
            finally
            {
                IsLoading = false;
            }
            return(null);
        }