/// <summary>
        /// Updates application live tile
        /// </summary>
        public void updateTile(string options)
        {
            string[] args       = JsonHelper.Deserialize <string[]>(options);
            string   callbackId = args[1];

            LiveTilesOptions liveTileOptions;

            try
            {
                liveTileOptions = JsonHelper.Deserialize <LiveTilesOptions>(args[0]);
            }
            catch (Exception)
            {
                DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION), callbackId);
                return;
            }

            try
            {
                ShellTile appTile = ShellTile.ActiveTiles.First();

                if (appTile != null)
                {
                    if (liveTileOptions.tileType == "iconic")
                    {
                        IconicTileData TileData = CreateIconicTileData(liveTileOptions);
                        appTile.Update(TileData);
                        DispatchCommandResult(new PluginResult(PluginResult.Status.OK), callbackId);
                    }
                    else if (liveTileOptions.tileType == "standard")
                    {
                        StandardTileData TileData = CreateStandardTileData(liveTileOptions);
                        appTile.Update(TileData);
                        DispatchCommandResult(new PluginResult(PluginResult.Status.OK), callbackId);
                    }
                    else if (liveTileOptions.tileType == "flip")
                    {
                        FlipTileData TileData = CreateFlipTileData(liveTileOptions);
                        appTile.Update(TileData);
                        DispatchCommandResult(new PluginResult(PluginResult.Status.OK), callbackId);
                    }
                    else
                    {
                        //StandardTileData TileData = CreateStandardTileData(liveTileOptions);
                        //appTile.Update(TileData);
                        //DispatchCommandResult(new PluginResult(PluginResult.Status.OK), callbackId);
                        DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "tileType not defined"), callbackId);
                    }
                }
                else
                {
                    DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Can't get application tile"), callbackId);
                }
            }
            catch (Exception)
            {
                DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Error updating application tile"), callbackId);
            }
        }
        /// <summary>
        /// Updates an Application Tile or secondary Tile.
        /// </summary>
        /// <param name="data">New text and image data for the tile.</param>
        public void Update(IShellTileServiceTileData data)
        {
            var shellTileServiceTileDataBase = data as ShellTileServiceTileDataBase;

            if (shellTileServiceTileDataBase == null)
            {
                throw new ArgumentException("A ShellTileServiceTileDataBase instance is expected.", "data");
            }

            _shellTile.Update(shellTileServiceTileDataBase.ToShellTileData());
        }
예제 #3
0
        public static void UpdateLiveTile()
        {
            ROMDatabase db   = ROMDatabase.Current;
            ShellTile   tile = ShellTile.ActiveTiles.FirstOrDefault();


            FlipTileData data = new FlipTileData();

#if !GBC
            data.Title = AppResources.ApplicationTitle;
#else
            data.Title = AppResources.ApplicationTitle2;
#endif

            //get last snapshot
            IEnumerable <String> lastSnapshots = db.GetRecentSnapshotList();

            if (App.metroSettings.UseAccentColor || lastSnapshots.Count() == 0)    //create see through tile
            {
#if !GBC
                data.SmallBackgroundImage = new Uri("Assets/Tiles/FlipCycleTileSmall.png", UriKind.Relative);
                data.BackgroundImage      = new Uri("Assets/Tiles/FlipCycleTileMedium.png", UriKind.Relative);
                data.WideBackgroundImage  = new Uri("Assets/Tiles/FlipCycleTileLarge.png", UriKind.Relative);
#else
                data.SmallBackgroundImage = new Uri("Assets/Tiles/FlipCycleTileSmallGBC.png", UriKind.Relative);
                data.BackgroundImage      = new Uri("Assets/Tiles/FlipCycleTileMediumGBC.png", UriKind.Relative);
                data.WideBackgroundImage  = new Uri("Assets/Tiles/FlipCycleTileLargeGBC.png", UriKind.Relative);
#endif
                tile.Update(data);
            }
            else  //create opaque tile
            {
#if !GBC
                data.SmallBackgroundImage = new Uri("Assets/Tiles/FlipCycleTileSmallFilled.png", UriKind.Relative);
#else
                data.SmallBackgroundImage = new Uri("Assets/Tiles/FlipCycleTileSmallFilledGBC.png", UriKind.Relative);
#endif


                data.BackgroundImage     = new Uri("isostore:/" + lastSnapshots.ElementAt(0), UriKind.Absolute);
                data.WideBackgroundImage = new Uri("isostore:/" + lastSnapshots.ElementAt(0), UriKind.Absolute);

                if (lastSnapshots.Count() >= 2)
                {
                    data.BackBackgroundImage     = new Uri("isostore:/" + lastSnapshots.ElementAt(1), UriKind.Absolute);
                    data.WideBackBackgroundImage = new Uri("isostore:/" + lastSnapshots.ElementAt(1), UriKind.Absolute);
                }

                tile.Update(data);
            }
        }
예제 #4
0
        //更新磁贴
        private void updateTile(string msg, int days)
        {
            ShellTile        NowTile  = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("TileID=2"));
            StandardTileData TileData = new StandardTileData
            {
                BackgroundImage = new Uri("background.jpg", UriKind.Relative),
                Title           = "live倒计时",
                Count           = days,
                BackTitle       = "提醒",
                BackContent     = msg,
                //BackBackgroundImage = new Uri("Blue.jpg", UriKind.Relative)
            };

            if (NowTile == null)
            {
                isFirstTime = true;
                ShellTile.Create(new Uri("/MainPage.xaml?TileID=2", UriKind.Relative), TileData);
            }
            else
            {
                isFirstTime = false;
                NowTile.Update(TileData);
            }
            //更新日期
            if (isoSetting.Contains("lastUpdate"))
            {
                isoSetting["lastUpdate"] = DateTime.Today;
            }
            else
            {
                isoSetting.Add("lastUpdate", DateTime.Today);
            }
            isoSetting.Save();
        }
예제 #5
0
        public static void CreateIconicTile(string uri, string contains, string smallIconImage, string iconImage, int count)
        {
            ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(contains));

            if (tile != null && tile.NavigationUri.ToString().Contains(contains))
            {
                var iconicTileData = new IconicTileData
                {
                    SmallIconImage = new Uri(smallIconImage, UriKind.RelativeOrAbsolute),
                    IconImage      = new Uri(smallIconImage, UriKind.RelativeOrAbsolute),
                    Count          = count
                };

                tile.Update(iconicTileData);
                Toast.Title   = AppResources.Notice;
                Toast.Message = AppResources.TextSuccessfully;
                Toast.Show();
            }
            else
            {
                var tileUri  = new Uri(uri + contains, UriKind.RelativeOrAbsolute);
                var tileData = new IconicTileData
                {
                    SmallIconImage = new Uri(smallIconImage, UriKind.RelativeOrAbsolute),
                    IconImage      = new Uri(smallIconImage, UriKind.RelativeOrAbsolute),
                    Count          = count
                };

                ShellTile.Create(tileUri, tileData, false);
            }
        }
예제 #6
0
        private void Appointments_SearchCompleted(object sender, AppointmentsSearchEventArgs e)
        {
            if (e.Results != null)
            {
                foreach (Appointment appt in e.Results)
                {
                    string ConferenceId = Conference.GetId(appt);

                    if (!string.IsNullOrEmpty(ConferenceId))
                    {
                        if (appt.StartTime > DateTime.Now.Date.AddDays(1))
                        {
                            Tomorrow.Add(appt);
                        }
                        else
                        {
                            Today.Add(appt);
                        }
                    }
                }
            }

            // update the Tile
            ShellTile PrimaryTile = ShellTile.ActiveTiles.First();

            if (PrimaryTile != null)
            {
                IconicTileData tile = new IconicTileData();
                tile.Count          = Today.Count;
                tile.Title          = "My Conference Calls";
                tile.SmallIconImage = new Uri("/ApplicationIcon.png", UriKind.Relative);
                tile.IconImage      = new Uri("/AppHub/icon200.png", UriKind.Relative);
                PrimaryTile.Update(tile);
            }
        }
예제 #7
0
        /// <summary>
        /// Met a jour la tuile sur l'écran d'accueil avec les nouvelles infos du voyage en cours
        /// </summary>
        /// <param name="current"></param>
        public void CheckUpdateTile(Trip current)
        {
            IconicTileData newTileData = new IconicTileData();

            newTileData.Title          = "Checkmapp";
            newTileData.WideContent1   = String.Empty;
            newTileData.WideContent2   = String.Empty;
            newTileData.IconImage      = new Uri(@"Assets/Logo.png", UriKind.Relative);
            newTileData.SmallIconImage = new Uri(@"Assets/Logo.png", UriKind.Relative);
            if (current != null)
            {
                newTileData.WideContent1 = current.Name;
                int      day     = 0;
                TimeSpan elapsed = DateTime.Now.Subtract(current.BeginDate);
                if (elapsed.TotalDays > 0)
                {
                    day = (int)elapsed.TotalDays;
                }

                newTileData.WideContent2 = AppResources.Day + " " + day;
            }

            //Mise a jour (pour le texte)
            ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault();

            if (tile != null)
            {
                tile.Update(newTileData);
            }
        }
        /// <summary>
        /// Clears the application live tile
        /// </summary>
        public void cancelAll(string jsonArgs)
        {
            // Application Tile is always the first Tile, even if it is not pinned to Start.
            ShellTile AppTile = ShellTile.ActiveTiles.First();

            if (AppTile != null)
            {
                // Set the properties to update for the Application Tile
                // Empty strings for the text values and URIs will result in the property being cleared.
                FlipTileData TileData = new FlipTileData
                {
                    Count                = 0,
                    BackTitle            = "",
                    BackContent          = "",
                    WideBackContent      = "",
                    SmallBackgroundImage = new Uri("appdata:Background.png"),
                    BackgroundImage      = new Uri("appdata:Background.png"),
                    WideBackgroundImage  = new Uri("/Assets/Tiles/FlipCycleTileLarge.png", UriKind.Relative),
                };

                // Update the Application Tile
                AppTile.Update(TileData);
            }

            DispatchCommandResult();
        }
예제 #9
0
        private void UpdateTile(int count)
        {
            ShellTile        apptile     = ShellTile.ActiveTiles.First();
            StandardTileData appTileData = new StandardTileData();

            appTileData.Count = count;

            if (count == 0)
            {
                appTileData.BackTitle   = null;
                appTileData.BackContent = null;
            }
            else
            {
                appTileData.BackTitle = "µTorrent Remote";
                string message =
                    count == 1
                        ? string.Format("{0} torrent was downloaded", count)
                        : string.Format("{0} torrents were downloaded", count);

                appTileData.BackContent = message;
            }

            apptile.Update(appTileData);
        }
예제 #10
0
        /// <summary>
        /// Sets application live tile
        /// </summary>
        public void add(string jsonArgs)
        {
            string[] args    = JsonHelper.Deserialize <string[]>(jsonArgs);
            Options  options = JsonHelper.Deserialize <Options>(args[0]);
            // Application Tile is always the first Tile, even if it is not pinned to Start.
            ShellTile AppTile = ShellTile.ActiveTiles.First();

            if (AppTile != null)
            {
                // Set the properties to update for the Application Tile
                // Empty strings for the text values and URIs will result in the property being cleared.
                FlipTileData TileData = CreateTileData(options);

                // Update the Application Tile
                AppTile.Update(TileData);

                if (!string.IsNullOrEmpty(options.Foreground))
                {
                    string arguments = String.Format("{0}({1})", options.Foreground, options.ID);

                    DispatchCommandResult(new PluginResult(PluginResult.Status.OK, arguments));
                }
            }

            DispatchCommandResult();
        }
예제 #11
0
        // Update the live tile
        private void UpdateLiveTile()
        {
            UnityApp.BeginInvoke(() =>
            {
                var gameManager = GameManager.Instance; // Get our GameManager class from Unity

                if (gameManager == null)
                {
                    Debug.WriteLine("Gamemanager not found in Unity project");
                    return;
                }

                var score = GameManager.Instance.GetScore();

                ShellTile oTile = ShellTile.ActiveTiles.FirstOrDefault();
                if (oTile != null)
                {
                    var backContent     = "Score : " + score;
                    var wideBackContent = "Score : " + score;

                    var tileData = new FlipTileData()
                    {
                        BackTitle           = "Score",
                        BackContent         = backContent,
                        Count               = 0,
                        WideBackContent     = wideBackContent,
                        WideBackgroundImage = new Uri("/Assets/Tiles/FlipCycleTileLarge.png", UriKind.Relative),
                        BackgroundImage     = new Uri("/Assets/Tiles/FlipCycleTileMedium.png", UriKind.Relative)
                    };
                    oTile.Update(tileData);
                }
            });
        }
예제 #12
0
        public bool ResetTileToDefault()
        {
            bool result = false;

            try
            {
                StandardTileData tileData = new StandardTileData()
                {
                    Title               = "Trivia Buff",
                    BackgroundImage     = new Uri("/icons/Application_Icon_336.png", UriKind.Relative),
                    BackBackgroundImage = new Uri("NONESUCH.png", UriKind.Relative),
                    BackTitle           = string.Empty,
                    BackContent         = string.Empty
                };

                ShellTile tile = ShellTile.ActiveTiles.First();
                tile.Update(tileData);
                result = true;
            }
            catch (Exception)
            {
                // ignore, best effort cleanup
            }

            return(result);
        }
예제 #13
0
        void appts_SearchCompleted(object sender, AppointmentsSearchEventArgs e)
        {
            AppointmentsCount = 0;

            if (e.Results != null)
            {
                foreach (Appointment appt in e.Results)
                {
                    if (IsConfCall(appt))
                    {
                        AppointmentsCount++;
                    }
                }
            }

            // update the Tile
            ShellTile PrimaryTile = ShellTile.ActiveTiles.First();

            if (PrimaryTile != null)
            {
                IconicTileData tile = new IconicTileData();
                tile.Count          = AppointmentsCount;
                tile.Title          = "My Conference Calls";
                tile.SmallIconImage = new Uri("/ApplicationIcon.png", UriKind.Relative);
                tile.IconImage      = new Uri("/icon200.png", UriKind.Relative);
                PrimaryTile.Update(tile);
            }

            NotifyComplete();
        }
예제 #14
0
        //Method to create Tile
        public static void createOrUpdateTile()
        {
            IconicTileData oIcontile = new IconicTileData();

            oIcontile.Title = titleTile;
            //oIcontile.Count = indexItem;

            oIcontile.IconImage      = new Uri("/Assets/Tiles/FlipCycleTileSmall.png", UriKind.Relative);
            oIcontile.SmallIconImage = new Uri("/Assets/Tiles/FlipCycleTileSmall.png", UriKind.Relative);

            oIcontile.WideContent1 = titleTile;
            oIcontile.WideContent2 = descriptionTile;
            oIcontile.WideContent3 = updateTile;

            oIcontile.BackgroundColor = new Color {
                A = 255, R = 0, G = 0, B = 0
            };                                                                      //new Color { A = 255, R = 0, G = 148, B = 255 };

            ShellTile tileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("Iconic".ToString()));

            //Update
            if (tileToFind != null && tileToFind.NavigationUri.ToString().Contains("Iconic"))
            {
                //tileToFind.Delete();
                tileToFind.Update(oIcontile);
                //ShellTile.Create(new Uri("/MainPage.xaml?id=Iconic", UriKind.Relative), oIcontile, true);
            }
            //Create new
            else
            {
                ShellTile.Create(new Uri("/MainPage.xaml?id=Iconic", UriKind.Relative), oIcontile, true);
            }
        }
예제 #15
0
 private void ProcessTile(int ind, List <ShellTile> list, Action <bool> completionCallback)
 {
     if (ind >= list.Count)
     {
         completionCallback(true);
     }
     else
     {
         ShellTile tile = list[ind];
         Dictionary <string, string> queryString = tile.NavigationUri.ParseQueryString();
         bool   isGroup       = queryString.ContainsKey("GroupId");
         long   userOrGroupId = isGroup ? long.Parse(queryString["GroupId"]) : long.Parse(queryString["UserOrGroupId"]);
         string name          = queryString["Name"];
         this.GetSecondaryTileData(userOrGroupId, isGroup, name, 5, (Action <bool, CycleTileData>)((res, resData) =>
         {
             if (res)
             {
                 Logger.Instance.Info("Updating secondary tile with new info " + tile.NavigationUri);
                 try
                 {
                     tile.Update((ShellTileData)resData);
                 }
                 catch (Exception)
                 {
                 }
             }
             else
             {
                 Logger.Instance.Error("Failed to process tile update " + tile.NavigationUri);
             }
             this.ProcessTile(ind + 1, list, completionCallback);
         }), null);
     }
 }
예제 #16
0
 public static void UpdateUserTileStatus(ShellTile shellTile, User user, FeedItem first)
 {
     shellTile.Update(new StandardTileData
     {
         BackBackgroundImage = GenerateUserTileBackBackgroundImage(user, first)
     });
 }
예제 #17
0
        public static void PostDownload(IList <Feed> downloadedFeeds)
        {
            if (downloadedFeeds != null && downloadedFeeds.Count > 0)
            {
                var dbContext          = new PersistentManager();
                var downloadedFileName = string.Format("{0}-{1}.dat", AppConfig.TEMP_DOWNLOAD_FILE_PATTERN, DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss-tt"));

                if (dbContext.UpdateSerializedCopy(downloadedFeeds, downloadedFileName, false))
                {
                    if (AppConfig.ShowBackgroundUpdateResult)
                    {
                        ShellToast toast = new ShellToast();
                        toast.Title   = "duyệt báo";
                        toast.Content = string.Format("tải {0} tin từ {1} mục", downloadedFeeds.Sum(f => f.Items.Count).ToString(), downloadedFeeds.Count);
                        toast.Show();
                    }

                    FlipTileData flipTileData = new FlipTileData()
                    {
                        Count               = downloadedFeeds.Sum(f => f.Items.Count),
                        BackContent         = string.Format("tải {0} tin", downloadedFeeds.Sum(f => f.Items.Count)).ToString(),
                        BackTitle           = string.Format("cập nhật {0} mục", downloadedFeeds.Count),
                        BackBackgroundImage = new Uri("Resources/tile-med-back.png", UriKind.Relative)
                    };
                    ShellTile appTile = ShellTile.ActiveTiles.First();
                    if (appTile != null)
                    {
                        appTile.Update(flipTileData);
                    }
                }
            }
        }
예제 #18
0
        public void SFlipTileTemplate()
        {
            Profile profil = JsonConvert.DeserializeObject <Profile>(iso.Read("profile.json"));
            //ShellTile oTile = ShellTile.ActiveTiles.First();
            ShellTile oTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("flip".ToString()));

            if (oTile != null && oTile.NavigationUri.ToString().Contains("flip"))
            {
                FlipTileData oFliptile = new FlipTileData();
                oFliptile.Title     = "Old Gaming Quiz";
                oFliptile.Count     = profil.SolvedCount;
                oFliptile.BackTitle = profil.SolvedCount.ToString() + " ScreenShot Solved";
                //oFliptile.BackContent = (30 - profil.solvedQuestion).ToString() + " Surah remaining";

                oFliptile.BackContent     = profil.SolvedCount.ToString() + " ScreenShot Solved";
                oFliptile.WideBackContent = profil.SolvedCount.ToString() + " ScreenShot Solved";

                oFliptile.SmallBackgroundImage = new Uri("/Assets/Tiles/159.png", UriKind.Relative);
                oFliptile.BackgroundImage      = new Uri("/Assets/Tiles/336.png", UriKind.Relative);
                oFliptile.WideBackgroundImage  = new Uri("/Assets/Tiles/691.png", UriKind.Relative);

                oFliptile.BackBackgroundImage     = new Uri("/Assets/Tiles/336Back.png", UriKind.Relative);
                oFliptile.WideBackBackgroundImage = new Uri("/Assets/Tiles/691Back.png", UriKind.Relative);
                oTile.Update(oFliptile);
            }
            else
            {
                //once it is created flip tile
                MessageBox.Show("Tile Successfully Created");
                Uri           tileUri  = new Uri("/MainPage.xaml?tile=flip", UriKind.Relative);
                ShellTileData tileData = this.CreateFlipTileData();
                ShellTile.Create(tileUri, tileData, true);
            }
        }
        private void SavaSettings_Click(object sender, EventArgs e)
        {
            Settings.UpdateTile          = ToggleSwitch_UpdateLiveTiles.IsChecked.Value;
            Settings.updateContLiveTiles = ToggleSwitch_UpdateContLiveTiles.IsChecked.Value;

            if (ToggleSwitch_UpdateLiveTiles.IsChecked == false)
            {
                ShellTile tile = ShellTile.ActiveTiles.First(); //Recupera a tile da aplicação

                StandardTileData std = new StandardTileData     //Cria uma tila standard
                {
                    Count       = 0,                            //Número que aparece junto a parte da frente da tile
                    BackContent = "",                           //Texto que aparece atrás da tile
                    BackTitle   = "",                           //Título da aplicação de que aparece atrás da tile
                    //BackBackgroundImage = new Uri("/Imagens/backImagemTile.png", UriKind.Relative), //Imagem de fundo da parte de trás da tile
                    //BackgroundImage = new Uri("/Imagens/imagemTile.png", UriKind.Relative),  //Imagem de fundo da parte da frente da tile
                    //Title = "Texto texto..." //Título da parte da frente da tile
                };
                tile.Update(std); //Faz o update da tile da aplicação
            }
            else if (ToggleSwitch_UpdateContLiveTiles.IsChecked == false)
            {
                Settings.ContLiveTile = 0;
                ShellTile        tile = ShellTile.ActiveTiles.First();
                StandardTileData std  = new StandardTileData
                {
                    Count = 0,
                };
                tile.Update(std);
            }

            NavigationService.Navigate(new Uri("/home.xaml", UriKind.RelativeOrAbsolute));
        }
예제 #20
0
        public static void UpdateTile(ShellTile tile)
        {
            int id = Int32.Parse(tile.NavigationUri.OriginalString.Replace("/MainPage.xaml?tile=", ""));

            IRouteStopPair pair = App.UB.TileRegister.Get(id);

            if (pair == null)
            {
                return;
            }

            StopGroup stop  = pair.Stop;
            Route     route = pair.Route;

            DateTime now       = DateTime.Now;
            var      timeTable = App.Model.GetTimetable(route, stop, now);

            var control  = CreateTileBackgroundControl(stop, route, timeTable, now);
            Uri imageUri = GenerateTileImage(control, id + ".png");

            StandardTileData tileData = new StandardTileData
            {
                Title           = "",
                BackgroundImage = imageUri
            };

            tile.Update(tileData);

            //return true;
        }
예제 #21
0
 protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
 {
     if (LiveTileSupport.IsChecked == false)
     {
         try
         {
             ShellTile appTile = ShellTile.ActiveTiles.First();
             if (appTile != null)
             {
                 appTile.Update(new FlipTileData()
                 {
                     BackContent          = "",
                     WideBackContent      = "",
                     SmallBackgroundImage = new Uri("/Assets/Icons/FlipCycleTileSmall.png", UriKind.RelativeOrAbsolute),
                     BackgroundImage      = new Uri("/Assets/Icons/FlipCycleTileMedium.png", UriKind.RelativeOrAbsolute),
                     WideBackgroundImage  = new Uri("/Assets/Icons/FlipCycleTileLarge.png", UriKind.RelativeOrAbsolute),
                     BackTitle            = "The Hindu",
                     Title = "The Hindu"
                 });
             }
         }
         catch (Exception exception)
         {
             if (Debugger.IsAttached)
             {
                 Debug.WriteLine("SettingPage.xaml.cs:" + exception);
             }
         }
     }
     base.OnNavigatedFrom(e);
 }
예제 #22
0
        public static void Update()
        {
            try
            {
                // Application Tile is always the first Tile, even if it is not pinned to Start.
                ShellTile TileToFind = ShellTile.ActiveTiles.First();

                if (TileToFind != null)
                {
                    // Create the tile object and set some initial properties for the tile.
                    // The Count value of 12 will show the number 12 on the front of the Tile.
                    // Valid values are 1-99.
                    // A Count value of 0 will indicate that the Count should not be displayed.
                    int   alarmCount = AlarmHelper.AlarmCount();
                    Alarm alarm      = AlarmHelper.NearestAlarm();

                    StandardTileData NewTileData = new StandardTileData
                    {
                        BackgroundImage     = new Uri("/Resources/Images/Tiles/BackgroundImage.png", UriKind.Relative),
                        Title               = "Metro Calendar",
                        Count               = alarmCount,
                        BackTitle           = ((alarm == null) ? "Next alarm" : alarm.BeginTime.ToShortTimeString()),
                        BackContent         = ((alarm == null) ? "No alarm" : alarm.Content),
                        BackBackgroundImage = new Uri("/Resources/Images/Tiles/BackBackgroundImage.png", UriKind.Relative)
                    };

                    TileToFind.Update(NewTileData);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }
        }
        public static void UpdateCycleTile(
            Uri smallBackgroundImage, Uri backgroundImage,
            List <Uri> images, Random random, ShellTile currentTile)
        {
            Uri[] mediumImages = new Uri[9];

            mediumImages[0] = backgroundImage;

            if (Config.AnimateTiles)
            {
                var schema = "isostore:/Shared/ShellContent/{0}";

                for (int i = 1; i < 9; i++)
                {
                    int rand = random.Next(images.Count - 1);

                    mediumImages[i] = new Uri(String.Format(schema, Path.GetFileName(images[rand].OriginalString)), UriKind.Absolute);
                }
            }

            // Get the new cycleTileData type.
            CycleTileData cycleTileData = new CycleTileData
            {
                // Set the properties.
                SmallBackgroundImage = smallBackgroundImage,
                CycleImages          = mediumImages
            };

            // Invoke the new version of ShellTile.Update.
            currentTile.Update(cycleTileData);
        }
예제 #24
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            while (NavigationService.RemoveBackEntry() != null)
            {
                ;
            }

            ShellTile Tile = ShellTile.ActiveTiles.FirstOrDefault();

            if (Tile != null)
            {
                var TileData = new IconicTileData()
                {
                    Title           = "新番提醒",
                    Count           = 0,
                    BackgroundColor = System.Windows.Media.Colors.Transparent,
                    WideContent1    = "",
                    WideContent2    = "",
                    WideContent3    = ""
                };
                Tile.Update(TileData);
            }
        }
예제 #25
0
        // Set all the properties of the Application Tile.
        void SetApplicationTile( string strBackContent )
        {
            // Application Tile is always the first Tile, even if it is not pinned to Start.
            ShellTile TileToFind = ShellTile.ActiveTiles.First();

            // Application should always be found
            if ( null != TileToFind )
            {
                // set the properties to update for the Application Tile
                // Empty strings for the text values and URIs will result in the property being cleared.

                FlipTileData NewTileData = new FlipTileData()
                {
                   Title = AppResources.AppTitle,
                   BackTitle = AppResources.AppTitle,
                   
                   SmallBackgroundImage = new Uri("/Content/SmallBlankTileImage159x159.png", UriKind.Relative),
                   
                   BackgroundImage = new Uri("/Content/MediumBlankTileImage336x336.png", UriKind.Relative),
                   BackBackgroundImage = new Uri("/Content/MediumBlankBackTileImage336x336.png", UriKind.Relative),

                   WideBackgroundImage = new Uri("/Content/WideBackBackgroundTileIcon691x336WithGlow.png", UriKind.Relative),
                   WideBackBackgroundImage = new Uri("/Content/WideBlankBackTileIcon691x336.png", UriKind.Relative),
                };

                // Update the Application Tile
                TileToFind.Update(NewTileData);
            }
        } // SetApplicationTile()
예제 #26
0
        /// <summary>
        /// Updates application live tile
        /// </summary>
        public void updateAppTile(string options)
        {
            LiveTilesOptions liveTileOptions;

            try
            {
                liveTileOptions = JsonHelper.Deserialize <LiveTilesOptions[]>(options)[0];
            }
            catch (Exception)
            {
                DispatchCommandResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
                return;
            }

            try
            {
                ShellTile appTile = ShellTile.ActiveTiles.First();

                if (appTile != null)
                {
                    StandardTileData standardTile = CreateTileData(liveTileOptions);
                    appTile.Update(standardTile);
                    DispatchCommandResult(new PluginResult(PluginResult.Status.OK));
                }
                else
                {
                    DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Can't get application tile"));
                }
            }
            catch (Exception)
            {
                DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Error updating application tile"));
            }
        }
예제 #27
0
파일: Badge.cs 프로젝트: siebmanb/polonium
        /// <summary>
        /// Fügt dem Live Tile eine Badge Nummer hinzu
        /// </summary>
        public void setBadge(string badgeNumber)
        {
            // Application Tile is always the first Tile, even if it is not pinned to Start.
            ShellTile TileToFind = ShellTile.ActiveTiles.First();

            // Application should always be found
            if (TileToFind != null)
            {
                string[] args  = JsonHelper.Deserialize <string[]>(badgeNumber);
                int      count = 0;

                try
                {
                    count = int.Parse(args[0]);
                }
                catch (FormatException) {};

                StandardTileData TileData = new StandardTileData
                {
                    Count = count
                };

                TileToFind.Update(TileData);

                DispatchCommandResult();
            }
        }
예제 #28
0
        /// <summary>
        /// Update the default Live Tile and by extension the lock screen with the count of notifications remaining
        /// in the day, and the title of the next notification.
        /// </summary>
        public static void UpdateDefaultTile()
        {
            // the sample code uses static to enable calls from MainPage.xaml.xs. The code in the book does not use static.
            DateTime now = DateTime.Now;
            //now = new DateTime(now.Year, now.Month, now.Day+2, 0, 0, 0);
            DateTime endOfDay      = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59);
            var      notifications = ScheduledActionService.GetActions <ScheduledNotification>()
                                     .Where((item) => item.BeginTime > now && item.BeginTime < endOfDay)
                                     .OrderBy((item) => item.BeginTime);
            int count = notifications.Count();
            ScheduledNotification nextNotification = notifications.FirstOrDefault();

            string message = null;

            if (nextNotification != null)
            {
                message = string.Format("{0:t} {1}", nextNotification.BeginTime, nextNotification.Title);
            }

            ShellTile        defaultTile = ShellTile.ActiveTiles.First();
            StandardTileData tileData    = new StandardTileData
            {
                Count       = count,
                BackContent = message,
            };

            defaultTile.Update(tileData);
        }
예제 #29
0
        public static void CreateFlipTile(string uri, string contains, string smallBackgroundImage,
                                          string backgroundImage, string widebackgroundImage)
        {
            ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(contains));

            if (tile != null && tile.NavigationUri.ToString().Contains(contains))
            {
                var iconicTileData = new FlipTileData
                {
                    SmallBackgroundImage = new Uri(smallBackgroundImage, UriKind.RelativeOrAbsolute),
                    BackgroundImage      = new Uri(backgroundImage, UriKind.RelativeOrAbsolute),
                    WideBackgroundImage  = new Uri(widebackgroundImage, UriKind.RelativeOrAbsolute),
                    Title = AppResources.TextReboot
                };

                tile.Update(iconicTileData);
                Toast.Title   = AppResources.TextNotice;
                Toast.Message = AppResources.TextSuccessfully;
                Toast.Show();
            }
            else
            {
                var tileUri  = new Uri(uri + contains, UriKind.RelativeOrAbsolute);
                var tileData = new FlipTileData
                {
                    SmallBackgroundImage = new Uri(smallBackgroundImage, UriKind.RelativeOrAbsolute),
                    BackgroundImage      = new Uri(backgroundImage, UriKind.RelativeOrAbsolute),
                    WideBackgroundImage  = new Uri(widebackgroundImage, UriKind.RelativeOrAbsolute),
                    Title = AppResources.TextReboot
                };

                ShellTile.Create(tileUri, tileData, true);
            }
        }
예제 #30
0
파일: LiveTile.cs 프로젝트: kosorin/onedo
        public static void Reset()
        {
            FlipTileData flipTileData = new FlipTileData
            {
                SmallBackgroundImage = new Uri("/Assets/Tiles/SmallTile.png", UriKind.Relative),
                BackgroundImage      = new Uri("/Assets/Tiles/MediumTile.png", UriKind.Relative),
                WideBackgroundImage  = new Uri("/Assets/Tiles/WideTile.png", UriKind.Relative),
                Title = AppInfo.Name,
                Count = 0,
            };

            try
            {
                ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault();
                if (tile != null)
                {
                    tile.Update(flipTileData);
                    Debug.WriteLine("> Reset primární dlaždice dokončena.");
                }
            }
            catch
            {
                Debug.WriteLine("Chyba při resetu primární dlaždice.");
            }
        }
예제 #31
0
        public void UpdateLiveTileNotification(Item item)
        {
#if NETFX_CORE
            var notification = GetPrimaryTileNotification(item);
            UpdatePrimaryTile(notification);
#endif

#if WINDOWS_PHONE
            try
            {
                ShellTile appTile = ShellTile.ActiveTiles.First();

                var tileData = new FlipTileData()
                {
                    //BackContent = item.Title,
                    BackTitle = item.Title,
                    //Title = item.Title,
                    //WideBackContent = item.Title
                };

                if (item.Image.Length > 0)
                {
                    tileData.BackBackgroundImage     = new Uri(item.Image);
                    tileData.SmallBackgroundImage    = new Uri(item.Image);
                    tileData.WideBackBackgroundImage = new Uri(item.Image);
                }

                appTile.Update(tileData);
            }
            catch { };
#endif
        }
예제 #32
0
        public void DisplayApplicationTile(String title)
        {
            applicationTile = ShellTile.ActiveTiles.First();

            if (applicationTile != null)
            {
                StandardTileData NewTileData = new StandardTileData
                {
                    Title = title,
                    BackgroundImage = new Uri(Const.APP_TILE_FOR_IMG, UriKind.Relative),
                    Count = 0,
                    BackTitle = Const.APP_TITL_BACK_TITLE,
                    BackBackgroundImage = new Uri(Const.APP_TILE_BACK_IMG, UriKind.Relative),
                    BackContent = Const.APP_TITE_BACK_CONTENT
                };
                applicationTile.Update(NewTileData);
            }

        }
예제 #33
0
        private void UpdateOrPinForRealz(ShellTile tile, Uri navigationUri, AppTileSettings.TileSettings tileSettings)
        {
            AppTileSettings.Instance.Tiles[navigationUri] = tileSettings;
            AppTileSettings.Instance.Save();

            var shellTileData = new StandardTileData
            {
                Title = tileSettings.Title,
                BackgroundImage = tileSettings.ShellFrontPhotoPath != null ? tileSettings.ShellFrontPhotoPath : tileSettings.FrontPhoto,
                BackBackgroundImage = tileSettings.BackPhoto,
            };

            if (tile == null)
            {
                // Pin.
                try
                {
                    ShellTile.Create(navigationUri, shellTileData);
                }
                catch (InvalidOperationException)
                {
                    AppTileSettings.Instance.Tiles.Remove(navigationUri);
                    AppTileSettings.Instance.Save();
                    MessageBox.Show("Unfortunately the tile could not be created at this time.");
                }
            }
            else
            {
                // Update.
                tile.Update(shellTileData);
            }
        }
예제 #34
0
        // Do whatever action the button requested
        public void DoTileAction(string tileAction, Uri tileId, ShellTile tileToFind, ShellTileData tileData)
        {
            switch (tileAction)
            {
                case "create":
                    ShellTile.Create(tileId, tileData, true);
                    break;

                case "update":
                    tileToFind.Update(tileData);
                    break;

                case "delete":
                    tileToFind.Delete();
                    break;
            }
        }
        private void UpdateTile(ShellTile tile)
        {
            StandardTileData newTileData = new StandardTileData();

            // set tile data
            this.SetTileData(this.tbTitle, (text) => newTileData.Title = text);
            this.SetTileData(this.tbBackTitle, (text) => newTileData.BackTitle = text);
            this.SetTileData(this.tbBackContent, (text) => newTileData.BackContent = text);

            // update tile
            tile.Update(newTileData);

            MessageBox.Show("Tile updated. Go to home screen to see the result.");
        }