Example #1
0
        private void GetPurchasedList(uint start, uint end)
        {
            var purchaseRequest = new GetMotionDownloadByUserStoreRequest(start, end);

            purchaseRequest.ProcessSuccessfully += reply =>
                                                   Dispatcher.BeginInvoke((Action) delegate
            {
                foreach (var motionInfo in reply.user_motion.motion_short_info)
                {
                    numberMotions++;
                    var motion = new MotionItemVertical();
                    motion.SetInfo(motionInfo);
                    ViewModel.PurchasedMotionList.Add(motion);
                    motion.MotionClicked += PurchasedMotion_MotionClicked;
                    DownloadMotionImage(motionInfo.icon_url, motion);
                }
                StaticMainWindow.Window.ShowContentScreen();
            });
            purchaseRequest.ProcessError += (reply, msg) =>
            {
                if (reply == null)
                {
                    Debug.Fail("reply is null");
                }
                else
                {
                    Debug.Fail(reply.type.ToString(), msg);
                }
                Dispatcher.BeginInvoke((Action)(() => StaticMainWindow.Window.ShowErrorScreen()));
            };
            GlobalVariables.StoreWorker.ForceAddRequest(purchaseRequest);
        }
Example #2
0
        public void UpdateSearchList(uint start, uint end)
        {
            var searchRequest = new SearchMotionStoreRequest(Query, start, end);

            searchRequest.ProcessSuccessfully += (reply) =>
                                                 Dispatcher.BeginInvoke((Action) delegate
            {
                if (reply.search_motion.motion_short_info.Count == 0 && FirstLoad)
                {
                    ViewModel.NoResultVisibility = true;
                    //return;
                }
                foreach (var info in reply.search_motion.motion_short_info)
                {
                    var motionFull = new MotionItemVertical();
                    motionFull.SetInfo(info);
                    motionFull.MotionClicked += motionFull_MotionClicked;
                    UpdateSearchMotionCover(info.icon_url, motionFull);
                    ViewModel.SearchList.Add(motionFull);
                    numberSearchItem++;
                    //for (int i = 0; i < 10; i++)
                    //{
                    //    var motionFull = new MotionItemVertical();
                    //    motionFull.SetInfo(info);
                    //    motionFull.MotionClicked += motionFull_MotionClicked;
                    //    UpdateSearchMotionCover(info.icon_url, motionFull);
                    //    ViewModel.SearchList.Add(motionFull);

                    //}
                }
                if (FirstLoad)
                {
                    StaticMainWindow.Window.ShowContentScreen();
                    FirstLoad = false;
                }
            });
            searchRequest.ProcessError += (reply, msg) =>
            {
                Debug.Fail(msg, reply.type.ToString());
                if (FirstLoad)
                {
                    Dispatcher.BeginInvoke((Action)(() => StaticMainWindow.Window.ShowErrorScreen()));
                }
            };
            GlobalVariables.StoreWorker.ForceAddRequest(searchRequest);
        }
Example #3
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);
        }
        public void UpdateSearchList(uint start, uint end)
        {
            var searchRequest = new SearchMotionStoreRequest(Query, start, end);
            searchRequest.ProcessSuccessfully += (reply) =>
              Dispatcher.BeginInvoke((Action)delegate
                {
                    if (reply.search_motion.motion_short_info.Count == 0 && FirstLoad)
                    {
                        ViewModel.NoResultVisibility = true;
                        //return;
                    }
                    foreach (var info in reply.search_motion.motion_short_info)
                    {
                        var motionFull = new MotionItemVertical();
                        motionFull.SetInfo(info);
                        motionFull.MotionClicked += motionFull_MotionClicked;
                        UpdateSearchMotionCover(info.icon_url, motionFull);
                        ViewModel.SearchList.Add(motionFull);
                        numberSearchItem++;
                        //for (int i = 0; i < 10; i++)
                        //{
                        //    var motionFull = new MotionItemVertical();
                        //    motionFull.SetInfo(info);
                        //    motionFull.MotionClicked += motionFull_MotionClicked;
                        //    UpdateSearchMotionCover(info.icon_url, motionFull);
                        //    ViewModel.SearchList.Add(motionFull);

                        //}

                    }
                    if (FirstLoad)
                    {
                        StaticMainWindow.Window.ShowContentScreen();
                        FirstLoad = false;
                    }
                });
            searchRequest.ProcessError += (reply, msg) =>
            {
                Debug.Fail(msg, reply.type.ToString());
                if (FirstLoad) Dispatcher.BeginInvoke((Action)(() => StaticMainWindow.Window.ShowErrorScreen()));
            };
            GlobalVariables.StoreWorker.ForceAddRequest(searchRequest);
        }
Example #5
0
        private void GetMotionOfArtist()
        {
            var countRequest = new GetNumberMotionOfArtistStoreRequest(ArtistID);

            countRequest.ProcessSuccessfully += (countReply) =>
            {
                Dispatcher.BeginInvoke((Action) delegate { ViewModel.NumberMotion = countReply.number_motion_artist.number_motion; });
                var motionRequest = new GetMotionOfArtistStoreRequest(ArtistID, 0, countReply.number_motion_artist.number_motion);
                motionRequest.ProcessSuccessfully += (motionReply) =>
                                                     Dispatcher.BeginInvoke((Action) delegate
                {
                    foreach (var motionInfo in motionReply.artist_motion.motion_short_info)
                    {
                        var motionItemVertical = new MotionItemVertical();
                        motionItemVertical.SetInfo(motionInfo);
                        ViewModel.ArtistMotionsList.Add(motionItemVertical);
                        motionItemVertical.MotionClicked += motionItemVertical_MotionClicked;
                        DownloadMotionImage(motionInfo.icon_url, motionItemVertical);
                        //for (int i = 0; i < 20; i++)
                        //{
                        //    var motionItemVertical = new MotionItemVertical();
                        //    motionItemVertical.SetInfo(motionInfo);
                        //    ViewModel.ArtistMotionsList.Add(motionItemVertical);
                        //}
                    }
                    StaticMainWindow.Window.ShowContentScreen();
                });
                motionRequest.ProcessError += (motionReply, msg) =>
                {
                    Debug.Assert(false, motionReply.type.ToString() + msg);
                    Dispatcher.BeginInvoke((Action)(() => StaticMainWindow.Window.ShowErrorScreen()));
                };
                GlobalVariables.StoreWorker.ForceAddRequest(motionRequest);
            };
            countRequest.ProcessError += (countReply, msg) =>
            {
                Debug.Assert(false, msg + countReply.type.ToString());
                Dispatcher.BeginInvoke((Action)(() => StaticMainWindow.Window.ShowErrorScreen()));
            };
            GlobalVariables.StoreWorker.ForceAddRequest(countRequest);
        }
Example #6
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);
        }
        private void UpdateRelatedMotions(uint start, uint end)
        {
            var relatedRequest = new GetMotionOfArtistStoreRequest(Info.artist_id, start, end);

            relatedRequest.ProcessSuccessfully += (reply) =>
                                                  Dispatcher.BeginInvoke((Action) delegate
            {
                foreach (var motionInfo in reply.artist_motion.motion_short_info)
                {
                    if (MotionID == motionInfo.motion_id)
                    {
                        continue;
                    }
                    var verticalMotionItem = new MotionItemVertical();
                    verticalMotionItem.SetInfo(motionInfo);
                    verticalMotionItem.MotionClicked += RelatedMotions_MotionClicked;
                    ViewModel.RelatedMotionsList.Add(verticalMotionItem);
                    UpdateRelatedMotionCover(motionInfo.icon_url, verticalMotionItem);
                }
            });
            relatedRequest.ProcessError += (reply, msg) => Debug.Assert(false, msg);
            GlobalVariables.StoreWorker.ForceAddRequest(relatedRequest);
        }
 private void GetMotionOfArtist()
 {
     var countRequest = new GetNumberMotionOfArtistStoreRequest(ArtistID);
     countRequest.ProcessSuccessfully += (countReply) =>
     {
         Dispatcher.BeginInvoke((Action)delegate { ViewModel.NumberMotion = countReply.number_motion_artist.number_motion; });
         var motionRequest = new GetMotionOfArtistStoreRequest(ArtistID, 0, countReply.number_motion_artist.number_motion);
         motionRequest.ProcessSuccessfully += (motionReply) =>
             Dispatcher.BeginInvoke((Action)delegate
             {
                 foreach (var motionInfo in motionReply.artist_motion.motion_short_info)
                 {
                     var motionItemVertical = new MotionItemVertical();
                     motionItemVertical.SetInfo(motionInfo);
                     ViewModel.ArtistMotionsList.Add(motionItemVertical);
                     motionItemVertical.MotionClicked += motionItemVertical_MotionClicked;
                     DownloadMotionImage(motionInfo.icon_url, motionItemVertical);
                     //for (int i = 0; i < 20; i++)
                     //{
                     //    var motionItemVertical = new MotionItemVertical();
                     //    motionItemVertical.SetInfo(motionInfo);
                     //    ViewModel.ArtistMotionsList.Add(motionItemVertical);
                     //}
                 }
                 StaticMainWindow.Window.ShowContentScreen();
             });
         motionRequest.ProcessError += (motionReply, msg) =>
         {
             Debug.Assert(false, motionReply.type.ToString() + msg);
             Dispatcher.BeginInvoke((Action)(() => StaticMainWindow.Window.ShowErrorScreen()));
         };
         GlobalVariables.StoreWorker.ForceAddRequest(motionRequest);
     };
     countRequest.ProcessError += (countReply, msg) =>
     {
         Debug.Assert(false, msg + countReply.type.ToString());
         Dispatcher.BeginInvoke((Action)(() => StaticMainWindow.Window.ShowErrorScreen()));
     };
     GlobalVariables.StoreWorker.ForceAddRequest(countRequest);
 }
 private void UpdateRelatedMotions(uint start, uint end)
 {
     var relatedRequest = new GetMotionOfArtistStoreRequest(Info.artist_id, start, end);
     relatedRequest.ProcessSuccessfully += (reply) =>
         Dispatcher.BeginInvoke((Action)delegate
         {
             foreach (var motionInfo in reply.artist_motion.motion_short_info)
             {
                 if (MotionID == motionInfo.motion_id) continue;
                 var verticalMotionItem = new MotionItemVertical();
                 verticalMotionItem.SetInfo(motionInfo);
                 verticalMotionItem.MotionClicked += RelatedMotions_MotionClicked;
                 ViewModel.RelatedMotionsList.Add(verticalMotionItem);
                 UpdateRelatedMotionCover(motionInfo.icon_url, verticalMotionItem);
             }
         });
     relatedRequest.ProcessError += (reply, msg) => Debug.Assert(false, msg);
     GlobalVariables.StoreWorker.ForceAddRequest(relatedRequest);
 }
Example #10
0
 private void GetPurchasedList(uint start, uint end)
 {
     var purchaseRequest = new GetMotionDownloadByUserStoreRequest(start, end);
     purchaseRequest.ProcessSuccessfully += reply =>
         Dispatcher.BeginInvoke((Action)delegate
         {
             foreach (var motionInfo in reply.user_motion.motion_short_info)
             {
                 numberMotions++;
                 var motion = new MotionItemVertical();
                 motion.SetInfo(motionInfo);
                 ViewModel.PurchasedMotionList.Add(motion);
                 motion.MotionClicked += PurchasedMotion_MotionClicked;
                 DownloadMotionImage(motionInfo.icon_url, motion);
             }
             StaticMainWindow.Window.ShowContentScreen();
         });
     purchaseRequest.ProcessError += (reply, msg) =>
     {
         if(reply==null) Debug.Fail("reply is null");
         else Debug.Fail(reply.type.ToString(), msg);
         Dispatcher.BeginInvoke((Action)(() => StaticMainWindow.Window.ShowErrorScreen()));
     };
     GlobalVariables.StoreWorker.ForceAddRequest(purchaseRequest);
 }