Example #1
0
        private async void ButtonPinToStart_Click(object sender, RoutedEventArgs e)
        {
            if ((AppBarButtonPin.Icon as SymbolIcon).Symbol == Symbol.Pin)
            {
                try
                {
                    var currAccount = ViewModel.MainScreenViewModel.CurrentAccount;
                    var currData    = await AccountDataStore.Get(currAccount.LocalAccountId);

                    await ScheduleTileHelper.PinTile(currAccount, currData);

                    UpdatePinVisibility();
                }

                catch (Exception ex)
                {
                    TelemetryExtension.Current?.TrackException(ex);
                }
            }

            else
            {
                try
                {
                    await ScheduleTileHelper.UnpinTile(ViewModel.MainScreenViewModel.CurrentLocalAccountId);

                    UpdatePinVisibility();
                }

                catch (Exception ex)
                {
                    TelemetryExtension.Current?.TrackException(ex);
                }
            }
        }
Example #2
0
        private async void UpdatePreviewTileNotifications()
        {
            try
            {
                XmlDocument notifContent = await ScheduleTileHelper.GetCurrentTileNotificationContentAsync(ViewModel.Account);

                if (notifContent == null)
                {
                    foreach (var tile in AllTiles())
                    {
                        tile.CreateTileUpdater().Clear();
                    }
                }

                else
                {
                    foreach (var tile in AllTiles())
                    {
                        tile.CreateTileUpdater().Update(new TileNotification(notifContent));
                    }
                }
            }

            catch (Exception ex)
            {
                TelemetryExtension.Current?.TrackException(ex);
            }
        }
Example #3
0
        private void UpdatePinVisibility()
        {
            if (ScheduleTileHelper.IsPinned(ViewModel.MainScreenViewModel.CurrentLocalAccountId))
            {
                AppBarButtonPin.Icon  = new SymbolIcon(Symbol.UnPin);
                AppBarButtonPin.Label = LocalizedResources.Common.GetStringUnpinFromStart();
            }

            else
            {
                AppBarButtonPin.Icon  = new SymbolIcon(Symbol.Pin);
                AppBarButtonPin.Label = LocalizedResources.Common.GetStringPinToStart();
            }
        }
Example #4
0
        private void UpdatePinButton()
        {
            try
            {
                if (ScheduleTileHelper.IsPinned(ViewModel.Account.LocalAccountId))
                {
                    appBarPin.Icon  = new SymbolIcon(Symbol.UnPin);
                    appBarPin.Label = LocalizedResources.GetString("Tile_UnpinTile");
                }

                else
                {
                    appBarPin.Icon  = new SymbolIcon(Symbol.Pin);
                    appBarPin.Label = LocalizedResources.GetString("Tile_PinTile");
                }
            }

            catch (Exception ex)
            {
                TelemetryExtension.Current?.TrackException(ex);
            }
        }
Example #5
0
        private async void appBarPin_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if ((appBarPin.Icon as SymbolIcon).Symbol == Symbol.Pin)
                {
                    var data = await AccountDataStore.Get(ViewModel.Account.LocalAccountId);

                    await ScheduleTileHelper.PinTile(ViewModel.Account, data);
                }

                else
                {
                    await ScheduleTileHelper.UnpinTile(ViewModel.Account.LocalAccountId);
                }

                UpdatePinButton();
            }

            catch (Exception ex)
            {
                TelemetryExtension.Current?.TrackException(ex);
            }
        }