예제 #1
0
 public static void SetTile()
 {
     if (LiveTileHelper.AreNewTilesSupported)
     {
         if (ShellTile.ActiveTiles.Any())
         {
             var tile         = ShellTile.ActiveTiles.First();
             var flipTileData = new RadFlipTileData
             {
                 IsTransparencySupported = true,
                 //Title = International.Translations.AppName,
                 //BackTitle = International.Translations.AppName,
                 BackgroundImage     = new Uri("/Assets/FlipCycleTileSmall_159_159.png", UriKind.RelativeOrAbsolute),
                 WideBackgroundImage = new Uri("/Assets/FlipCycleTitleLarge_691_336.png", UriKind.RelativeOrAbsolute),
             };
             LiveTileHelper.UpdateTile(tile, flipTileData);
         }
     }
     else
     {
         if (ShellTile.ActiveTiles.Any())
         {
             var tile         = ShellTile.ActiveTiles.First();
             var flipTileData = new RadExtendedTileData
             {
                 Title           = string.Empty,
                 BackgroundImage = new Uri("/Assets/Background_173_173.png", UriKind.RelativeOrAbsolute),
             };
             LiveTileHelper.UpdateTile(tile, flipTileData);
         }
     }
 }
예제 #2
0
        private void PinToStart_Click(object sender, System.Windows.Input.GestureEventArgs e)
        {
            this.frontTile.SetCityName("No City Selected");
            this.radHubTile.Height = 173;
            this.radHubTile.Width  = 173;
            this.frontTile.SetProperties(new BitmapImage(new Uri("../Images/sunny.png", UriKind.RelativeOrAbsolute)),
                                         String.Format("25{0}", DegreeSign));

            this.backTile.SetProperties(new BitmapImage(new Uri("../Images/sunny-back.png", UriKind.RelativeOrAbsolute)),
                                        "test");
            this.radHubTile.FrontContent = this.frontTile;


            RadExtendedTileData tileData = new RadExtendedTileData()
            {
                VisualElement     = Tile,
                BackVisualElement = this.backTile
            };
            Uri       tileUri = new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute);
            ShellTile tile    = Telerik.Windows.Controls.LiveTileHelper.GetTile(tileUri);

            if (tile != null)
            {
                tile.Delete();
            }

            Telerik.Windows.Controls.LiveTileHelper.CreateTile(tileData, tileUri);
        }
예제 #3
0
        private void PinToStart_Click(object sender, System.Windows.Input.GestureEventArgs e)
        {
            this.frontTile.SetCityName("No City Selected");
            this.radHubTile.Height = 173;
            this.radHubTile.Width = 173;
            this.frontTile.SetProperties(new BitmapImage(new Uri("../Images/sunny.png", UriKind.RelativeOrAbsolute)),
                String.Format("25{0}", DegreeSign));

            this.backTile.SetProperties(new BitmapImage(new Uri("../Images/sunny-back.png", UriKind.RelativeOrAbsolute)),
              "test");
            this.radHubTile.FrontContent = this.frontTile;

            RadExtendedTileData tileData = new RadExtendedTileData()
            {
                VisualElement = Tile,
                BackVisualElement =  this.backTile
            };
            Uri tileUri = new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute);
            ShellTile tile = Telerik.Windows.Controls.LiveTileHelper.GetTile(tileUri);

            if (tile != null)
            {
                tile.Delete();
            }

            Telerik.Windows.Controls.LiveTileHelper.CreateTile(tileData, tileUri);
        }
예제 #4
0
        public static void CreateTile(MetaData metaData)
        {
            ImageSource imageSource = new BitmapImage(new Uri(string.Format("/TileIcon/{0}.png", metaData.Icon), UriKind.Relative));
            var visual = new LiveTileVisual();
            visual.SetProperties(metaData.Name, imageSource);
            var data = new RadExtendedTileData
                           {
                               VisualElement = visual
                           };

            string path = string.Format("/FolderPage.xaml?path={0}&icon={1}", metaData.Path, metaData.Icon);

            LiveTileHelper.CreateTile(data, new Uri(path, UriKind.Relative));
        }
예제 #5
0
        public static void CreateTile(MetaData metaData)
        {
            ImageSource imageSource = new BitmapImage(new Uri(string.Format("/TileIcon/{0}.png", metaData.Icon), UriKind.Relative));
            var         visual      = new LiveTileVisual();

            visual.SetProperties(metaData.Name, imageSource);
            var data = new RadExtendedTileData
            {
                VisualElement = visual
            };

            string path = string.Format("/FolderPage.xaml?path={0}&icon={1}", metaData.Path, metaData.Icon);


            LiveTileHelper.CreateTile(data, new Uri(path, UriKind.Relative));
        }
        private void RadImageButton_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
        {
            RadExtendedTileData tileData = new RadExtendedTileData()
            {
                VisualElement = Tile
            };
            Uri       tileUri = new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute);
            ShellTile tile    = Telerik.Windows.Controls.LiveTileHelper.GetTile(tileUri);

            if (tile != null)
            {
                tile.Delete();
            }

            Telerik.Windows.Controls.LiveTileHelper.CreateTile(tileData, tileUri);
        }
예제 #7
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);
        }
        private void RadImageButton_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
        {
            RadExtendedTileData tileData = new RadExtendedTileData()
            {
                VisualElement = Tile

            };
            Uri tileUri = new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute);
            ShellTile tile = Telerik.Windows.Controls.LiveTileHelper.GetTile(tileUri);

            if (tile != null)
            {
                tile.Delete();
            }

            Telerik.Windows.Controls.LiveTileHelper.CreateTile(tileData, tileUri);
        }
        public static void CreateLiveTile(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_back.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.CreateOrUpdateTile(extendedData, new Uri(PageUrl, UriKind.RelativeOrAbsolute));
        }
예제 #10
0
        public static void CreateUpdateStartTile(string name, string summary, string url, bool remove)
        {
            if (remove)
            {
                RemoveTile(url);
            }

            var control = new ItemTileControl();

            control.Initialize(name, summary);

            RadExtendedTileData extendedData = new RadExtendedTileData()
            {
                VisualElement = control,
                Title         = ApplicationManifestHelper.Read().Title,
            };


            LiveTileHelper.CreateOrUpdateTile(extendedData, new Uri(url, UriKind.RelativeOrAbsolute));
        }
예제 #11
0
        //void cityName_GotFocus(object sender, RoutedEventArgs e)
        //{
        //    MainViewModel.Instance.CurrentPage.ApplicationBar.IsVisible = false;
        //}

        //void cityName_LostFocus(object sender, RoutedEventArgs e)
        //{
        //    MainViewModel.Instance.CurrentPage.ApplicationBar.IsVisible = true;
        //}

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            RadExtendedTileData extendedData = new RadExtendedTileData()
            {
                VisualElement = frontTile
            };

            if (this.backTileCheckBox.IsChecked.Value == true)
            {
                extendedData.BackVisualElement = backTile;
            }

            Uri       tileUri = new Uri("/MainPage.xaml?redirect=true", UriKind.RelativeOrAbsolute);
            ShellTile tile    = Telerik.Windows.Controls.LiveTileHelper.GetTile(tileUri);

            if (tile != null)
            {
                tile.Delete();
            }

            Telerik.Windows.Controls.LiveTileHelper.CreateTile(extendedData, tileUri);
        }
        //void cityName_GotFocus(object sender, RoutedEventArgs e)
        //{
        //    MainViewModel.Instance.CurrentPage.ApplicationBar.IsVisible = false;
        //}
        //void cityName_LostFocus(object sender, RoutedEventArgs e)
        //{
        //    MainViewModel.Instance.CurrentPage.ApplicationBar.IsVisible = true;
        //}
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            RadExtendedTileData extendedData = new RadExtendedTileData()
            {
                VisualElement = frontTile
            };

            if (this.backTileCheckBox.IsChecked.Value == true)
            {
                extendedData.BackVisualElement = backTile;
            }

            Uri tileUri = new Uri("/MainPage.xaml?redirect=true", UriKind.RelativeOrAbsolute);
            ShellTile tile = Telerik.Windows.Controls.LiveTileHelper.GetTile(tileUri);

            if (tile != null)
            {
                tile.Delete();
            }

            Telerik.Windows.Controls.LiveTileHelper.CreateTile(extendedData, tileUri);
        }
예제 #13
0
        public void UpdateActiveTile()
        {
            Uri path = new Uri("/", UriKind.RelativeOrAbsolute);
            //Uri path = new Uri("/ProfilesPage.xml", UriKind.RelativeOrAbsolute);

            //ShellTile appTile = LiveTileHelper.GetTile(path);
            ShellTile appTile = ShellTile.ActiveTiles.First();

            if (LiveTileHelper.AreNewTilesSupported) // v7.8+
            {
                RadExtendedTileData extendedTileData = new RadExtendedTileData() { Title = Name };
                LiveTileHelper.CreateOrUpdateTile(extendedTileData, path);
                
                
                ////var tileData = new RadFlipTileData
                ////{
                ////    IsTransparencySupported = true,
                ////    Title = Name,
                ////    BackTitle = "Test back",//Constants.BackTitle,
                ////    BackgroundImage = new Uri("/Background.png", UriKind.RelativeOrAbsolute),
                ////    WideBackgroundImage = new Uri("/Assets/PageBackground.jpg", UriKind.RelativeOrAbsolute),
                ////};

                //var tileData = new IconicTileData
                //{
                //    Title = Name,
                //    SmallIconImage = new Uri("/Background.png", UriKind.RelativeOrAbsolute),
                //    IconImage = new Uri("/Background.png", UriKind.RelativeOrAbsolute),
                //    Count = ProfilesManager.Items.Count
                //};

                ////appTile.Delete();
                ////LiveTileHelper.CreateOrUpdateTile(tileData, path, true, true);

                ////LiveTileHelper.UpdateTile(appTile, tileData, true);

                ////appTile.Update((ShellTileData)tileData);
            }
            else
            {
                // these are not necessary!
                //RadExtendedTileData extendedTileData = new RadExtendedTileData() { Title = Name };
                //LiveTileHelper.CreateOrUpdateTile(extendedTileData, path);
            }
        }
예제 #14
0
        public static void SetTile()
        {
            if (LiveTileHelper.AreNewTilesSupported)
            {
                if (ShellTile.ActiveTiles.Any())
                {
                    var tile = ShellTile.ActiveTiles.First();
                    var flipTileData = new RadFlipTileData
                    {
                        IsTransparencySupported = true,
                        //Title = International.Translations.AppName,
                        //BackTitle = International.Translations.AppName,
                        BackgroundImage = new Uri("/Assets/FlipCycleTileSmall_159_159.png", UriKind.RelativeOrAbsolute),
                        WideBackgroundImage = new Uri("/Assets/FlipCycleTitleLarge_691_336.png", UriKind.RelativeOrAbsolute),

                    };
                    LiveTileHelper.UpdateTile(tile, flipTileData);
                }

            }
            else
            {
                if (ShellTile.ActiveTiles.Any())
                {
                    var tile = ShellTile.ActiveTiles.First();
                    var flipTileData = new RadExtendedTileData
                    {

                        Title = string.Empty,
                        BackgroundImage = new Uri("/Assets/Background_173_173.png", UriKind.RelativeOrAbsolute),

                    };
                    LiveTileHelper.UpdateTile(tile, flipTileData);
                }
            }
        }
예제 #15
0
        private void mPinToStart_Click(object sender, System.EventArgs e)
        {
            var tileData = new RadExtendedTileData()
            {
                Title = AppResources.AddLocationTitle,
                BackgroundImage = new Uri("/Assets/AddLocationTileImage.png", UriKind.Relative),
                IsTransparencySupported = false
            };

            LiveTileHelper.CreateOrUpdateTile(tileData, new Uri("/Views/AddLocation.xaml", UriKind.RelativeOrAbsolute));
        }
예제 #16
0
        public void UpdateTileSynchronous(List <BirthdayContact> tileContacts, int count = 0, Action callback = null)
        {
#if DEBUG
            DebugUtility.DebugOutputMemoryUsage("Beginning UpdateTileSynchronous");
#endif
            var displayName = "";
#if DEBUG
            DebugUtility.DebugOutputMemoryUsage("UpdateTileSynchronous - Loaded Data");
#endif

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
#if DEBUG
                DebugUtility.DebugOutputMemoryUsage("UpdateTileSynchronous - Medium Tile Control Created");
#endif
                ShellTile mainTile = ShellTile.ActiveTiles.First();
                using (IsolatedStorageFile appStorage = IsolatedStorageFile.GetUserStoreForApplication())
                {
#if WP8
                    RadFlipTileData tileData = null;
                    if (tileContacts.Count > 0)
                    {
                        displayName = tileContacts.First().DisplayName;
                        BirthdayTileBackViewModel backTileModel = new BirthdayTileBackViewModel(tileContacts);
                        MediumTileBackUserControl medBackTile   = new MediumTileBackUserControl()
                        {
                            DataContext = backTileModel
                        };
                        WideTileBackUserControl wideBackTile = new WideTileBackUserControl()
                        {
                            DataContext = backTileModel
                        };
                        tileData = new RadFlipTileData()
                        {
                            Title           = Resources.AppTitle.ToTitleCase(),
                            BackTitle       = Resources.AppTitle.ToTitleCase(),
                            BackgroundImage = appStorage.FileExists(string.Format(isoStorePath, displayName, "m")) ?
                                              new Uri(string.Format(isoStoreUri, displayName, "m"), UriKind.RelativeOrAbsolute) :
                                              new Uri("/Assets/Tiles/BirthdayTileMedium.png", UriKind.Relative),
                            BackVisualElement    = medBackTile,
                            SmallBackgroundImage = appStorage.FileExists(string.Format(isoStorePath, displayName, "s")) ?
                                                   new Uri(string.Format(isoStoreUri, displayName, "s"), UriKind.RelativeOrAbsolute) :
                                                   new Uri("/Assets/Tiles/BirthdayTileSmall.png", UriKind.RelativeOrAbsolute),
                            WideBackgroundImage = appStorage.FileExists(string.Format(isoStorePath, displayName, "w")) ?
                                                  new Uri(string.Format(isoStoreUri, displayName, "w"), UriKind.RelativeOrAbsolute) :
                                                  new Uri("/Assets/Tiles/BirthdayTileWide.png", UriKind.RelativeOrAbsolute),
                            WideBackVisualElement = wideBackTile
                        };
                    }
                    else
                    {
                        tileData = new RadFlipTileData()
                        {
                            Title                = Resources.AppTitle.ToTitleCase(),
                            BackgroundImage      = new Uri("/Assets/Tiles/BirthdayTileMedium.png", UriKind.Relative),
                            SmallBackgroundImage = new Uri("/Assets/Tiles/BirthdayTileSmall.png", UriKind.RelativeOrAbsolute),
                            WideBackgroundImage  = new Uri("/Assets/Tiles/BirthdayTileWide.png", UriKind.RelativeOrAbsolute),
                        };
                    }
#if DEBUG
                    DebugUtility.DebugOutputMemoryUsage("UpdateTileSynchronous - RadFlipTileData created");
#endif
#else
                    RadExtendedTileData tileData = null;
                    if (tileContacts.Count > 0)
                    {
                        displayName = tileContacts.First().DisplayName;
                        BirthdayTileBackViewModel backTileModel  = new BirthdayTileBackViewModel(tileContacts);
                        MediumTileBackUserControlWP7 medBackTile = new MediumTileBackUserControlWP7()
                        {
                            DataContext = backTileModel
                        };
                        tileData = new RadExtendedTileData()
                        {
                            Title           = Resources.AppTitle.ToTitleCase(),
                            BackTitle       = Resources.AppTitle,
                            BackgroundImage = appStorage.FileExists(string.Format(isoStorePath, displayName, "m")) ?
                                              new Uri(string.Format(isoStoreUri, displayName, "m"), UriKind.RelativeOrAbsolute) :
                                              new Uri("/Assets/Tiles/BirthdayTileMedium.png", UriKind.RelativeOrAbsolute),
                            BackVisualElement = medBackTile
                        };
                    }
                    else
                    {
                        tileData = new RadExtendedTileData()
                        {
                            Title           = Resources.AppTitle.ToTitleCase(),
                            BackgroundImage = new Uri("/Assets/Tiles/BirthdayTileMedium.png", UriKind.RelativeOrAbsolute)
                        };
                    }
#if DEBUG
                    DebugUtility.DebugOutputMemoryUsage("UpdateTileSynchronous - RadExtendedTileData created");
#endif
#endif
                    try
                    {
                        LiveTileHelper.UpdateTile(mainTile, tileData);
                    }
                    catch (Exception ex)
                    {
                        DebugUtility.SaveDiagnosticException(ex);
                        throw ex;
                    }
                }
#if DEBUG
                DebugUtility.SaveDiagnosticMessage("Completed tile update");
#endif
                if (callback != null)
                {
                    callback.Invoke();
                }
            });
        }
예제 #17
0
        private void mPinToStart_Click(object sender, EventArgs e)
        {
            if (App.ViewModel.SelectedLocation.ImageName != null)
            {
                locationImageLarge.Source = App.ViewModel.SelectedLocation.LocationImage;
            }

            locationImageLarge.Height = 300;
            locationImageLarge.Width = 300;

            var tileData = new RadExtendedTileData()
            {
                Title = App.ViewModel.SelectedLocation.Name,
                VisualElement = locationImageLarge
            };

            LiveTileHelper.CreateOrUpdateTile(tileData, new Uri("/Views/DetailsLocation.xaml?id=" + App.ViewModel.SelectedLocation.Id, UriKind.RelativeOrAbsolute));
        }