Example #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void PinQuickFill_Click(object sender, EventArgs e)
 {
     LiveTileHelper.CreateOrUpdateTile(new RadExtendedTileData()
     {
         Title = "Add Fill", BackgroundImage = new Uri("/Images/AddFillIcon.png", UriKind.RelativeOrAbsolute)
     }, new Uri("/AddFill.xaml", UriKind.RelativeOrAbsolute));
 }
        public void CreateShortCut()
        {
            //var iconPath = new Path()
            //{
            //    Height = 150,
            //    Width = 150,
            //    Stretch = Stretch.Uniform,
            //    HorizontalAlignment = HorizontalAlignment.Center,
            //    VerticalAlignment = VerticalAlignment.Center,
            //    Fill = new SolidColorBrush(Colors.White)
            //};

            //iconPath.SetDataBinding(this.DefaultImagePathData);

            var shortCutTile = new RadIconicTileData()
            {
                //IconVisualElement = iconPath,
                //SmallIconVisualElement = iconPath,
                IconImage = new Uri("/Assets/Tiles/FolderIconImage.png", UriKind.Relative),
                SmallIconImage = new Uri("/Assets/Tiles/FolderSmallIconImage.png", UriKind.Relative),
                MeasureMode = MeasureMode.Tile,
                Title = this.Name
            };

            LiveTileHelper.CreateOrUpdateTile(shortCutTile,
                new Uri("/Views/MainPage.xaml?ShortCutBase64Handle=" + this.OriginalMNode.getBase64Handle(), UriKind.Relative),
                false);
        }
Example #3
0
 public void CreateLiveTile(string Uri)
 {
     if (ShellTile.ActiveTiles.Any())
     {
         var tile         = ShellTile.ActiveTiles.First();
         var flipTileData = new RadFlipTileData
         {
             Count = 0,
             Title = Domain.AppBase.Current.Config.AppName,
             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),
             BackBackgroundImage     = new Uri("/", UriKind.RelativeOrAbsolute),
             WideBackBackgroundImage = new Uri("/", UriKind.RelativeOrAbsolute), BackTitle = ""
         };
         if (!string.IsNullOrEmpty(Uri))
         {
             LiveTileHelper.CreateOrUpdateTile(flipTileData, new Uri(Uri, UriKind.RelativeOrAbsolute), true, true);
         }
         else
         {
             LiveTileHelper.CreateOrUpdateTile(flipTileData, new Uri("/Home.xaml", UriKind.RelativeOrAbsolute), true, true);
         }
     }
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem menu  = (MenuItem)sender;
            int      index = VehicleList.ItemContainerGenerator.IndexFromContainer((VehicleList.ItemContainerGenerator.ContainerFromItem((sender as MenuItem).DataContext) as ListBoxItem));

            if (index != -1)
            {
                ViewModel.Vehicle SelectedVehicle = (ViewModel.Vehicle)VehicleList.Items[index];

                //Selected context menu item is to pin to start
                if (menu.Header.ToString().Equals("pin to start"))
                {
                    LiveTileHelper.CreateOrUpdateTile(new RadExtendedTileData()
                    {
                        Title = SelectedVehicle.Name.ToString(), BackgroundImage = new Uri("/Images/Car.png", UriKind.Relative)
                    }, new Uri("/VehicleInfo.xaml?Name=" + SelectedVehicle.Name.ToString(), UriKind.RelativeOrAbsolute));
                }
                //Selected context menu item is to delete the vehicle
                else if (menu.Header.ToString().Equals("delete"))
                {
                    RadMessageBox.Show("Delete " + SelectedVehicle.Name + "?", MessageBoxButtons.YesNo, "Are you sure you want to delete this vehicle? All information will be lost.", null,
                                       false, true, System.Windows.HorizontalAlignment.Stretch, System.Windows.VerticalAlignment.Top, closedHandler: (args) =>
                    {
                        if (args.Result == DialogResult.OK)
                        {
                            DeleteVehicle(SelectedVehicle);
                        }
                    }
                                       );
                }
            }
        }
 /// <summary>
 /// Event to pin tile to start screen
 /// </summary>
 /// <param name="sender">Object of event sender</param>
 /// <param name="e"> Event argument</param>
 private void pinBtn_Click(object sender, EventArgs e)
 {
     LiveTileHelper.CreateOrUpdateTile(new RadExtendedTileData()
     {
         Title = VehicleName.Text.ToString(), BackVisualElement = this.AverageMileage, BackTitle = "Average Mileage", BackgroundImage = new Uri("/Images/Car.png", UriKind.RelativeOrAbsolute)
     }, new Uri("/VehicleInfo.xaml?Name=" + VehicleName.Text.ToString(), UriKind.RelativeOrAbsolute));
 }
Example #6
0
        private void CreateShortCut(object obj)
        {
            var shortCutTile = new RadIconicTileData()
            {
                IconImage      = new Uri("/Assets/Tiles/FolderIconImage.png", UriKind.Relative),
                SmallIconImage = new Uri("/Assets/Tiles/FolderSmallIconImage.png", UriKind.Relative),
                Title          = FocusedNode.Name
            };

            LiveTileHelper.CreateOrUpdateTile(shortCutTile,
                                              new Uri("/Views/MainPage.xaml?ShortCutBase64Handle=" + FocusedNode.OriginalMNode.getBase64Handle(), UriKind.Relative),
                                              false);
        }
Example #7
0
        public void CreateTileForBook(string bookId)
        {
            if (string.IsNullOrWhiteSpace(bookId))
            {
                throw new ArgumentException("bookId is invalid");
            }

            var book = _bookRepository.Get(bookId);

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


            string      title = book.Title;
            BitmapImage bmp;

            using (var storage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (storage.FileExists(ModelExtensions.GetBookCoverPath(book.BookID)))
                {
                    bmp = new BitmapImage()
                    {
                        CreateOptions = BitmapCreateOptions.None
                    };
                    using (var file = storage.OpenFile(ModelExtensions.GetBookCoverPath(book.BookID), FileMode.Open))
                    {
                        bmp.SetSource(file);
                        title = string.Empty;
                    }
                }
                else
                {
                    bmp = null;//.UriSource = new Uri("/Resources/Icons/tile.png", UriKind.RelativeOrAbsolute);
                }
            }

            BookTile tile = new BookTile();

            tile.ImageSource = bmp;
            tile.Title       = title;
            tile.UpdateLayout();

            LiveTileHelper.CreateOrUpdateTile(new RadExtendedTileData()
            {
                VisualElement = tile
            }, uri);
        }
Example #8
0
        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));
        }
Example #9
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));
        }