예제 #1
0
 private void HandleAnimation(BootPromotion promo)
 {
     PromotionControl.AnimateImage(this.mPromotionImage, promo.ImagePath);
     if (string.IsNullOrEmpty(promo.ButtonText))
     {
         return;
     }
     this.mPromoButton.Visibility = Visibility.Visible;
     this.mPromoButton.Content    = (object)promo.ButtonText;
 }
예제 #2
0
 private void StartAnimation(SerializableDictionary <string, BootPromotion> dict)
 {
     this.PromoControl.Dispatcher.Invoke((Delegate)(() =>
     {
         this.dictRunningPromotions = dict.DeepCopy <SerializableDictionary <string, BootPromotion> >();
         if (dict.Count <= 0)
         {
             return;
         }
         List <KeyValuePair <string, BootPromotion> > myList = dict.ToList <KeyValuePair <string, BootPromotion> >();
         myList.Sort((Comparison <KeyValuePair <string, BootPromotion> >)((pair1, pair2) => pair1.Value.Order.CompareTo(pair2.Value.Order)));
         this.mPromotionImageGrid.Background = (Brush) new SolidColorBrush(Color.FromArgb(byte.MaxValue, (byte)0, (byte)0, (byte)0));
         this.mRunPromotion = true;
         this.mSliderAnimationThread = new Thread((ThreadStart)(() =>
         {
             this.mThreadId = this.mSliderAnimationThread.ManagedThreadId;
             Dictionary <BootPromotion, int> bootPromos = new Dictionary <BootPromotion, int>();
             while (this.mRunPromotion)
             {
                 if (this.mThreadId != Thread.CurrentThread.ManagedThreadId)
                 {
                     break;
                 }
                 try
                 {
                     foreach (KeyValuePair <string, BootPromotion> keyValuePair in myList)
                     {
                         KeyValuePair <string, BootPromotion> item = keyValuePair;
                         if (this.mRunPromotion)
                         {
                             if (this.mThreadId == Thread.CurrentThread.ManagedThreadId)
                             {
                                 if (this.currentBootPromotion == null)
                                 {
                                     this.currentBootPromotion = item.Value;
                                 }
                                 this.PromoControl.Dispatcher.Invoke((Delegate)(() =>
                                 {
                                     this.HandleAnimation(item.Value);
                                     this.currentBootPromotion = item.Value;
                                     this.SetLoadingText(item.Value.ButtonText);
                                     if (bootPromos.ContainsKey(item.Value))
                                     {
                                         bootPromos[item.Value] = bootPromos[item.Value] + 1;
                                     }
                                     else
                                     {
                                         bootPromos.Add(item.Value, 1);
                                     }
                                     PromotionControl.sBootPromotionDisplayed = bootPromos;
                                 }));
                                 this.mBootPromotionImageTimeout = PromotionObject.Instance.BootPromoDisplaytime;
                                 Thread.Sleep(this.mBootPromotionImageTimeout);
                             }
                             else
                             {
                                 break;
                             }
                         }
                         else
                         {
                             break;
                         }
                     }
                 }
                 catch (Exception ex)
                 {
                     Logger.Error(ex.ToString());
                 }
             }
         }))
         {
             IsBackground = true
         };
         this.mSliderAnimationThread.Start();
     }));
 }