private async Task SetThemeCommandExecute()
 {
     await _personalizationManager.SetThemeAsync(new BandTheme
     {
         Base          = Base,
         HighContrast  = HighContrast,
         Highlight     = Highlight,
         Lowlight      = Lowlight,
         Muted         = Muted,
         SecondaryText = SecondaryText
     });
 }
Beispiel #2
0
        public PersonalizationViewModel(BandDeviceInfo info, BandClient bandClient)
            : base(info, bandClient)
        {
            personalizationManager = bandClient.PersonalizationManager;

            GetBandThemeCommand = new Command(async() =>
            {
                BandTheme = await personalizationManager.GetThemeAsync();
            });
            DefaultBandThemeCommand = new Command(() =>
            {
                BandTheme = App.DefaultTheme;
            });
            SetBandThemeCommand = new Command(async() =>
            {
                await personalizationManager.SetThemeAsync(BandTheme);
            });

            GetMeTileImageCommand = new Command(async() =>
            {
                MeTileImage = await personalizationManager.GetMeTileImageAsync();
            });
            DefaultMeTileImageCommand = new Command(async() =>
            {
                MeTileImage = await App.LoadImageResourceAsync("Resources/metile.png");
            });
            SelectMeTileImageCommand = new Command(async() =>
            {
                var photo = await CrossMedia.Current.PickPhotoAsync();
                if (photo != null)
                {
                    MeTileImage = await BandImage.FromStreamAsync(photo.GetStream());
                }
            }, () => CrossMedia.Current.IsPickPhotoSupported);
            SetMeTileImageCommand = new Command(async() =>
            {
                await personalizationManager.SetMeTileImageAsync(MeTileImage);
            });

            Init();
        }