Пример #1
0
        public static async Task <Uri> GetFileFromLocalAsync(string title)
        {
            Uri lFile;

            switch (title)
            {
            case "Sunny":
                lFile = await FileIOHelper.GetFileUriFromLocalAsync(sunny, local);

                break;

            case "Starry":
                lFile = await FileIOHelper.GetFileUriFromLocalAsync(starry, local);

                break;

            case "Cloudy":
                lFile = await FileIOHelper.GetFileUriFromLocalAsync(cloudy, local);

                break;

            case "Overcast":
                lFile = await FileIOHelper.GetFileUriFromLocalAsync(overcast, local);

                break;

            case "Rainny":
                lFile = await FileIOHelper.GetFileUriFromLocalAsync(rainny, local);

                break;

            case "Snowy":
                lFile = await FileIOHelper.GetFileUriFromLocalAsync(snowy, local);

                break;

            case "Foggy":
                lFile = await FileIOHelper.GetFileUriFromLocalAsync(foggy, local);

                break;

            case "Haze":
                lFile = await FileIOHelper.GetFileUriFromLocalAsync(haze, local);

                break;

            default:
                return(null);
            }
            return(lFile);
        }
Пример #2
0
        public async Task <Uri> GetCurrentBackgroundAsync(WeatherCondition condition, bool isNight)
        {
            Uri uri;

            switch (condition)
            {
            case WeatherCondition.unknown:
                return(null);

            case WeatherCondition.sunny:
            case WeatherCondition.windy:
            case WeatherCondition.calm:
            case WeatherCondition.light_breeze:
            case WeatherCondition.moderate:
            case WeatherCondition.fresh_breeze:
            case WeatherCondition.strong_breeze:
            case WeatherCondition.high_wind:
            case WeatherCondition.gale:
            case WeatherCondition.hot:
                if (isNight)
                {
                    if (Starry == ImmersiveBackgroundState.Assets)
                    {
                        uri = await FileIOHelper.GetFileUriFromAssetsAsync(starry, StarryPicked, StarryShuffle);
                    }
                    else if (Starry == ImmersiveBackgroundState.Local)
                    {
                        uri = await FileIOHelper.GetFileUriFromLocalAsync(starry, local);
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    if (Sunny == ImmersiveBackgroundState.Assets)
                    {
                        uri = await FileIOHelper.GetFileUriFromAssetsAsync(sunny, SunnyPicked, SunnyShuffle);
                    }
                    else if (Sunny == ImmersiveBackgroundState.Local)
                    {
                        uri = await FileIOHelper.GetFileUriFromLocalAsync(sunny, local);
                    }
                    else
                    {
                        return(null);
                    }
                }
                break;

            case WeatherCondition.cloudy:
            case WeatherCondition.few_clouds:
            case WeatherCondition.partly_cloudy:
                if (Cloudy == ImmersiveBackgroundState.Assets)
                {
                    uri = await FileIOHelper.GetFileUriFromAssetsAsync(cloudy, CloudyPicked, CloudyShuffle);
                }
                else if (Cloudy == ImmersiveBackgroundState.Local)
                {
                    uri = await FileIOHelper.GetFileUriFromLocalAsync(cloudy, local);
                }
                else
                {
                    return(null);
                }
                break;

            case WeatherCondition.overcast:
                if (Overcast == ImmersiveBackgroundState.Assets)
                {
                    uri = await FileIOHelper.GetFileUriFromAssetsAsync(overcast, OvercastPicked, OvercastShuffle);
                }
                else if (Overcast == ImmersiveBackgroundState.Local)
                {
                    uri = await FileIOHelper.GetFileUriFromLocalAsync(overcast, local);
                }
                else
                {
                    return(null);
                }
                break;

            case WeatherCondition.strong_gale:
            case WeatherCondition.storm:
            case WeatherCondition.violent_storm:
            case WeatherCondition.hurricane:
            case WeatherCondition.tornado:
            case WeatherCondition.tropical_storm:
            case WeatherCondition.shower_rain:
            case WeatherCondition.heavy_shower_rain:
            case WeatherCondition.thundershower:
            case WeatherCondition.heavy_thunderstorm:
            case WeatherCondition.hail:
            case WeatherCondition.light_rain:
            case WeatherCondition.moderate_rain:
            case WeatherCondition.heavy_rain:
            case WeatherCondition.extreme_rain:
            case WeatherCondition.drizzle_rain:
            case WeatherCondition.storm_rain:
            case WeatherCondition.heavy_storm_rain:
            case WeatherCondition.severe_storm_rain:
            case WeatherCondition.freezing_rain:
                if (Rainny == ImmersiveBackgroundState.Assets)
                {
                    uri = await FileIOHelper.GetFileUriFromAssetsAsync(rainny, RainnyPicked, RainnyShuffle);
                }
                else if (Rainny == ImmersiveBackgroundState.Local)
                {
                    uri = await FileIOHelper.GetFileUriFromLocalAsync(rainny, local);
                }
                else
                {
                    return(null);
                }
                break;

            case WeatherCondition.light_snow:
            case WeatherCondition.moderate_snow:
            case WeatherCondition.heavy_snow:
            case WeatherCondition.snowstorm:
            case WeatherCondition.sleet:
            case WeatherCondition.rain_snow:
            case WeatherCondition.shower_snow:
            case WeatherCondition.snow_flurry:
            case WeatherCondition.cold:
                if (Snowy == ImmersiveBackgroundState.Assets)
                {
                    uri = await FileIOHelper.GetFileUriFromAssetsAsync(snowy, SnowyPicked, SnowyShuffle);
                }
                else if (Snowy == ImmersiveBackgroundState.Local)
                {
                    uri = await FileIOHelper.GetFileUriFromLocalAsync(snowy, local);
                }
                else
                {
                    return(null);
                }
                break;

            case WeatherCondition.mist:
            case WeatherCondition.foggy:
                if (Foggy == ImmersiveBackgroundState.Assets)
                {
                    uri = await FileIOHelper.GetFileUriFromAssetsAsync(foggy, FoggyPicked, FoggyShuffle);
                }
                else if (Foggy == ImmersiveBackgroundState.Local)
                {
                    uri = await FileIOHelper.GetFileUriFromLocalAsync(foggy, local);
                }
                else
                {
                    return(null);
                }
                break;

            case WeatherCondition.haze:
            case WeatherCondition.sand:
            case WeatherCondition.dust:
            case WeatherCondition.volcanic_ash:
            case WeatherCondition.duststorm:
            case WeatherCondition.sandstorm:
                if (Haze == ImmersiveBackgroundState.Assets)
                {
                    uri = await FileIOHelper.GetFileUriFromAssetsAsync(haze, HazePicked, HazeShuffle);
                }
                else if (Haze == ImmersiveBackgroundState.Local)
                {
                    uri = await FileIOHelper.GetFileUriFromLocalAsync(haze, local);
                }
                else
                {
                    return(null);
                }
                break;

            default:
                return(null);
            }
            return(uri);
        }