コード例 #1
0
        private void Context_SetLocalComplete(object sender, ViewModels.Events.FetchDataCompleteEventArgs e)
        {
            if (Context.localFile != null)
            {
                var refresh = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, new Windows.UI.Core.DispatchedHandler(() =>
                {
                    var title = e.Parameter as string;
                    switch (title)
                    {
                    case "Sunny":
                        HideList(SunnyList, SunnyLocal, SunnyLocalGrid, SunnyButton);
                        break;

                    case "Starry":
                        HideList(StarryList, StarryLocal, StarryLocalGrid, StarryButton);
                        break;

                    case "Cloudy":
                        HideList(CloudyList, CloudyLocal, CloudyLocalGrid, CloudyButton);
                        break;

                    case "Overcast":
                        HideList(OvercastList, OvercastLocal, OvercastLocalGrid, OvercastButton);
                        break;

                    case "Rainny":
                        HideList(RainnyList, RainnyLocal, RainnyLocalGrid, RainnyButton);
                        break;

                    case "Snowy":
                        HideList(SnowyList, SnowyLocal, SnowyLocalGrid, SnowyButton);
                        break;

                    case "Foggy":
                        HideList(FoggyList, FoggyLocal, FoggyLocalGrid, FoggyButton);
                        break;

                    case "Haze":
                        HideList(HazeList, HazeLocal, HazeLocalGrid, HazeButton);
                        break;

                    default:
                        break;
                    }
                }));
            }
        }
コード例 #2
0
        private void Context_FetchDataComplete(object sender, ViewModels.Events.FetchDataCompleteEventArgs e)
        {
            var task = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, new Windows.UI.Core.DispatchedHandler(() =>
            {
                if (!Context.CurrentList.IsNullorEmpty())
                {
                    Root.SelectionChanged -= Root_SelectionChanged;
                    foreach (var item in Context.CurrentList)
                    {
                        try
                        {
                            item.Thumbnail = new BitmapImage(item.Path);
                        }
                        catch (Exception)
                        {
                        }
                    }
                    switch (Root.SelectedIndex)
                    {
                    case 0:
                        if (Context.localFile != null && Context.SunnyState == Models.ImmersiveBackgroundState.Local)
                        {
                            HideList(SunnyList, SunnyLocal, SunnyLocalGrid, SunnyButton);
                        }
                        else
                        {
                            ShowList(SunnyList, SunnyLocal, SunnyLocalGrid, SunnyButton);
                        }
                        SunnyList.SelectionChanged -= List_SelectionChanged;
                        SunnyList.ItemsSource       = Context.CurrentList;
                        SunnyList.SelectedIndex     = Context.sunnyP;
                        SunnyList.SelectionChanged += List_SelectionChanged;
                        break;

                    case 1:
                        if (Context.localFile != null && Context.StarryState == Models.ImmersiveBackgroundState.Local)
                        {
                            HideList(StarryList, StarryLocal, StarryLocalGrid, StarryButton);
                        }
                        else
                        {
                            ShowList(StarryList, StarryLocal, StarryLocalGrid, StarryButton);
                        }
                        StarryList.SelectionChanged -= List_SelectionChanged;
                        StarryList.ItemsSource       = Context.CurrentList;
                        StarryList.SelectedIndex     = Context.starryP;
                        StarryList.SelectionChanged += List_SelectionChanged;
                        break;

                    case 2:
                        if (Context.localFile != null && Context.CloudyState == Models.ImmersiveBackgroundState.Local)
                        {
                            HideList(CloudyList, CloudyLocal, CloudyLocalGrid, CloudyButton);
                        }
                        else
                        {
                            ShowList(CloudyList, CloudyLocal, CloudyLocalGrid, CloudyButton);
                        }
                        CloudyList.SelectionChanged -= List_SelectionChanged;
                        CloudyList.ItemsSource       = Context.CurrentList;
                        CloudyList.SelectedIndex     = Context.cloudyP;
                        CloudyList.SelectionChanged += List_SelectionChanged;
                        break;

                    case 3:
                        if (Context.localFile != null && Context.RainnyState == Models.ImmersiveBackgroundState.Local)
                        {
                            HideList(OvercastList, OvercastLocal, OvercastLocalGrid, OvercastButton);
                        }
                        else
                        {
                            ShowList(OvercastList, OvercastLocal, OvercastLocalGrid, OvercastButton);
                        }
                        OvercastList.SelectionChanged -= List_SelectionChanged;
                        OvercastList.ItemsSource       = Context.CurrentList;
                        OvercastList.SelectedIndex     = Context.overcastP;
                        OvercastList.SelectionChanged += List_SelectionChanged;
                        break;

                    case 4:
                        if (Context.localFile != null && Context.RainnyState == Models.ImmersiveBackgroundState.Local)
                        {
                            HideList(RainnyList, RainnyLocal, RainnyLocalGrid, RainnyButton);
                        }
                        else
                        {
                            ShowList(RainnyList, RainnyLocal, RainnyLocalGrid, RainnyButton);
                        }
                        RainnyList.SelectionChanged -= List_SelectionChanged;
                        RainnyList.ItemsSource       = Context.CurrentList;
                        RainnyList.SelectedIndex     = Context.rainnyP;
                        RainnyList.SelectionChanged += List_SelectionChanged;
                        break;

                    case 5:
                        if (Context.localFile != null && Context.SnowyState == Models.ImmersiveBackgroundState.Local)
                        {
                            HideList(SnowyList, SnowyLocal, SnowyLocalGrid, SnowyButton);
                        }
                        else
                        {
                            ShowList(SnowyList, SnowyLocal, SnowyLocalGrid, SnowyButton);
                        }
                        SnowyList.SelectionChanged -= List_SelectionChanged;
                        SnowyList.ItemsSource       = Context.CurrentList;
                        SnowyList.SelectedIndex     = Context.snowyP;
                        SnowyList.SelectionChanged += List_SelectionChanged;
                        break;

                    case 6:
                        if (Context.localFile != null && Context.FoggyState == Models.ImmersiveBackgroundState.Local)
                        {
                            HideList(FoggyList, FoggyLocal, FoggyLocalGrid, FoggyButton);
                        }
                        else
                        {
                            ShowList(FoggyList, FoggyLocal, FoggyLocalGrid, FoggyButton);
                        }
                        FoggyList.SelectionChanged -= List_SelectionChanged;
                        FoggyList.ItemsSource       = Context.CurrentList;
                        FoggyList.SelectedIndex     = Context.foggyP;
                        FoggyList.SelectionChanged += List_SelectionChanged;
                        break;

                    case 7:
                        if (Context.localFile != null && Context.HazeState == Models.ImmersiveBackgroundState.Local)
                        {
                            HideList(HazeList, HazeLocal, HazeLocalGrid, HazeButton);
                        }
                        else
                        {
                            ShowList(HazeList, HazeLocal, HazeLocalGrid, HazeButton);
                        }
                        HazeList.SelectionChanged -= List_SelectionChanged;
                        HazeList.ItemsSource       = Context.CurrentList;
                        HazeList.SelectedIndex     = Context.hazeP;
                        HazeList.SelectionChanged += List_SelectionChanged;
                        break;

                    default:
                        break;
                    }
                    Root.SelectionChanged += Root_SelectionChanged;
                }
            }));
        }