Ejemplo n.º 1
0
        public static bool IsPinned(MetaData metaData)
        {
            string path = string.Format("/FolderPage.xaml?path={0}&icon={1}", metaData.Path, metaData.Icon);
            var    tile = LiveTileHelper.GetTile(new Uri(path, UriKind.Relative));

            return(tile != null);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            if (watcher == null)
            {
                watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
                watcher.MovementThreshold = 50;
                watcher.StatusChanged    += new EventHandler <GeoPositionStatusChangedEventArgs>(watcher_StatusChanged);
                watcher.PositionChanged  += new EventHandler <GeoPositionChangedEventArgs <GeoCoordinate> >(watcher_PositionChanged);
            }

            watcher.Start();

            ShellTile tile = LiveTileHelper.GetTile(new Uri("/AddFill.xaml", UriKind.RelativeOrAbsolute));

            if (tile == null)
            {
                ApplicationBarMenuItem item = (ApplicationBarMenuItem)ApplicationBar.MenuItems[0];
                item.IsEnabled = true;
            }
            else
            {
                ApplicationBarMenuItem item = (ApplicationBarMenuItem)ApplicationBar.MenuItems[0];
                item.IsEnabled = false;
            }
        }
Ejemplo n.º 3
0
        public static void RemoveTile(MetaData metaData)
        {
            string path = string.Format("/FolderPage.xaml?path={0}&icon={1}", metaData.Path, metaData.Icon);
            var    tile = LiveTileHelper.GetTile(new Uri(path, UriKind.Relative));

            if (tile != null)
            {
                tile.Delete();
            }
        }
Ejemplo n.º 4
0
        public static void RemoveTile(string url)
        {
            var uri = new Uri(url, UriKind.RelativeOrAbsolute);

            var tile = LiveTileHelper.GetTile(uri);

            if (tile != null)
            {
                tile.Delete();
            }
        }
Ejemplo n.º 5
0
        public bool IsPinnedToDesktop(string bookId)
        {
            if (string.IsNullOrWhiteSpace(bookId))
            {
                throw new ArgumentException("bookId is invalid");
            }

            var uri = _navigationService.UriFor <ReadPageViewModel>()
                      .WithParam(vm => vm.BookId, bookId)
                      .WithParam(vm => vm.ToLastReadPage, true)
                      .BuildUri();

            bool tileExists = LiveTileHelper.GetTile(uri) != null;

            return(tileExists);
        }
Ejemplo n.º 6
0
        public static void UpdateLiveTile(string Title, string BackTitle, string BackContent, string PageUrl, string frontImg, string backImg)
        {
            RadExtendedTileData extendedData = new RadExtendedTileData();

            //extendedData.VisualElement = LayoutRoot;
            //extendedData.BackgroundImage = new Uri("appdata:Images/tile_173x173.png");
            extendedData.BackgroundImage = new Uri("appdata:Images/" + frontImg);
            extendedData.Title           = Title;
            //extendedData.Count = 5000;
            extendedData.BackTitle = BackTitle;
            //extendedData.BackBackgroundImage = new Uri("appdata:Images/tile_173x173.png");
            extendedData.BackBackgroundImage = new Uri("appdata:Images/" + backImg);
            extendedData.BackContent         = BackContent;
            //this will create a tile looking exactly as your page if it is placed inside a layout panel named LayoutRoot

            LiveTileHelper.UpdateTile(LiveTileHelper.GetTile(new Uri(PageUrl, UriKind.RelativeOrAbsolute)), extendedData, false);
        }
Ejemplo n.º 7
0
        /// <summary>
        ///
        /// </summary>
        public MainPage()
        {
            InitializeComponent();

            ShellTile tile = LiveTileHelper.GetTile(new Uri("/AddFill.xaml", UriKind.RelativeOrAbsolute));

            if (tile == null)
            {
                ApplicationBarMenuItem item = (ApplicationBarMenuItem)ApplicationBar.MenuItems[1];
                item.IsEnabled = true;
            }
            else
            {
                ApplicationBarMenuItem item = (ApplicationBarMenuItem)ApplicationBar.MenuItems[1];
                item.IsEnabled = false;
            }
        }
Ejemplo n.º 8
0
        public void DeleteTile(string bookId)
        {
            if (string.IsNullOrWhiteSpace(bookId))
            {
                throw new ArgumentException("bookId is invalid");
            }

            var uri = _navigationService.UriFor <ReadPageViewModel>()
                      .WithParam(vm => vm.BookId, bookId)
                      .WithParam(vm => vm.ToLastReadPage, true)
                      .BuildUri();

            var tile = LiveTileHelper.GetTile(uri);

            if (tile == null)
            {
                return;
            }

            tile.Delete();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Override of navigation to page
        /// </summary>
        /// <param name="e"></param>
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            string _name;

            if (NavigationContext.QueryString.TryGetValue("Name", out _name))
            {
                RefreshPage(_name);
            }

            ShellTile tile = LiveTileHelper.GetTile(new Uri("/VehicleInfo.xaml?Name=" + VehicleName.Text.ToString(), UriKind.RelativeOrAbsolute));

            if (tile == null)
            {
                ApplicationBarIconButton item = (ApplicationBarIconButton)ApplicationBar.Buttons[2];
                item.IsEnabled = true;
            }
            else
            {
                ApplicationBarIconButton item = (ApplicationBarIconButton)ApplicationBar.Buttons[2];
                item.IsEnabled = false;
            }

            base.OnNavigatedTo(e);
        }
Ejemplo n.º 10
0
 public static bool Exists(string uri)
 {
     return(LiveTileHelper.GetTile(new Uri(uri, UriKind.RelativeOrAbsolute)) != null);
 }