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();
        }
コード例 #2
0
        public override async void OnAppearing(object navigationContext)
        {
            // Init
            BandClient = navigationContext as BandClient;
            _personalizationManager = BandClient.PersonalizationManager;

            Base = new BandColor(10, 110, 20);
            HighContrast = new BandColor(20, 120, 30);
            Highlight = new BandColor(30, 130, 40);
            Lowlight = new BandColor(40, 140, 50);
            Muted = new BandColor(50, 150, 60);
            SecondaryText = new BandColor(60, 160, 70);
            MeTileImage = await ResourcesHelper.LoadBandImageFromResourceAsync("Resources/metile.png");

            base.OnAppearing(navigationContext);
        }