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); }