protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            if (e.NavigationMode == NavigationMode.Back) return;
            string id;
            if (NavigationContext.QueryString.TryGetValue("id", out id))
            {
                var request = new GetImagesOfAnimeRequest(id);
                request.ProcessSuccessfully += (data) =>
                {
                    var images = (ImagesJson)data;
                    if (data == null || images == null) return;
                    Dispatcher.BeginInvoke(() =>
                    {
                        for (int i = 0; i < images.Count; i += 2)
                        {
                            var lControl = new ImageControl(images._content[i]);
                            LeftPanel.Children.Add(lControl);
                            if ((i + 1) == images.Count) break;
                            var rControl = new ImageControl(images._content[i + 1]);
                            RightPanel.Children.Add(rControl);
                        }
                    });

                };
                GlobalVariables.WorkerRequest.AddRequest(request);
            }
        }
 private void AddCategory(string data)
 {
     var list = ParseCategory(data);
     for (int i = 0; i < list.Count; i += 2)
     {
         var control = new ImageControl(list[i]);
         LeftPanel.Children.Add(control);
         if ((i + 1) == list.Count) break;
         var control2 = new ImageControl(list[i + 1]);
         RightPanel.Children.Add(control2);
     }
 }
Esempio n. 3
0
 private void SearchControl_OnSearch(string query)
 {
     Loading.Visibility = Visibility.Visible;
     var queryNoSpace = RemoveAllSpace(query);
     foreach (var animeCategory in _animeDict)
     {
         var name = animeCategory.Key;
         if (name.Contains(queryNoSpace))
         {
             var control = new ImageControl(animeCategory.Value);
             ResultPanel.Children.Add(control);
         }
     }
     Focus();
     Loading.Visibility = Visibility.Collapsed;
 }