예제 #1
0
        public static void PinTabToStart(Tab tab)
        {
            bool tileExists = FindTile(TileNavigationUrl + tab.Id);

            if (!tileExists)
            {
                StandardTileData tileData = GetSecondaryTileData(tab);
                ShellTile.Create(new Uri(TileNavigationUrl + tab.Id, UriKind.Relative), tileData, false);
            }
        }
예제 #2
0
        private void OnTile(object sender, EventArgs e)
        {
            StandardTileData tile = new StandardTileData
            {
                Title           = "Send " + currentMessage.Name,
                BackgroundImage = new Uri("BlueTile.jpg", UriKind.Relative)
            };
            var tileUri = "/DirectSend.xaml?messageId=" + currentMessage.Id + "&uniquenessToken=" + Guid.NewGuid();

            ShellTile.Create(new Uri(tileUri, UriKind.Relative), tile);
        }
예제 #3
0
        private void OnPinToStartClick(object sender, EventArgs e)
        {
            ErrorReporting.Log("OnPinToStartClick");
            var uri = GetUri(departuresAndArrivalsTable);

            if (!IsStationPinnedToStart())
            {
                ShellTile.Create(GetUri(departuresAndArrivalsTable), GetTileData(), supportsWideTile: true);
            }
            GetPinToStartButton().IsEnabled = false;
        }
예제 #4
0
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            StandardTileData SecTitle = new StandardTileData();

            SecTitle.Title           = "CAT App";
            SecTitle.BackgroundImage = new Uri("/Images/CATapp.png", UriKind.RelativeOrAbsolute);
            //   SecTitle.Count = 70;
            var URINav = "/MainMenuPage.xaml?state=Sec Tile";

            ShellTile.Create(new Uri(URINav, UriKind.RelativeOrAbsolute), SecTitle);
        }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            StandardTileData SecTitle = new StandardTileData();

            SecTitle.Title           = "Annabe 2";
            SecTitle.BackgroundImage = new Uri("BlueTile.jpg", UriKind.Relative);
            SecTitle.Count           = 70;
            var URINav = "/Page1.xaml?state=Sec Tile";

            ShellTile.Create(new Uri(URINav, UriKind.Relative), SecTitle);
        }
예제 #6
0
        void HandleApplicationBar(string text)
        {
            switch (text)
            {
            case "釘至桌面":
            {
                DataService.SaveData();
                var busTags = (from bus in DataService.BusTags orderby bus.tag select bus).ToArray();
                ScheduledTaskAgent1.ScheduledAgent.GenerateTileJpg(
                    "\n".Joyn(busTags.Select(x => x.busName + " " + x.timeToArrive)));

                ShellTile tile     = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("DefaultTitle=FromTile"));
                var       tileData = new StandardTileData
                {
                    Title           = DateTime.Now.ToString("HH:mm:ss"),
                    BackgroundImage = new Uri("isostore:/" + @"Shared\ShellContent\Tile.jpg", UriKind.Absolute),
                };
                if (tile == null)
                {
                    ShellTile.Create(new Uri("/MainPage.xaml?DefaultTitle=FromTile", UriKind.Relative), tileData);
                }
                else
                {
                    tile.Update(tileData);
                }
            }
            break;

            case "刷新時間":
                RefreshBusTime();
                break;

            case "新增巴士":
                NavigationService.Navigate(new Uri("/AddBus.xaml", UriKind.Relative));
                break;

            //case "add station":
            //NavigationService.Navigate(new Uri("/AddStation.xaml", UriKind.Relative));
            //DataService.AddBus(DataService.RandomBusTag());
            //DataContext = new KeyedBusTagVM();
            //break;
            case "關於…":
                NavigationService.Navigate(new Uri("/About.xaml", UriKind.Relative));
                break;

            case "設定":
                NavigationService.Navigate(new Uri("/Settings.xaml", UriKind.Relative));
                break;

            default:
                break;
            }
        }
예제 #7
0
 public void InitSecondaryTile()
 {
     if (SecondaryTile == null)
     {
         var tileUri  = new Uri(string.Format("/BookteraMainPage.xaml?{0}=true", SecondTileFragment), UriKind.Relative);
         var tileData = new CycleTileData
         {
             Title = SecondaryTileTitle,
         };
         ShellTile.Create(tileUri, tileData, supportsWideTile: false);
     }
 }
예제 #8
0
 public void CreateTile(string url, TileData tileData, bool supportsWideTile)
 {
     ShellTile.Create(
         new Uri(url, UriKind.Relative),
         new FlipTileData()
     {
         Title                = tileData.Title,
         BackgroundImage      = tileData.BackgroundImage,
         SmallBackgroundImage = tileData.SmallBackgroundImage
     },
         supportsWideTile);
 }
예제 #9
0
        private void pin_Click(object sender, EventArgs e)
        {
            int count    = ShellTile.ActiveTiles.Count();
            var tileData = new FlipTileData
            {
                Title = "Lifetime",
                Count = count,
            };
            Uri launchUrl = new Uri(String.Format("/MainPage.xaml?context={0}", count), UriKind.Relative);

            ShellTile.Create(launchUrl, tileData, false);
        }
예제 #10
0
        private static void PinUrlToStart(Uri invokeUrl, string name, string logoUrl)
        {
            if (ShellTile.ActiveTiles.Any(o => o.NavigationUri.Equals(invokeUrl)))
            {
                return;
            }

            ShellTile.Create(invokeUrl, new StandardTileData()
            {
                Title           = name,
                BackgroundImage = new Uri(logoUrl, UriKind.Relative)
            });
        }
예제 #11
0
 private void PinImage(ImageModel image)
 {
     if (flipTileDataManager.DeskContainsImage(image))
     {
         flipTileDataManager.Update(image);
         MessageBox.Show(AppResources.UpdateSuccessfullyMsg, AppResources.Alert, MessageBoxButton.OK);
     }
     else
     {
         ShellTileData tileData = flipTileDataManager.Create(image);
         ShellTile.Create(new Uri("/MainPage.xaml?image=" + image.url, UriKind.Relative), tileData, true);
     }
 }
예제 #12
0
        public static void PinFavorites()
        {
            Uri tileUri = App.ViewLocator.View("Main", new { Action = "Favorites" });

            if (ShellTile.ActiveTiles.FirstOrDefault(t => t.NavigationUri == tileUri) == null)
            {
                StandardTileData tileData = new StandardTileData();
                tileData.Title           = AppResources.FavoritesTileTitle;
                tileData.BackgroundImage = new Uri("/Assets/Tiles/FavoritesTileMedium.png", UriKind.RelativeOrAbsolute);

                ShellTile.Create(tileUri, tileData);
            }
        }
예제 #13
0
        public static void PinTag(Tag tag)
        {
            Uri tileUri = App.ViewLocator.View("Main", new { Action = "Tag", Id = tag.Id });

            if (ShellTile.ActiveTiles.FirstOrDefault(t => t.NavigationUri == tileUri) == null)
            {
                StandardTileData tileData = new StandardTileData();
                tileData.Title           = tag.Name;
                tileData.BackgroundImage = new Uri("/Assets/Tiles/TagTileMedium.png", UriKind.RelativeOrAbsolute);

                ShellTile.Create(tileUri, tileData);
            }
        }
예제 #14
0
        private void PinToStart_Click(object sender, EventArgs e)
        {
            var viewModel = ForView.Unwrap <ScheduleViewModel>(DataContext);

            if (viewModel == null)
            {
                return;
            }

            ShellTileData tileData = viewModel.GetTileData();

            ShellTile.Create(NavigationService.CurrentSource, tileData);
        }
예제 #15
0
    public static void CreateLiveTile(string title, string content)
    {
        //application tile is always the first tile, even if it is not pinned
        if (!IsTargetedVersion)
        {
            var data  = GetTile(title, content);
            var tiles = ShellTile.ActiveTiles;
            foreach (var tile in tiles)
            {
                if (tile != null)
                {
                    tile.Update(data);
                }
            }
            ShellTile.Create(new Uri("/MainPage.xaml?DefaultTitle=Highlights", UriKind.Relative), data);
        }
        else
        {
            string fontSize    = Application.Current.Resources["PhoneFontSizeLarge"].ToString();
            string fileNameMed = WriteTileToDisk(title, content, 336, 336, fontSize, new Thickness(19, 13, 13, 38));
            string fileNameBig = WriteTileToDisk(title, content, 691, 336, fontSize, new Thickness(19, 13, 13, 38));

            var          backBackgroundImage     = new Uri("", UriKind.Relative);
            var          wideBackBackgroundImage = new Uri("", UriKind.Relative);
            const string backTitle = "";

            UpdateFlipTile(
                title,
                backTitle,
                string.Empty,
                string.Empty,
                0,
                new Uri("/icons/Application_Icon_336.png", UriKind.Relative),
                new Uri("isostore:" + fileNameMed),
                backBackgroundImage,
                new Uri("isostore:" + fileNameBig),
                wideBackBackgroundImage);

            CreateFlipTile(
                title,
                backTitle,
                string.Empty,
                string.Empty,
                0,
                new Uri("/icons/Application_Icon_336.png", UriKind.Relative),
                new Uri("isostore:" + fileNameMed),
                backBackgroundImage,
                new Uri("isostore:" + fileNameBig),
                wideBackBackgroundImage);
        }
    }
        private void MenuItemPin_Click(object sender, RoutedEventArgs e)
        {
            PodcastSubscriptionModel subscriptionToPin = (sender as MenuItem).DataContext as PodcastSubscriptionModel;

            // Copy the logo file to tile's shared location.
            String tileImageLocation = "Shared/ShellContent/" + subscriptionToPin.PodcastLogoLocalLocation.Split('/')[1];

            using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                if (myIsolatedStorage.FileExists(subscriptionToPin.PodcastLogoLocalLocation) == false)
                {
                    Debug.WriteLine("Podcast logo not found. Cannot pin.");
                    App.showNotificationToast("Podcast logo not found. Cannot pin.");
                    return;
                }

                if (myIsolatedStorage.FileExists(tileImageLocation) == false)
                {
                    myIsolatedStorage.CopyFile(subscriptionToPin.PodcastLogoLocalLocation,
                                               tileImageLocation);
                }
            }

            // Setup data for the live tile.
            StandardTileData tileData = new StandardTileData();

            tileData.BackgroundImage = new Uri("isostore:/" + tileImageLocation, UriKind.Absolute);
            tileData.Title           = subscriptionToPin.PodcastName;

            IsolatedStorageSettings settings    = IsolatedStorageSettings.ApplicationSettings;
            String subscriptionLatestEpisodeKey = App.LSKEY_BG_SUBSCRIPTION_LATEST_EPISODE + subscriptionToPin.PodcastId;

            if (settings.Contains(subscriptionLatestEpisodeKey) == false)
            {
                settings.Add(subscriptionLatestEpisodeKey, ""); // Create empty key so we know the subscription is pinned.
            }

            subscriptionToPin.EpisodesManager.updatePinnedInformation();

            try
            {
                Uri tileUri = new Uri(string.Format("/Views/PodcastEpisodes.xaml?podcastId={0}&forceUpdate=true", subscriptionToPin.PodcastId), UriKind.Relative);
                Debug.WriteLine(string.Format("Pinning to start: Image: {0} Title: {1} Navigation uri: {2}", tileData.BackgroundImage, tileData.Title, tileUri));
                ShellTile.Create(tileUri, tileData);
            }
            catch (InvalidOperationException)
            {
                Debug.WriteLine("Could not pin to start screen. The subscription is already pinned.");
            }
        }
예제 #17
0
 public static void CreateOrUpdate <T>(this ShellTile tile,
                                       Uri targetUri,
                                       T tileData,
                                       bool supportsWideTile) where T : ShellTileData
 {
     if (tile == null)
     {
         ShellTile.Create(targetUri.TypeForTileTemplate <T>(), tileData, supportsWideTile);
     }
     else
     {
         tile.Update(tileData);
     }
 }
        private void ContextMenuSetTile_Click(object sender, RoutedEventArgs e)
        {
            MenuItem            temp = (MenuItem)sender;
            AreaWeatherListItem item = (AreaWeatherListItem)temp.DataContext;

            // 檢查 scheduledAgent 是否活著…若是死的就試著喚醒…
            if (UtilityHelper.CheckScheduledAgent())
            {
                if (item != null)
                {
                    if (!"".Equals(item.Area))
                    {
                        #region 若沒有此動態磚就加入,過程發生錯誤也沒關係,Agent 會幫忙把資訊補回來
                        String    strTileKeyWord = String.Format(Constants.TILE_NAVIGATION_KEYWORD, item.Area);
                        ShellTile tile           = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(strTileKeyWord));
                        if (tile == null)
                        {
                            String strAreaMD5 = MD5Core.GetHashString(item.Area);
                            String strBackgroundImageFileName     = String.Format("Fore_{0}.jpg", strAreaMD5);
                            String strBackBackgroundImageFileName = String.Format("Back_{0}.jpg", strAreaMD5);
                            String strBackgroundImageFilePath     = UtilityHelper.GetShareToTileAlbumCoverPath(strBackgroundImageFileName);
                            String strBackBackgroundImageFilePath = UtilityHelper.GetShareToTileAlbumCoverPath(strBackBackgroundImageFileName);
                            String strNavigationURL = String.Format(Constants.TILE_NAVIGATION_URL, item.Area);

                            try
                            {
                                StandardTileData NewTileData = new StandardTileData
                                {
                                    BackgroundImage     = new Uri("isostore:/" + strBackgroundImageFilePath, UriKind.Absolute),
                                    BackBackgroundImage = new Uri("isostore:/" + strBackBackgroundImageFilePath, UriKind.Absolute)
                                };
                                ShellTile.Create(new Uri(strNavigationURL, UriKind.Relative), NewTileData);
                            }
                            catch (Exception)
                            {
                            }
                        }
                        #endregion

                        // 加入此地區的動態磚
                        TileService.Instance.UpdateTile(item.Area);
                    }
                }
            }
            else
            {
                // 開不了…提示
                MessageBox.Show("您的裝置拒絕 TW Weather 啟動背景作業。\n請先至系統設定頁開啟 TW Weather 的背景作業權限,否則動態磚將會更新失敗。");
            }
        }
예제 #19
0
        private void PinButton_OnTap(object sender, GestureEventArgs e)
        {
            var imageUri = ViewModel.VolumeList[0].CoverImageUri;
            var tileData = new FlipTileData
            {
                SmallBackgroundImage = imageUri,
                BackgroundImage      = imageUri,
                Title       = ViewModel.Title,
                BackTitle   = ViewModel.Title,
                BackContent = ViewModel.VolumeList[0].Description,
            };

            ShellTile.Create(new Uri("/SeriesViewPage.xaml?id=" + ViewModel.Id, UriKind.Relative), tileData, false);
        }
예제 #20
0
        private void pinButton_Click(object sender, EventArgs e)
        {
            var tileData = new FlipTileData
            {
                SmallBackgroundImage = new Uri("/Assets/Tiles/FlipCycleTileSmall.png", UriKind.Relative),
                BackgroundImage      = new Uri("/Assets/Tiles/FlipCycleTileMedium.png", UriKind.Relative),
                WideBackgroundImage  = new Uri("/Assets/Tiles/FlipCycleTileLarge.png", UriKind.Relative),
                BackTitle            = string.Format("Hello {0}!", helloMessage.Text),
                BackContent          = "Windows Phone 8 in Action",
                WideBackContent      = "Windows Phone 8 in Action. Written by Binkley-Jones, Perga, Sync, and Benoit.",
            };

            ShellTile.Create(BuildNavigationUri(helloMessage.Text), tileData, true);
        }
예제 #21
0
파일: LiveTile.cs 프로젝트: kosorin/onedo
 public static void Pin(TaskModel task, StandardTileData tileData)
 {
     try
     {
         Deployment.Current.Dispatcher.BeginInvoke(delegate
         {
             ShellTile.Create(new Uri(string.Format("/Views/EditTaskPage.xaml?Task={0}", task.Uid), UriKind.Relative), tileData, true);
         });
     }
     catch (Exception e)
     {
         Debug.WriteLine(": Chyba při vytváření živé dlaždice: {0}", e.Message);
     }
 }
예제 #22
0
        public static void CreateTileFor(long userOrGroupId, bool isGroup, string name, Action <bool> completionCallback, string smallPhoto)
        {
            string str = string.IsNullOrWhiteSpace(name) ? "" : HttpUtility.UrlEncode(name);
            Uri    uri = new Uri(string.Format("/VKClient.Common;component/Profiles/Shared/Views/ProfilePage.xaml?UserOrGroupId={0}&Name={1}&ClearBackStack=True", (object)userOrGroupId, (object)str), UriKind.Relative);

            SecondaryTileManager.Instance.GetSecondaryTileData(userOrGroupId, isGroup, name, 3, (Action <bool, CycleTileData>)((res, resData) =>
            {
                if (res)
                {
                    ShellTile.Create(uri, (ShellTileData)resData, true);
                }
                completionCallback(res);
            }), smallPhoto);
        }
예제 #23
0
        /// <summary>
        /// Creates tile
        /// </summary>
        private void CreateTile(LiveTilesOptions liveTileOptions)
        {
            if (string.IsNullOrEmpty(liveTileOptions.SecondaryTileUri))
            {
                DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
                return;
            }

            try
            {
                ShellTile foundTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(liveTileOptions.SecondaryTileUri));
                if (foundTile != null)
                {
                    DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Tile already exist"));
                }
                else
                {
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        ShellTileData liveTile;

                        switch ((int)liveTileOptions.TileType)
                        {
                        case 1:
                            liveTile = CreateCycleTileData(liveTileOptions);
                            break;

                        case 2:
                            liveTile = CreateIconicTileData(liveTileOptions);
                            break;

                        default:
                            liveTile = CreateFlipTileDate(liveTileOptions);
                            break;
                        }

                        PhoneApplicationPage currentPage = ((PhoneApplicationFrame)Application.Current.RootVisual).Content as PhoneApplicationPage;
                        string currentUri = currentPage.NavigationService.Source.ToString().Split('?')[0];
                        ShellTile.Create(new Uri(currentUri + "?Uri=" + liveTileOptions.SecondaryTileUri, UriKind.Relative), liveTile, true);
                        tileTypes.Add(currentUri + "?Uri=" + liveTileOptions.SecondaryTileUri, liveTileOptions.TileType);
                        AppSettings.StoreSetting(TileSettingsName, tileTypes);
                        DispatchCommandResult(new PluginResult(PluginResult.Status.OK));
                    });
                }
            }
            catch
            {
                DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Error creating iconic tile"));
            }
        }
예제 #24
0
        public void CreateTile(ConnectionType item)
        {
            var foundTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("type=" + item.Id));

            var tile = SetupTileData(item);

            if (foundTile == null)
            {
                ShellTile.Create(new Uri(String.Format("/MainPage.xaml?type={0}", item.Id), UriKind.Relative), tile);
            }
            else
            {
                foundTile.Update(tile);
            }
        }
예제 #25
0
        private void AddChatty_Click(object sender, RoutedEventArgs e)
        {
            ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("ChattyPage"));

            if (tile == null)
            {
                StandardTileData data = new StandardTileData
                {
                    BackgroundImage = new Uri("Background.png", UriKind.Relative),
                    Title           = "GoToChatty"
                };

                ShellTile.Create(new Uri("/Pages/ChattyPage.xaml", UriKind.Relative), data);
            }
        }
예제 #26
0
        public static void Create()
        {
            // Make sure we don't add another tile!
            if (DigitalDash.Core.Classes.LiveTile.GetTile() == null)
            {
                // Create a new tile!
                var tileUri  = new Uri("/Pages/MainPage.xaml?tile=flip", UriKind.Relative);
                var liveTile = new DigitalDash.Core.Classes.LiveTile();
                var tileData = liveTile.CreateFlipTileData();
                ShellTile.Create(tileUri, tileData, true);

                var ourTile = new DigitalDash.Core.Classes.LiveTile();
                ourTile.Update();
            }
        }
예제 #27
0
        public void CreateTile(string NavSource)
        {
            StandardTileData tileData = new StandardTileData
            {
                Title               = this.Title ?? "",
                Count               = this.Count,
                BackTitle           = this.BackTitle ?? "",
                BackContent         = this.BackContent ?? "",
                BackgroundImage     = new Uri(this.BackgroundImagePath ?? "", UriKind.Relative),
                BackBackgroundImage = new Uri(this.BackBackgroundImagePath ?? "", UriKind.Relative)
            };

            NavSource += string.Format("?title={0}", this.Title ?? "");
            ShellTile.Create(new Uri(NavSource, UriKind.Relative), tileData);
        }
예제 #28
0
        private void OnCreatingIconicTile(object sender, GestureEventArgs e)
        {
            var icontile = new IconicTileData
            {
                Title          = "Sport",
                Count          = 12,
                IconImage      = new Uri("Assets/IconicTile/202.png", UriKind.Relative),
                SmallIconImage = new Uri("Assets/IconicTile/38.png", UriKind.Relative),
                WideContent1   = "Wussten Sie schon...",
                WideContent2   = "1975 erziehlte Coby Orr ein Hole-In-One.",
                WideContent3   = "Er war fünf Jahre alt."
            };

            ShellTile.Create(new Uri("/MainPage.xaml", UriKind.Relative), icontile, true);
        }
        private void CreateIconicTile_Click(object sender, RoutedEventArgs e)
        {
            var tileData = new IconicTileData()
            {
                Title           = "iconic",
                Count           = 1,
                WideContent1    = "[1st row of content]",
                WideContent2    = "[2nd row of content]",
                WideContent3    = "[3rd row of content]",
                SmallIconImage  = new Uri("/Assets/Tiles/iconic110.png", UriKind.Relative),
                IconImage       = new Uri("/Assets/Tiles/iconic202.png", UriKind.Relative),
                BackgroundColor = Color.FromArgb(254, 0, 0, 255)
            };

            ShellTile.Create(new Uri("/MainPage.xaml?tile=iconic", UriKind.Relative), tileData, true);
        }
예제 #30
0
 private void PIN(object sender, RoutedEventArgs e)
 {
     try
     {
         StandardTileData tile = new StandardTileData
         {
             Title           = manifestEX.GameName,
             BackgroundImage = new Uri("isostore:/Shared/ShellContent/" + gamePath + "/Tile.png", UriKind.Absolute),
         };
         ShellTile.Create(new Uri("/ONSCL/Direct3DPage.xaml?game=" + gamePath, UriKind.Relative), tile);
     }
     catch (Exception exc)
     {
         MessageBox.Show(UVEngine.Resources.UVEngine.tileerror + exc.Message, UVEngine.Resources.UVEngine.error, MessageBoxButton.OK);
     }
 }