Example #1
0
        private void GetMotionList(uint start, uint end)
        {
            var request = new ListCategoryMotionStoreRequest(ViewModel.CategoryType, start, end);
            request.ProcessSuccessfully += (reply) =>
            {
                Dispatcher.BeginInvoke((Action)delegate
                {
                    if (reply.list_motion.motion_short_info.Count == 0 && FirstLoad)
                    {
                        ViewModel.NoResultVisibility = true;
                    }
                    foreach (var info in reply.list_motion.motion_short_info)
                    {
                        var motion = new MotionItemVertical();
                        motion.SetInfo(info);
                        motion.MotionClicked += motion_MotionClicked;
                        UpdateMotionCover(info.icon_url, motion);
                        ViewModel.CategoryList.Add(motion);
                        TotalNumberMotion++;
                    }
                    if (FirstLoad)
                    {
                        StaticMainWindow.Window.ShowContentScreen();
                        FirstLoad = false;
                    }
                });

            };
            request.ProcessError += (reply, msg) =>
            {
                if (reply == null) Debug.Fail("reply is null");
                else
                {
                    Debug.Fail(msg, reply.type.ToString());
                    if (FirstLoad) Dispatcher.BeginInvoke((Action)(() => StaticMainWindow.Window.ShowErrorScreen()));
                }
            };
            GlobalVariables.StoreWorker.ForceAddRequest(request);
        }
Example #2
0
 private void GetHotList()
 {
     var hotListRequest = new ListCategoryMotionStoreRequest(CategoryMotionRequest.Type.TOPRATED, 0, 15);
     hotListRequest.ProcessSuccessfully += (reply) =>
         Dispatcher.BeginInvoke((Action)delegate
         {
             foreach (var info in reply.list_motion.motion_short_info)
             {
                 var motionItem = new MotionHorizontalItem();
                 motionItem.SetInfo(info);
                 motionItem.MotionClicked += motionItem_MotionClicked;
                 ViewModel.HotMotionsList.Add(motionItem);
                 DownloadImage(info.motion_id, info.icon_url, motionItem);
             }
             //hotListRequest.ProcessSuccessfully-=
         });
     hotListRequest.ProcessError += (reply, msg) =>
     {
         Debug.Assert(false, msg);
         Dispatcher.BeginInvoke((Action)(() => StaticMainWindow.Window.ShowErrorScreen()));
     };
     GlobalVariables.StoreWorker.ForceAddRequest(hotListRequest);
 }
Example #3
0
 private void GetRecommendedList()
 {
     var recommemendListRequest = new ListCategoryMotionStoreRequest(CategoryMotionRequest.Type.RECOMMENDED, 0, 3);
     recommemendListRequest.ProcessSuccessfully += (reply) =>
         Dispatcher.BeginInvoke((Action)delegate
         {
             List<MotionShortInfo> recommendList = reply.list_motion.motion_short_info;
             if (recommendList.Count > 0)
             {
                 DownloadCover(recommendList[0].cover, 2);
                 CoverIDList.Add(recommendList[0].motion_id);
             }
             if (recommendList.Count > 1)
             {
                 DownloadCover(recommendList[1].cover, 1);
                 CoverIDList.Add(recommendList[1].motion_id);
             }
             if (recommendList.Count > 2)
             {
                 DownloadCover(recommendList[2].cover, 3);
                 CoverIDList.Add(recommendList[2].motion_id);
             }
             if (recommendList.Count > 3)
             {
                 DownloadCover(recommendList[3].cover, 4);
                 CoverIDList.Add(recommendList[3].motion_id);
             }
         });
     recommemendListRequest.ProcessError += (reply, msg) =>
     {
         Debug.Assert(false, msg);
         Dispatcher.BeginInvoke((Action)(() => StaticMainWindow.Window.ShowErrorScreen()));
     };
     GlobalVariables.StoreWorker.ForceAddRequest(recommemendListRequest);
 }
Example #4
0
        private void GetFeaturedList()
        {
            var featuredListRequest = new ListCategoryMotionStoreRequest(CategoryMotionRequest.Type.FEATURE, 0, 16);
            featuredListRequest.ProcessSuccessfully += (reply) =>
                Dispatcher.BeginInvoke((Action)delegate
                {
                    foreach (var info in reply.list_motion.motion_short_info)
                    {
                        var motionItem = new MotionHorizontalItem();
                        motionItem.SetInfo(info);
                        motionItem.MotionClicked += motionItem_MotionClicked;
                        ViewModel.FeaturedMotionsList.Add(motionItem);
                        DownloadImage(info.motion_id, info.icon_url, motionItem);
                    }
                    StaticMainWindow.Window.ShowContentScreen();
                });
            featuredListRequest.ProcessError += (reply, msg) =>
            {
                Debug.Assert(false, msg);
                Dispatcher.BeginInvoke((Action)(() => StaticMainWindow.Window.ShowErrorScreen()));
            };

            //featuredListRequest.SuccesfullyEvent += OnFeaturedListRequestOnProcessSuccessfully;

            GlobalVariables.StoreWorker.ForceAddRequest(featuredListRequest);
        }