Exemple #1
0
        private void Champion_Select(object sender, MouseButtonEventArgs e)
        {
            if (IsReadOnly)
            {
                return;
            }
            var src  = sender as Border;
            var data = (((dynamic)src).DataContext).Data
                       as MyChampDto;

            if (data != SelectedChampion)
            {
                //foreach (var item in ChampsGrid.Items)
                //  VisualTreeHelper
                //    .GetChild(ChampsGrid.ItemContainerGenerator.ContainerFromItem(item), 0)
                //    .SetValue(Border.BorderBrushProperty, Brushes.Transparent);

                //src.BorderBrush = App.FocusBrush;
                if (data == null)
                {
                    return;
                }
                if (ChampSelected != null)
                {
                    ChampSelected(this, data);
                }
                SelectedChampion = data;
            }

            var riotDto = Session.Current.RiotChampions.FirstOrDefault(c => c.ChampionId == data.key);

            skins.Clear();
            foreach (var item in SelectedChampion.skins)
            {
                var riot = riotDto.ChampionSkins.FirstOrDefault(s => s.SkinId == item.id);
                if (item.num == 0 || riot.Owned)
                {
                    skins.Add(item);
                }
            }
            if (skins.Count == 1)
            {
                if (SkinSelected != null)
                {
                    SkinSelected(this, skins[0]);
                }
                SelectedSkin = skins[0];
                return;
            }
            UpdateSkinList();

            ChampSelect.Visibility = Visibility.Hidden;
            SkinSelect.Visibility  = Visibility.Visible;
            SkinScroll.ScrollToHorizontalOffset(294);
        }
Exemple #2
0
 private void SkinGrid_Scroll(object sender, MouseWheelEventArgs e)
 {
     if (e.Delta > 0)
     {
         SkinScroll.LineLeft();
     }
     else
     {
         SkinScroll.LineRight();
     }
     e.Handled = true;
 }
Exemple #3
0
 public ChampSelector()
 {
     InitializeComponent();
     SkinScroll.ScrollToHorizontalOffset(290);
     if (Session.Current.Connected)
     {
         UpdateChampList();
     }
     else
     {
         SetChampList(DataDragon.ChampData.Value.data.Values);
     }
 }
Exemple #4
0
        private void UpdateSkinList()
        {
            var images = new List <object>();

            foreach (var item in skins)
            {
                images.Add(new {
                    Image = DataDragon.GetChampLoadingImage(SelectedChampion, item.num),
                    Name  = item.name,
                    Data  = item
                });
            }
            SkinsGrid.ItemsSource = images;
            SkinScroll.ScrollToHorizontalOffset(294);
        }