예제 #1
0
        public MotionFullInfoItem()
        {
            this.InitializeComponent();

            DataContext = new MotionFullInfoItemViewModel();
            ViewModel = (MotionFullInfoItemViewModel)DataContext;

            ViewModel.MotionClick = new ViewModelBase.CommandHandler(MotionClickHandler, true);
        }
예제 #2
0
 private void DownloadImage(ulong id, MotionFullInfoItemViewModel model)
 {
     var localIcon = FindLocalIcon(id);
     if (localIcon != null)
     {
         model.CoverImage = localIcon;
         return;
     }
     var motionInfoRequest = new GetMotionFullInfoStoreRequest(id);
     motionInfoRequest.ProcessSuccessfully += (data) =>
     {
         var imageDownload = new ImageDownload(data.motion_info.info.icon_url);
         BitmapImage cacheImage = imageDownload.FindInCacheOrLocal();
         if (cacheImage != null)
         {
             Dispatcher.BeginInvoke((Action)delegate
             {
                 model.CoverImage = cacheImage;
                 GlobalFunction.SaveIconImage(cacheImage, id);
             });
             return;
         }
         imageDownload.DownloadCompleted += (img) => Dispatcher.BeginInvoke((Action)delegate
         {
             model.CoverImage = img;
             GlobalFunction.SaveIconImage(img, id);
         });
         GlobalVariables.ImageDownloadWorker.AddDownload(imageDownload);
     };
     motionInfoRequest.ProcessError += (data, msg) =>
                                           {
                                               if (data == null) Debug.Fail(msg);
                                               else Debug.Fail(data.type.ToString(), msg);
                                           };
     GlobalVariables.StoreWorker.ForceAddRequest(motionInfoRequest);
 }