Пример #1
0
        private bool CreateEmojiSprites(SpritesPack pack)
        {
            Stopwatch            stopwatch    = Stopwatch.StartNew();
            List <EmojiDataItem> allDataItems = EmojiDataItem.GetAllDataItems();
            int             num1             = EmojiConstants.ColumnsCountVerticalOrientation * EmojiConstants.VerticalSpriteRowsCount;
            int             num2             = 0;
            string          str1             = "emojiSpriteVertical" + this.IsDarkTheme.ToString() + ".jpg";
            SolidColorBrush backgroundColor1 = Application.Current.Resources["PhoneMenuBackgroundBrush"] as SolidColorBrush;
            IEnumerator <IEnumerable <EmojiDataItem> > enumerator1 = allDataItems.Partition <EmojiDataItem>(num1).GetEnumerator();

            try
            {
                while (((IEnumerator)enumerator1).MoveNext())
                {
                    IEnumerable <EmojiDataItem> current = enumerator1.Current;
                    SpriteDescription           sprite  = SpriteCreatorHelper.TryCreateSprite(num1, (List <string>)Enumerable.ToList <string>(Enumerable.Select <EmojiDataItem, string>(current, (Func <EmojiDataItem, string>)(d => d.Uri.OriginalString))), (List <string>)Enumerable.ToList <string>(Enumerable.Select <EmojiDataItem, string>(current, (Func <EmojiDataItem, string>)(d => d.String))), num2.ToString() + str1, EmojiConstants.ColumnsCountVerticalOrientation, EmojiConstants.EmojiWidthInPixels, EmojiConstants.EmojiHeightInPixels, EmojiConstants.VerticalSpriteWidthInPixels, EmojiConstants.VerticalSpriteHeightInPixels, backgroundColor1);
                    ++num2;
                    if (sprite == null)
                    {
                        return(false);
                    }
                    pack.SpritesVertical.Add(sprite);
                }
            }
            finally
            {
                if (enumerator1 != null)
                {
                    ((IDisposable)enumerator1).Dispose();
                }
            }
            int    num3 = EmojiConstants.ColumnsCountHorizontalOrientation * EmojiConstants.HorizontalSpriteRowsCount;
            int    num4 = 0;
            string str2 = "emojiSprteHorizontal " + this.IsDarkTheme.ToString() + ".jpg";
            IEnumerator <IEnumerable <EmojiDataItem> > enumerator2 = allDataItems.Partition <EmojiDataItem>(num3).GetEnumerator();

            try
            {
                while (((IEnumerator)enumerator2).MoveNext())
                {
                    IEnumerable <EmojiDataItem> current = enumerator2.Current;
                    SpriteDescription           sprite  = SpriteCreatorHelper.TryCreateSprite(num3, (List <string>)Enumerable.ToList <string>(Enumerable.Select <EmojiDataItem, string>(current, (Func <EmojiDataItem, string>)(d => d.Uri.OriginalString))), (List <string>)Enumerable.ToList <string>(Enumerable.Select <EmojiDataItem, string>(current, (Func <EmojiDataItem, string>)(d => d.String))), num4.ToString() + str2, EmojiConstants.ColumnsCountHorizontalOrientation, EmojiConstants.EmojiWidthInPixels, EmojiConstants.EmojiHeightInPixels, EmojiConstants.HorizontalSpriteWidthInPixels, EmojiConstants.HorizontalSpriteHeightInPixels, backgroundColor1);
                    ++num4;
                    if (sprite == null)
                    {
                        return(false);
                    }
                    pack.SpritesHorizontal.Add(sprite);
                }
            }
            finally
            {
                if (enumerator2 != null)
                {
                    ((IDisposable)enumerator2).Dispose();
                }
            }
            stopwatch.Stop();
            return(true);
        }
Пример #2
0
 private void AddSprites(EmojiSpritesCreator eSpC)
 {
   Execute.ExecuteOnUIThread((Action) (() =>
   {
     SpritesPack spritesPack = eSpC.SpritesPack;
     List<SpriteDescription> spritesVertical = spritesPack.SpritesVertical;
     List<SpriteDescription> spritesHorizontal = spritesPack.SpritesHorizontal;
     this.myPanel.ClearItems();
     List<IVirtualizable> virtualizableList = new List<IVirtualizable>();
     for (int index = 0; index < spritesHorizontal.Count; ++index)
     {
       SpriteDescription vertSpriteDesc;
       if (index >= spritesVertical.Count)
         vertSpriteDesc = new SpriteDescription()
         {
           SpritePath = "",
           Elements = new List<SpriteElementData>()
         };
       else
         vertSpriteDesc = spritesVertical[index];
       SpriteDescription horSpriteDesc = spritesHorizontal[index];
       int num = this.IsHorizontal ? 1 : 0;
       SpriteItem spriteItem = new SpriteItem(vertSpriteDesc, horSpriteDesc, num != 0);
       if (index == 0)
         spriteItem.Margin = new Thickness(0.0, 6.0, 0.0, 0.0);
       virtualizableList.Add((IVirtualizable) spriteItem);
     }
     this.myPanel.AddItems((IEnumerable<IVirtualizable>) virtualizableList);
   }));
 }
Пример #3
0
 private void AddSprites(EmojiSpritesCreator eSpC)
 {
     Execute.ExecuteOnUIThread((Action)(() =>
     {
         SpritesPack spritesPack = eSpC.SpritesPack;
         List <SpriteDescription> spritesVertical = spritesPack.SpritesVertical;
         List <SpriteDescription> spritesHorizontal = spritesPack.SpritesHorizontal;
         this.myPanel.ClearItems();
         List <IVirtualizable> virtualizableList = new List <IVirtualizable>();
         for (int index = 0; index < spritesVertical.Count || index < spritesHorizontal.Count; ++index)
         {
             SpriteItem spriteItem = new SpriteItem(index < spritesVertical.Count ? spritesVertical[index] : new SpriteDescription(), index < spritesHorizontal.Count ? spritesHorizontal[index] : new SpriteDescription(), this.IsHorizontal);
             if (index == 0)
             {
                 spriteItem.Margin = new Thickness(0.0, 6.0, 0.0, 0.0);
             }
             virtualizableList.Add((IVirtualizable)spriteItem);
         }
         this.myPanel.AddItems((IEnumerable <IVirtualizable>)virtualizableList);
     }));
 }
Пример #4
0
        private bool CreateEmojiSprites(SpritesPack pack)
        {
            Stopwatch            stopwatch    = Stopwatch.StartNew();
            List <EmojiDataItem> allDataItems = EmojiDataItem.GetAllDataItems();
            int             num1             = EmojiConstants.ColumnsCountVerticalOrientation * EmojiConstants.VerticalSpriteRowsCount;
            int             num2             = 0;
            string          str1             = "emojiSpriteVertical" + this.IsDarkTheme.ToString() + ".jpg";
            SolidColorBrush backgroundColor1 = Application.Current.Resources["PhoneMenuBackgroundBrush"] as SolidColorBrush;

            foreach (IEnumerable <EmojiDataItem> source in allDataItems.Partition <EmojiDataItem>(num1))
            {
                SpriteDescription sprite = SpriteCreatorHelper.TryCreateSprite(num1, source.Select <EmojiDataItem, string>((Func <EmojiDataItem, string>)(d => d.Uri.OriginalString)).ToList <string>(), source.Select <EmojiDataItem, string>((Func <EmojiDataItem, string>)(d => d.String)).ToList <string>(), num2.ToString() + str1, EmojiConstants.ColumnsCountVerticalOrientation, EmojiConstants.EmojiWidthInPixels, EmojiConstants.EmojiHeightInPixels, EmojiConstants.VerticalSpriteWidthInPixels, EmojiConstants.VerticalSpriteHeightInPixels, backgroundColor1);
                ++num2;
                if (sprite == null)
                {
                    return(false);
                }
                pack.SpritesVertical.Add(sprite);
            }
            int    num3 = EmojiConstants.ColumnsCountHorizontalOrientation * EmojiConstants.HorizontalSpriteRowsCount;
            int    num4 = 0;
            string str2 = "emojiSprteHorizontal " + this.IsDarkTheme.ToString() + ".jpg";

            foreach (IEnumerable <EmojiDataItem> source in allDataItems.Partition <EmojiDataItem>(num3))
            {
                SpriteDescription sprite = SpriteCreatorHelper.TryCreateSprite(num3, source.Select <EmojiDataItem, string>((Func <EmojiDataItem, string>)(d => d.Uri.OriginalString)).ToList <string>(), source.Select <EmojiDataItem, string>((Func <EmojiDataItem, string>)(d => d.String)).ToList <string>(), num4.ToString() + str2, EmojiConstants.ColumnsCountHorizontalOrientation, EmojiConstants.EmojiWidthInPixels, EmojiConstants.EmojiHeightInPixels, EmojiConstants.HorizontalSpriteWidthInPixels, EmojiConstants.HorizontalSpriteHeightInPixels, backgroundColor1);
                ++num4;
                if (sprite == null)
                {
                    return(false);
                }
                pack.SpritesHorizontal.Add(sprite);
            }
            stopwatch.Stop();
            return(true);
        }