Esempio n. 1
0
        private void RefreshSavedLocationsItems()
        {
            if (SavedLocationsListView == null || SavedLocationsListView.Items.Count == 0)
            {
                return;
            }

            foreach (LocationItem location in SavedLocationsListView.Items)
            {
                var isPinned = TileDesigner.IsSecondaryTilePinned(location);

                var item = (ListViewItem)SavedLocationsListView.ContainerFromItem(location);
                if (item == null)
                {
                    continue;
                }

                var slidableListItem = (SlidableListItem)item.ContentTemplateRoot;

                if (isPinned)
                {
                    slidableListItem.LeftLabel = App.ResourceLoader.GetString("Unpin");
                    slidableListItem.LeftIcon  = Symbol.UnPin;
                }
                else
                {
                    slidableListItem.LeftLabel = App.ResourceLoader.GetString("Pin");
                    slidableListItem.LeftIcon  = Symbol.Pin;
                }
            }
        }
Esempio n. 2
0
        private async void SlidableListItem_LeftCommandRequested(object sender, EventArgs e)
        {
            var item     = (SlidableListItem)sender;
            var location = (LocationItem)item.DataContext;

            var isPinned = TileDesigner.IsSecondaryTilePinned(location);

            if (isPinned)
            {
                var unpinSuccess = await UnpinLocationOnStart(location);

                if (unpinSuccess)
                {
                    item.LeftLabel = App.ResourceLoader.GetString("Pin");
                    item.LeftIcon  = Symbol.Pin;

                    DataTransfer.ShowLocalToast(App.ResourceLoader.GetString("UnpinSuccess"));
                }

                return;
            }

            var pinSuccess = await PinLocationOnStart(location);

            if (pinSuccess)
            {
                item.LeftLabel = App.ResourceLoader.GetString("Unpin");
                item.LeftIcon  = Symbol.UnPin;

                DataTransfer.ShowLocalToast(App.ResourceLoader.GetString("PinSuccess"));
            }
        }
Esempio n. 3
0
        private void SavedLocation_RightTapped(object sender, RightTappedRoutedEventArgs ev)
        {
            var listItem = (SlidableListItem)sender;
            var location = (LocationItem)listItem.DataContext;

            _lastLocationSelected = location;

            if (string.IsNullOrEmpty(location.Id))
            {
                return;
            }

            var isPinned = TileDesigner.IsSecondaryTilePinned(location);

            if (isPinned)
            {
                CmdUnpinLocation.Visibility = Visibility.Visible;
                CmdPinLocation.Visibility   = Visibility.Collapsed;
            }
            else
            {
                CmdUnpinLocation.Visibility = Visibility.Collapsed;
                CmdPinLocation.Visibility   = Visibility.Visible;
            }

            SavedLocationRightTappedFlyout.ShowAt(listItem);
        }
Esempio n. 4
0
        private void SavedLocation_Loaded(object sender, RoutedEventArgs e)
        {
            _delaySavedLocationList += 100;

            var item = (SlidableListItem)sender;

            item.Offset(0, 50, 0)
            .Fade(0, 0)
            .Then()
            .Offset(0)
            .Fade(1)
            .SetDelay(_delaySavedLocationList)
            .Start();

            var location = (LocationItem)item.DataContext;
            var isPinned = TileDesigner.IsSecondaryTilePinned(location);

            if (isPinned)
            {
                item.LeftLabel = App.ResourceLoader.GetString("Unpin");
                item.LeftIcon  = Symbol.UnPin;
            }
        }