Exemple #1
0
 //Notification - Bing description
 void ShowNotiBingDescription()
 {
     try
     {
         if (setNotiBingDescription)
         {
             if (setNotiStyle == 0)
             {
                 Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Menu/Background.png\"/><text id=\"1\">Daily Bing description</text><text id=\"2\">" + WebUtility.HtmlEncode(BgStatusBingDescription) + "</text></binding></visual><audio silent=\"true\"/></toast>");
                 Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                 {
                     SuppressPopup = true, Tag = "T2", Group = "G1"
                 });
             }
             else if (setNotiStyle == 1)
             {
                 Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Menu/Background.png\"/><text id=\"1\">Daily Bing description</text><text id=\"2\">" + WebUtility.HtmlEncode(BgStatusBingDescription) + "</text></binding></visual><audio silent=\"true\"/></toast>");
                 Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                 {
                     SuppressPopup = false, Tag = "T2", Group = "G1"
                 });
             }
             else if (setNotiStyle == 2)
             {
                 Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Menu/Background.png\"/><text id=\"1\">Daily Bing description</text><text id=\"2\">" + WebUtility.HtmlEncode(BgStatusBingDescription) + "</text></binding></visual><audio silent=\"false\"/></toast>");
                 Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                 {
                     SuppressPopup = false, Tag = "T2", Group = "G1"
                 });
             }
         }
         //else { Toast_History.Remove("T2", "G1"); }
     }
     catch { }
 }
Exemple #2
0
        //Set weather tile to disabled
        XmlDocument RenderTileWeatherDisabled()
        {
            try
            {
                //Reset secondary weather tile
                if (TileWeather_Pinned)
                {
                    Debug.WriteLine("Set weather tile to disabled.");

                    Tile_UpdateManager  = TileUpdateManager.CreateTileUpdaterForSecondaryTile("TimeMeWeatherTile");
                    Tile_PlannedUpdates = Tile_UpdateManager.GetScheduledTileNotifications();

                    foreach (ScheduledTileNotification Tile_Update in Tile_PlannedUpdates)
                    {
                        try { Tile_UpdateManager.RemoveFromSchedule(Tile_Update); } catch { }
                    }
                    BadgeUpdateManager.CreateBadgeUpdaterForSecondaryTile("TimeMeWeatherTile").Clear();

                    Tile_XmlContent.LoadXml("<tile><visual branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoWeatherDisabled.png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/WideLogoWeatherDisabled.png\"/></binding></visual></tile>");
                    Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
                }
            }
            catch { }
            return(Tile_XmlContent);
        }
Exemple #3
0
 //Notification - Network change
 void ShowNotiNetworkChange()
 {
     try
     {
         if (setNotiNetworkChange)
         {
             if (setNotiStyle == 0)
             {
                 Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Icons/Network.png\"/><text id=\"1\">Network has changed</text><text id=\"2\">You are now on: " + TextNetworkName + "</text></binding></visual><audio silent=\"true\"/></toast>");
                 Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                 {
                     SuppressPopup = true, Tag = "T9", Group = "G1"
                 });
             }
             else if (setNotiStyle == 1)
             {
                 Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Icons/Network.png\"/><text id=\"1\">Network has changed</text><text id=\"2\">You are now on: " + TextNetworkName + "</text></binding></visual><audio silent=\"true\"/></toast>");
                 Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                 {
                     SuppressPopup = false, Tag = "T9", Group = "G1"
                 });
             }
             else if (setNotiStyle == 2)
             {
                 Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Icons/Network.png\"/><text id=\"1\">Network has changed</text><text id=\"2\">You are now on: " + TextNetworkName + "</text></binding></visual><audio silent=\"false\"/></toast>");
                 Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                 {
                     SuppressPopup = false, Tag = "T9", Group = "G1"
                 });
             }
         }
         //else { Toast_History.Remove("T9", "G1"); }
     }
     catch { }
 }
Exemple #4
0
 //Notification - Next calendar time
 void ShowNotiCalendarTime()
 {
     try
     {
         if (setNotiCalendarTime && !String.IsNullOrEmpty(CalendarAppoName))
         {
             if (setNotiStyle == 0)
             {
                 Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Menu/Calendar.png\"/><text id=\"1\">" + WebUtility.HtmlEncode(CalendarAppoName) + "</text><text id=\"2\">" + WebUtility.HtmlEncode(CalendarAppoSummary + "\n" + CalendarAppoEstimated) + "</text></binding></visual><audio silent=\"true\"/></toast>");
                 Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                 {
                     SuppressPopup = true, Tag = "T4", Group = "G1"
                 });
             }
             else if (setNotiStyle == 1)
             {
                 Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Menu/Calendar.png\"/><text id=\"1\">" + WebUtility.HtmlEncode(CalendarAppoName) + "</text><text id=\"2\">" + WebUtility.HtmlEncode(CalendarAppoSummary + "\n" + CalendarAppoEstimated) + "</text></binding></visual><audio silent=\"true\"/></toast>");
                 Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                 {
                     SuppressPopup = false, Tag = "T4", Group = "G1"
                 });
             }
             else if (setNotiStyle == 2)
             {
                 Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Menu/Calendar.png\"/><text id=\"1\">" + WebUtility.HtmlEncode(CalendarAppoName) + "</text><text id=\"2\">" + WebUtility.HtmlEncode(CalendarAppoSummary + "\n" + CalendarAppoEstimated) + "</text></binding></visual><audio silent=\"false\"/></toast>");
                 Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                 {
                     SuppressPopup = false, Tag = "T4", Group = "G1"
                 });
             }
         }
         //else { Toast_History.Remove("T4", "G1"); }
     }
     catch { }
 }
Exemple #5
0
        //Set tile to failed update
        XmlDocument RenderTileLiveFailed(string TileId)
        {
            try
            {
                Debug.WriteLine("Set tile to failed: " + TileId);

                //Reset primary tile
                BadgeUpdateManager.CreateBadgeUpdaterForApplication().Clear();
                TileUpdateManager.CreateTileUpdaterForApplication().Clear();

                Tile_UpdateManager  = TileUpdateManager.CreateTileUpdaterForSecondaryTile(TileId);
                Tile_PlannedUpdates = Tile_UpdateManager.GetScheduledTileNotifications();

                foreach (ScheduledTileNotification Tile_Update in Tile_PlannedUpdates)
                {
                    try { Tile_UpdateManager.RemoveFromSchedule(Tile_Update); } catch { }
                }
                BadgeUpdateManager.CreateBadgeUpdaterForSecondaryTile(TileId).Clear();

                Tile_XmlContent.LoadXml("<tile><visual branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoFailed.png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/WideLogoFailed.png\"/></binding></visual></tile>");
                Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
            }
            catch { }
            return(Tile_XmlContent);
        }
Exemple #6
0
        //Set battery tile to disabled
        XmlDocument RenderTileBatteryDisabled()
        {
            try
            {
                //Reset secondary battery tile
                if (TileBattery_Pinned)
                {
                    Debug.WriteLine("Set battery tile to disabled.");

                    Tile_UpdateManager  = TileUpdateManager.CreateTileUpdaterForSecondaryTile("TimeMeBatteryTile");
                    Tile_PlannedUpdates = Tile_UpdateManager.GetScheduledTileNotifications();

                    foreach (ScheduledTileNotification Tile_Update in Tile_PlannedUpdates)
                    {
                        try { Tile_UpdateManager.RemoveFromSchedule(Tile_Update); } catch { }
                    }
                    BadgeUpdateManager.CreateBadgeUpdaterForSecondaryTile("TimeMeBatteryTile").Clear();

                    string TileImage         = "<group><subgroup><image src=\"ms-appx:///Assets/BatterySquare/BatteryVerNoBattery.png\"/></subgroup></group>";
                    string BatterySmallTile  = "<binding template=\"TileSmall\">" + TileBattery_BackgroundPhotoXml + TileImage + "</binding>";
                    string BatteryMediumTile = "<binding template=\"TileMedium\">" + TileBattery_BackgroundPhotoXml + TileImage + "</binding>";
                    string BatteryWideTile   = "<binding template=\"TileWide\">" + TileBattery_BackgroundPhotoXml + TileImage + "</binding>";

                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\">" + BatterySmallTile + BatteryMediumTile + BatteryWideTile + "</visual></tile>");
                    Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
                }
            }
            catch { }
            return(Tile_XmlContent);
        }
Exemple #7
0
        //Notification - Day time progression
        void ShowNotiDayTime()
        {
            try
            {
                if (setNotiDayTime)
                {
                    //Load Day Time Remaining
                    TimeSpan TimeTomorrow = DateTime.Today.AddDays(1).Subtract(DateTimeNow);
                    int      TimeTomorrowHours = TimeTomorrow.Hours; int TimeTomorrowMinutes = TimeTomorrow.Minutes;

                    string TimeTillTomorrow = "";
                    if (TimeTomorrowHours != 0)
                    {
                        TimeTillTomorrow = TimeTillTomorrow + TimeTomorrowHours + "h ";
                    }
                    if (TimeTomorrowMinutes != 0)
                    {
                        TimeTillTomorrow = TimeTillTomorrow + TimeTomorrowMinutes + "m ";
                    }
                    if (String.IsNullOrEmpty(TimeTillTomorrow))
                    {
                        TimeTillTomorrow = "a minute ";
                    }

                    //Set Notification Clock Icon
                    string ClockIcon = "ms-appx:///Assets/Analog/Minimal/" + DateTimeNow.ToString("hmm") + ".png";

                    if (setNotiStyle == 0)
                    {
                        Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"" + ClockIcon + "\"/><text id=\"1\">The day has progressed " + DayTimeProgress + "%</text><text id=\"2\">And has about " + TimeTillTomorrow + "time remaining, enjoy the rest of your day!</text></binding></visual><audio silent=\"true\"/></toast>");
                        Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                        {
                            SuppressPopup = true, Tag = "T5", Group = "G1"
                        });
                    }
                    else if (setNotiStyle == 1)
                    {
                        Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"" + ClockIcon + "\"/><text id=\"1\">The day has progressed " + DayTimeProgress + "%</text><text id=\"2\">And has about " + TimeTillTomorrow + "time remaining, enjoy the rest of your day!</text></binding></visual><audio silent=\"true\"/></toast>");
                        Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                        {
                            SuppressPopup = false, Tag = "T5", Group = "G1"
                        });
                    }
                    else if (setNotiStyle == 2)
                    {
                        Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"" + ClockIcon + "\"/><text id=\"1\">The day has progressed " + DayTimeProgress + "%</text><text id=\"2\">And has about " + TimeTillTomorrow + "time remaining, enjoy the rest of your day!</text></binding></visual><audio silent=\"false\"/></toast>");
                        Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                        {
                            SuppressPopup = false, Tag = "T5", Group = "G1"
                        });
                    }
                }
                //else { Toast_History.Remove("T5", "G1"); }
            }
            catch { }
        }
Exemple #8
0
        //Notification - Current Battery Level
        void ShowNotiBattery()
        {
            try
            {
                if (setNotiBattery)
                {
                    if (BatteryLevel != "error")
                    {
                        string NotiBattery = "";
                        if (BatteryCharging)
                        {
                            NotiBattery = BatteryLevel + "% left and is now charging";
                        }
                        else
                        {
                            NotiBattery = BatteryLevel + "% battery life left and " + BatteryTime.ToLower() + "time remaining";
                        }

                        if (setNotiStyle == 0)
                        {
                            Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/BatterySquare/BatteryVer" + BatteryIcon + ".png\"/><text id=\"1\">Your battery level now has</text><text id=\"2\">" + NotiBattery + "</text></binding></visual><audio silent=\"true\"/></toast>");
                            Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                            {
                                SuppressPopup = true, Tag = "T3", Group = "G1"
                            });
                        }
                        else if (setNotiStyle == 1)
                        {
                            Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/BatterySquare/BatteryVer" + BatteryIcon + ".png\"/><text id=\"1\">Your battery level now has</text><text id=\"2\">" + NotiBattery + "</text></binding></visual><audio silent=\"true\"/></toast>");
                            Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                            {
                                SuppressPopup = false, Tag = "T3", Group = "G1"
                            });
                        }
                        else if (setNotiStyle == 2)
                        {
                            Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/BatterySquare/BatteryVer" + BatteryIcon + ".png\"/><text id=\"1\">Your battery level now has</text><text id=\"2\">" + NotiBattery + "</text></binding></visual><audio silent=\"false\"/></toast>");
                            Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                            {
                                SuppressPopup = false, Tag = "T3", Group = "G1"
                            });
                        }
                    }
                    else
                    {
                        Toast_History.Remove("T3", "G1");
                    }
                }
            }
            catch { }
        }
Exemple #9
0
        //Notification - Current Weather
        void ShowNotiWeatherCurrent()
        {
            try
            {
                if (setNotiWeatherCurrent)
                {
                    string NotiRainChance = BgStatusWeatherCurrentRainChance + " chance of rain";
                    string NotiWindSpeed  = "\n" + BgStatusWeatherCurrentWindSpeed + " windspeed";

                    string NotiLocation = BgStatusWeatherCurrentLocation;
                    if (NotiLocation.Length < 7)
                    {
                        NotiLocation = "\nNear town " + NotiLocation;
                    }
                    else if (NotiLocation.Length < 15)
                    {
                        NotiLocation = "\nNear " + NotiLocation;
                    }

                    if (setNotiStyle == 0)
                    {
                        Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/WeatherSquare" + WeatherIconStyle + "/" + WeatherIconCurrent + ".png\"/><text id=\"1\">" + WebUtility.HtmlEncode(BgStatusWeatherCurrent) + "</text><text id=\"2\">" + WebUtility.HtmlEncode(NotiRainChance) + WebUtility.HtmlEncode(NotiWindSpeed) + WebUtility.HtmlEncode(NotiLocation) + "</text></binding></visual><audio silent=\"true\"/></toast>");
                        Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                        {
                            SuppressPopup = true, Tag = "T1", Group = "G1"
                        });
                    }
                    else if (setNotiStyle == 1)
                    {
                        Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/WeatherSquare" + WeatherIconStyle + "/" + WeatherIconCurrent + ".png\"/><text id=\"1\">" + WebUtility.HtmlEncode(BgStatusWeatherCurrent) + "</text><text id=\"2\">" + WebUtility.HtmlEncode(NotiRainChance) + WebUtility.HtmlEncode(NotiWindSpeed) + WebUtility.HtmlEncode(NotiLocation) + "</text></binding></visual><audio silent=\"true\"/></toast>");
                        Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                        {
                            SuppressPopup = false, Tag = "T1", Group = "G1"
                        });
                    }
                    else if (setNotiStyle == 2)
                    {
                        Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/WeatherSquare" + WeatherIconStyle + "/" + WeatherIconCurrent + ".png\"/><text id=\"1\">" + WebUtility.HtmlEncode(BgStatusWeatherCurrent) + "</text><text id=\"2\">" + WebUtility.HtmlEncode(NotiRainChance) + WebUtility.HtmlEncode(NotiWindSpeed) + WebUtility.HtmlEncode(NotiLocation) + "</text></binding></visual><audio silent=\"false\"/></toast>");
                        Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                        {
                            SuppressPopup = false, Tag = "T1", Group = "G1"
                        });
                    }
                }
                //else { Toast_History.Remove("T1", "G1"); }
            }
            catch { }
        }
Exemple #10
0
        //Notification - Countdown Time
        void ShowNotiCountdownTime()
        {
            try
            {
                if (setNotiCountdownTime && !String.IsNullOrEmpty(CountdownEventName) && !String.IsNullOrEmpty(CountdownEventDate))
                {
                    string CountDownDateText = String.Empty;
                    if (CountdownEventDate == "today")
                    {
                        CountDownDateText = "Is today's event";
                    }
                    else
                    {
                        CountDownDateText = "Arrives in " + CountdownEventDate + " days";
                    }

                    if (setNotiStyle == 0)
                    {
                        Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Menu/Countdown.png\"/><text id=\"1\">" + WebUtility.HtmlEncode(CountdownEventName) + "</text><text id=\"2\">" + WebUtility.HtmlEncode(CountDownDateText) + "</text></binding></visual><audio silent=\"true\"/></toast>");
                        Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                        {
                            SuppressPopup = true, Tag = "T7", Group = "G1"
                        });
                    }
                    else if (setNotiStyle == 1)
                    {
                        Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Menu/Countdown.png\"/><text id=\"1\">" + WebUtility.HtmlEncode(CountdownEventName) + "</text><text id=\"2\">" + WebUtility.HtmlEncode(CountDownDateText) + "</text></binding></visual><audio silent=\"true\"/></toast>");
                        Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                        {
                            SuppressPopup = false, Tag = "T7", Group = "G1"
                        });
                    }
                    else if (setNotiStyle == 2)
                    {
                        Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Menu/Countdown.png\"/><text id=\"1\">" + WebUtility.HtmlEncode(CountdownEventName) + "</text><text id=\"2\">" + WebUtility.HtmlEncode(CountDownDateText) + "</text></binding></visual><audio silent=\"false\"/></toast>");
                        Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                        {
                            SuppressPopup = false, Tag = "T7", Group = "G1"
                        });
                    }
                }
                //else { Toast_History.Remove("T7", "G1"); }
            }
            catch { }
        }
Exemple #11
0
 //Notification - Current week number
 void ShowNotiWeekNumber()
 {
     try
     {
         if (setNotiWeekNumber)
         {
             //if (DateTimeNow.DayOfWeek == vCultureInfoReg.DateTimeFormat.FirstDayOfWeek)
             if (DateTimeNow.DayOfWeek == DayOfWeek.Monday || BgStatusLastRunDate == "Never")
             {
                 if (BgStatusLastRunDate == "Never" || DateTime.Parse(BgStatusLastRunDate, vCultureInfoEng).Day != DateTimeNow.Day)
                 {
                     if (setNotiStyle == 0)
                     {
                         Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Menu/Week.png\"/><text id=\"1\">Welcome to a new week</text><text id=\"2\">We are in week number " + WeekNumberCurrent + "</text></binding></visual><audio silent=\"true\"/></toast>");
                         Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                         {
                             SuppressPopup = true, Tag = "T6", Group = "G1"
                         });
                     }
                     else if (setNotiStyle == 1)
                     {
                         Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Menu/Week.png\"/><text id=\"1\">Welcome to a new week</text><text id=\"2\">We are in week number " + WeekNumberCurrent + "</text></binding></visual><audio silent=\"true\"/></toast>");
                         Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                         {
                             SuppressPopup = false, Tag = "T6", Group = "G1"
                         });
                     }
                     else if (setNotiStyle == 2)
                     {
                         Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Menu/Week.png\"/><text id=\"1\">Welcome to a new week</text><text id=\"2\">We are in week number " + WeekNumberCurrent + "</text></binding></visual><audio silent=\"false\"/></toast>");
                         Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                         {
                             SuppressPopup = false, Tag = "T6", Group = "G1"
                         });
                     }
                 }
             }
         }
         //else { Toast_History.Remove("T6", "G1"); }
     }
     catch { }
 }
Exemple #12
0
        //Notification - Battery Saver Warning
        async Task ShowNotiBatterySaver()
        {
            try
            {
                if (setNotiBatterySaver && AVFunctions.DevOsVersion() >= 14393)
                {
                    BackgroundAccessStatus BackgroundManager = await BackgroundExecutionManager.RequestAccessAsync();

                    if (BatteryLevel != "error" && BackgroundManager != BackgroundAccessStatus.AlwaysAllowed)
                    {
                        if (setNotiStyle == 0)
                        {
                            Tile_XmlContent.LoadXml("<toast launch=\"NotiBatterySaver\"><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Icons/BatteryLevelSquare.png\"/><text id=\"1\">Hello battery device user,</text><text id=\"2\">Please make sure TimeMe is always allowed to run in the background battery saver to keep the tile up-to-date.</text></binding></visual><audio silent=\"true\"/></toast>");
                            Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                            {
                                SuppressPopup = true, Tag = "T8", Group = "G1"
                            });
                        }
                        else if (setNotiStyle == 1)
                        {
                            Tile_XmlContent.LoadXml("<toast launch=\"NotiBatterySaver\"><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Icons/BatteryLevelSquare.png\"/><text id=\"1\">Hello battery device user,</text><text id=\"2\">Please make sure TimeMe is always allowed to run in the background battery saver to keep the tile up-to-date.</text></binding></visual><audio silent=\"true\"/></toast>");
                            Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                            {
                                SuppressPopup = false, Tag = "T8", Group = "G1"
                            });
                        }
                        else if (setNotiStyle == 2)
                        {
                            Tile_XmlContent.LoadXml("<toast launch=\"NotiBatterySaver\"><visual><binding template=\"ToastImageAndText02\"><image id=\"1\" src=\"ms-appx:///Assets/Icons/BatteryLevelSquare.png\"/><text id=\"1\">Hello battery device user,</text><text id=\"2\">Please make sure TimeMe is always allowed to run in the background battery saver to keep the tile up-to-date.</text></binding></visual><audio silent=\"false\"/></toast>");
                            Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                            {
                                SuppressPopup = false, Tag = "T8", Group = "G1"
                            });
                        }
                    }
                    //else if (!setNotiBattery) { Toast_History.Remove("T8", "G1"); }
                }
            }
            catch { }
        }
Exemple #13
0
        //Render weather tile front
        void RenderWeatherTile()
        {
            try
            {
                Debug.WriteLine("Started rendering the weather tile.");

                //Render lite flip weather tile
                if (setWeatherTileSizeName == "WeatherLiteFlip")
                {
                    //Set the peek image
                    string PeekImage = "<image placement=\"peek\" src=\"ms-appx:///Assets/WeatherSquare" + WeatherIconStyle + "/" + WeatherIconCurrent + ".png\"/>";

                    //Set Small Tile Texts
                    string SmallTileFontSize = "title";
                    if (BgStatusWeatherCurrentTemp.Length > 3)
                    {
                        SmallTileFontSize = "subtitle";
                    }
                    string WeatherSmallTile = "<binding template=\"TileSmall\" hint-textStacking=\"center\">" + PeekImage + "<group><subgroup><text hint-style=\"" + SmallTileFontSize + "\" hint-align=\"center\">" + BgStatusWeatherCurrentTemp + "</text></subgroup></group></binding>";

                    //Set Medium Tile Texts
                    string WeatherMediumTile = "<binding template=\"TileMedium\" hint-textStacking=\"center\">" + PeekImage + "<group><subgroup><text hint-style=\"header\" hint-align=\"center\">" + BgStatusWeatherCurrentTemp + "</text></subgroup></group></binding>";

                    //Set Wide Tile Texts
                    string WeatherWideTile = "<binding template=\"TileWide\" hint-textStacking=\"center\">" + PeekImage + "<group><subgroup><text hint-style=\"header\" hint-align=\"center\">" + BgStatusWeatherCurrentTemp + "</text></subgroup></group></binding>";

                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\">" + WeatherSmallTile + WeatherMediumTile + WeatherWideTile + "</visual></tile>");
                    Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
                }

                //Render grey weather tile
                else if (setWeatherTileSizeName == "WeatherGrey")
                {
                    //Set Multi Variables
                    string WeatherMultiDetails = WeatherDetailed;
                    if (setDisplayWeatherTileUpdateTime)
                    {
                        WeatherMultiDetails = WeatherLastUpdate;
                    }

                    //Set Small Tile Texts
                    string WeatherSmallTile = "<binding template=\"TileSmall\" hint-textStacking=\"center\">" + TileWeather_BackgroundPhotoXml + "<image src=\"ms-appx:///Assets/WeatherSquare" + WeatherIconStyle + "/" + WeatherIconCurrent + ".png\"/></binding>";

                    //Set Medium Tile Texts
                    string GroupWeatherText  = "<group><subgroup><text hint-style=\"captionSubtle\" hint-align=\"center\">" + WeatherMultiDetails + "</text></subgroup></group>";
                    string GroupWeatherTemps = "<group><subgroup hint-textStacking=\"center\"><image src=\"ms-appx:///Assets/WeatherSquare" + WeatherIconStyle + "/" + WeatherIconCurrent + ".png\" hint-removeMargin=\"true\"/></subgroup> <subgroup hint-textStacking=\"center\"><text hint-style=\"title\">" + BgStatusWeatherCurrentTemp + "</text></subgroup></group>";
                    string WeatherMediumTile = "<binding template=\"TileMedium\" hint-textStacking=\"center\">" + TileWeather_BackgroundPhotoXml + GroupWeatherTemps + GroupWeatherText + "</binding>";

                    //Set Wide Tile Texts
                    GroupWeatherText  = "<group><subgroup><text hint-style=\"titleNumeralSubtle\">" + WeatherMultiDetails + "</text></subgroup></group>";
                    GroupWeatherTemps = "<group><subgroup hint-textStacking=\"center\" hint-weight=\"35\"><image src=\"ms-appx:///Assets/WeatherSquare" + WeatherIconStyle + "/" + WeatherIconCurrent + ".png\" hint-removeMargin=\"true\"/></subgroup> <subgroup hint-textStacking=\"center\"><text hint-style=\"title\">" + BgStatusWeatherCurrentTemp + "</text></subgroup></group>";
                    string WeatherWideTile = "<binding template=\"TileWide\" hint-textStacking=\"center\">" + TileWeather_BackgroundPhotoXml + GroupWeatherTemps + GroupWeatherText + "</binding>";

                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\">" + WeatherSmallTile + WeatherMediumTile + WeatherWideTile + "</visual></tile>");
                    Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
                }

                //Render icon weather tile
                else if (setWeatherTileSizeName == "WeatherIcon")
                {
                    //Set Small Tile Texts
                    string SmallTileFontSize = "title";
                    if (BgStatusWeatherCurrentTemp.Length > 3)
                    {
                        SmallTileFontSize = "subtitle";
                    }
                    string WeatherSmallTile = "<binding template=\"TileSmall\" hint-textStacking=\"center\">" + TileWeather_BackgroundPhotoXml + "<group><subgroup><text hint-style=\"" + SmallTileFontSize + "\" hint-align=\"center\">" + BgStatusWeatherCurrentTemp + "</text></subgroup></group></binding>";

                    //Set Medium Tile Texts
                    string WeatherTextCurrent  = "";
                    string WeatherTextDetailed = "";
                    string WeatherTextUpdate   = "";
                    string WeatherImageCurrent = "";

                    if (BgStatusWeatherCurrent.Length < 13)
                    {
                        WeatherTextCurrent = "<text hint-style=\"caption\" hint-align=\"center\">" + BgStatusWeatherCurrent + "</text>";
                    }
                    else
                    {
                        WeatherTextCurrent = "<text hint-style=\"caption\" hint-align=\"center\">" + BgStatusWeatherCurrentTemp.Replace("°", " degrees") + "</text>";
                    }
                    if (setDisplayWeatherTileLocation || setDisplayWeatherTileProvider)
                    {
                        WeatherTextDetailed = "<text hint-style=\"captionSubtle\" hint-align=\"center\">" + WeatherDetailed + "</text>";
                    }
                    if (setDisplayWeatherTileUpdateTime)
                    {
                        WeatherTextUpdate = "<text hint-style=\"captionSubtle\" hint-align=\"center\">" + WeatherLastUpdate + "</text>";
                    }

                    if (setDisplayWeatherTileLocation || setDisplayWeatherTileProvider || setDisplayWeatherTileUpdateTime)
                    {
                        WeatherImageCurrent = "<group><subgroup hint-weight=\"1\"/><subgroup hint-weight=\"2\"><image src=\"ms-appx:///Assets/Weather" + WeatherIconStyle + "/" + WeatherIconCurrent + ".png\" hint-removeMargin=\"true\"/></subgroup><subgroup hint-weight=\"1\"/></group>";
                    }
                    else
                    {
                        WeatherImageCurrent = "<group><subgroup hint-weight=\"1\"/><subgroup hint-weight=\"100\"><image src=\"ms-appx:///Assets/Weather" + WeatherIconStyle + "/" + WeatherIconCurrent + ".png\" hint-removeMargin=\"true\"/></subgroup><subgroup hint-weight=\"1\"/></group>";
                    }
                    string WeatherMediumTile = "<binding template=\"TileMedium\" hint-textStacking=\"center\">" + TileWeather_BackgroundPhotoXml + WeatherImageCurrent + WeatherTextCurrent + WeatherTextDetailed + WeatherTextUpdate + "</binding>";

                    //Set Wide Tile Texts
                    WeatherTextCurrent = "<text hint-style=\"caption\" hint-align=\"left\">" + BgStatusWeatherCurrent + "</text>";
                    if (setDisplayWeatherTileLocation || setDisplayWeatherTileProvider)
                    {
                        WeatherTextDetailed = "<text hint-style=\"captionSubtle\" hint-align=\"left\">" + WeatherDetailed + "</text>";
                    }
                    if (setDisplayWeatherTileUpdateTime)
                    {
                        WeatherTextUpdate = "<text hint-style=\"captionSubtle\" hint-align=\"left\">" + WeatherLastUpdate + "</text>";
                    }
                    string WeatherWideTile = "<binding template=\"TileWide\" hint-textStacking=\"center\">" + TileWeather_BackgroundPhotoXml + "<group><subgroup hint-weight=\"35\" hint-textStacking=\"center\"><image src=\"ms-appx:///Assets/Weather" + WeatherIconStyle + "/" + WeatherIconCurrent + ".png\" hint-removeMargin=\"true\"/></subgroup><subgroup hint-weight=\"65\" hint-textStacking=\"center\">" + WeatherTextCurrent + WeatherTextDetailed + WeatherTextUpdate + "</subgroup></group></binding>";

                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\">" + WeatherSmallTile + WeatherMediumTile + WeatherWideTile + "</visual></tile>");
                    Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
                }

                //Render summary weather tile
                else if (setWeatherTileSizeName == "WeatherSumm")
                {
                    //Set Multi Variables
                    string GroupWeatherText = "<group><subgroup hint-textStacking=\"center\"><text hint-style=\"caption\" hint-align=\"left\">" + BgStatusWeatherCurrentText + "</text></subgroup></group>";

                    //Set Small Tile Texts
                    string SmallTileFontSize = "title";
                    if (BgStatusWeatherCurrentTemp.Length > 3)
                    {
                        SmallTileFontSize = "subtitle";
                    }
                    string WeatherSmallTile = "<binding template=\"TileSmall\" hint-textStacking=\"center\">" + TileWeather_BackgroundPhotoXml + "<group><subgroup><text hint-style=\"" + SmallTileFontSize + "\" hint-align=\"center\">" + BgStatusWeatherCurrentTemp + "</text></subgroup></group></binding>";

                    //Set Medium Tile Texts
                    string GroupWeatherTemps = "";
                    if (setDisplayWeatherTempHighLow)
                    {
                        GroupWeatherTemps = "<group><subgroup hint-textStacking=\"center\" hint-weight=\"70\"><text hint-style=\"titleNumeral\" hint-align=\"left\">" + BgStatusWeatherCurrentTemp + "</text></subgroup> <subgroup><text hint-align=\"right\">" + BgStatusWeatherCurrentTempHigh + "</text><text hint-style=\"captionSubtle\" hint-align=\"right\">" + BgStatusWeatherCurrentTempLow + "</text></subgroup></group>";
                    }
                    else
                    {
                        GroupWeatherTemps = "<group><subgroup hint-textStacking=\"center\" hint-weight=\"1\"><image src=\"ms-appx:///Assets/Weather" + WeatherIconStyle + "/" + WeatherIconCurrent + ".png\" hint-removeMargin=\"true\"/></subgroup> <subgroup hint-textStacking=\"center\" hint-weight=\"2\"><text hint-style=\"titleNumeral\" hint-align=\"left\">" + BgStatusWeatherCurrentTemp + "</text></subgroup></group>";
                    }

                    string GroupWeatherPrecip = "<group><subgroup hint-weight=\"17\" hint-textStacking=\"center\"><image src=\"ms-appx:///Assets/WeatherOther/tab_Precipitation.png\" hint-removeMargin=\"true\"/></subgroup><subgroup hint-textStacking=\"center\"><text hint-style=\"caption\" hint-align=\"left\">" + BgStatusWeatherCurrentRainChance + "</text></subgroup></group>";
                    string GroupWeatherWind   = "<group><subgroup hint-weight=\"17\" hint-textStacking=\"center\"><image src=\"ms-appx:///Assets/WeatherOther/tab_WindSpeed.png\" hint-removeMargin=\"true\"/></subgroup><subgroup hint-textStacking=\"center\"><text hint-style=\"caption\" hint-align=\"left\">" + BgStatusWeatherCurrentWindSpeed + "</text></subgroup></group>";
                    string WeatherMediumTile  = "<binding template=\"TileMedium\">" + TileWeather_BackgroundPhotoXml + GroupWeatherTemps + GroupWeatherText + GroupWeatherWind + GroupWeatherPrecip + "</binding>";

                    //Set Wide Tile Texts
                    string WeatherTextDetailed = "";
                    string WeatherTextUpdate   = "";
                    if (setDisplayWeatherTileLocation || setDisplayWeatherTileProvider)
                    {
                        if (setDisplayWeatherTempHighLow)
                        {
                            WeatherTextDetailed = "<text hint-align=\"left\">" + WeatherDetailed + "</text>";
                        }
                        else
                        {
                            WeatherTextDetailed = "<text hint-align=\"right\">" + WeatherDetailed + "</text>";
                        }
                    }
                    if (setDisplayWeatherTileUpdateTime)
                    {
                        if (setDisplayWeatherTempHighLow)
                        {
                            WeatherTextUpdate = "<text hint-style=\"captionSubtle\" hint-align=\"left\">" + WeatherLastUpdate + "</text>";
                        }
                        else
                        {
                            WeatherTextUpdate = "<text hint-style=\"captionSubtle\" hint-align=\"right\">" + WeatherLastUpdate + "</text>";
                        }
                    }

                    if (setDisplayWeatherTempHighLow)
                    {
                        GroupWeatherTemps = "<group><subgroup hint-textStacking=\"center\" hint-weight=\"1\"><image src=\"ms-appx:///Assets/Weather" + WeatherIconStyle + "/" + WeatherIconCurrent + ".png\" hint-removeMargin=\"true\"/></subgroup> <subgroup hint-textStacking=\"center\" hint-weight=\"2\"><text hint-style=\"titleNumeral\" hint-align=\"left\">" + BgStatusWeatherCurrentTemp + "</text></subgroup> <subgroup hint-weight=\"1\"><text hint-align=\"right\">" + BgStatusWeatherCurrentTempHigh + "</text><text hint-style=\"captionSubtle\" hint-align=\"right\">" + BgStatusWeatherCurrentTempLow + "</text></subgroup> <subgroup hint-weight=\"2\">" + WeatherTextDetailed + WeatherTextUpdate + "</subgroup></group>";
                    }
                    else
                    {
                        GroupWeatherTemps = "<group><subgroup hint-textStacking=\"center\" hint-weight=\"15\"><image src=\"ms-appx:///Assets/Weather" + WeatherIconStyle + "/" + WeatherIconCurrent + ".png\" hint-removeMargin=\"true\"/></subgroup> <subgroup hint-textStacking=\"center\" hint-weight=\"45\"><text hint-style=\"titleNumeral\" hint-align=\"left\">" + BgStatusWeatherCurrentTemp + "</text></subgroup> <subgroup hint-weight=\"40\">" + WeatherTextDetailed + WeatherTextUpdate + "</subgroup></group>";
                    }

                    GroupWeatherPrecip = "<group><subgroup hint-weight=\"7\" hint-textStacking=\"center\"><image src=\"ms-appx:///Assets/WeatherOther/tab_Precipitation.png\" hint-removeMargin=\"true\"/></subgroup><subgroup hint-textStacking=\"center\"><text hint-style=\"caption\" hint-align=\"left\">" + BgStatusWeatherCurrentRainChance + "</text></subgroup></group>";
                    GroupWeatherWind   = "<group><subgroup hint-weight=\"7\" hint-textStacking=\"center\"><image src=\"ms-appx:///Assets/WeatherOther/tab_WindSpeed.png\" hint-removeMargin=\"true\"/></subgroup><subgroup hint-textStacking=\"center\"><text hint-style=\"caption\" hint-align=\"left\">" + BgStatusWeatherCurrentWindSpeed + "</text></subgroup></group>";

                    string WeatherWideTile = "<binding template=\"TileWide\">" + TileWeather_BackgroundPhotoXml + GroupWeatherTemps + GroupWeatherText + GroupWeatherWind + GroupWeatherPrecip + "</binding>";

                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\">" + WeatherSmallTile + WeatherMediumTile + WeatherWideTile + "</visual></tile>");
                    Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
                }

                //Render forecast weather tile
                else if (setWeatherTileSizeName == "WeatherForecast")
                {
                    //Set Medium Tile Texts
                    string WeatherMediumTile = "";
                    if (setShowMoreTiles)
                    {
                        WeatherMediumTile = "<binding template=\"TileMedium\" hint-textStacking=\"center\">" + TileWeather_BackgroundPhotoXml + "<group>" + WeatherTile1 + WeatherTile2 + WeatherTile3 + "</group><group><subgroup><text hint-style=\"captionSubtle\">" + WeatherLastUpdate + "</text><text hint-style=\"caption\">" + WeatherDetailed + "</text></subgroup></group></binding>";
                    }
                    else
                    {
                        WeatherMediumTile = "<binding template=\"TileMedium\" hint-textStacking=\"center\">" + TileWeather_BackgroundPhotoXml + "<group>" + WeatherTile1 + WeatherTile2 + WeatherTile3 + "</group><group><subgroup><text hint-align=\"left\" hint-style=\"caption\">" + WeatherDetailed + "</text></subgroup><subgroup><text hint-align=\"right\" hint-style=\"captionSubtle\">" + WeatherLastUpdate + "</text></subgroup></group></binding>";
                    }

                    //Set Wide Tile Texts
                    string WeatherWideTile = "<binding template=\"TileWide\" hint-textStacking=\"center\">" + TileWeather_BackgroundPhotoXml + "<group>" + WeatherTile1 + WeatherTile2 + WeatherTile3 + WeatherTile4 + WeatherTile5 + "</group><group><subgroup><text hint-align=\"left\" hint-style=\"caption\">" + WeatherDetailed + "</text></subgroup><subgroup><text hint-align=\"right\" hint-style=\"captionSubtle\">" + WeatherLastUpdate + "</text></subgroup></group></binding>";

                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\">" + WeatherMediumTile + WeatherWideTile + "</visual></tile>");
                    Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
                }

                //Render combo weather tile
                else if (setWeatherTileSizeName == "WeatherCombo")
                {
                    //Set Multi Variables
                    string GroupWeatherText     = "";
                    string GroupWeatherTemps    = "";
                    string GroupWeatherForecast = "";

                    //Set Small Tile Texts
                    string WeatherSmallTile = "<binding template=\"TileSmall\" hint-textStacking=\"center\">" + TileWeather_BackgroundPhotoXml + "<image src=\"ms-appx:///Assets/Weather" + WeatherIconStyle + "/" + WeatherIconCurrent + ".png\"/></binding>";

                    //Set Medium Tile Texts
                    GroupWeatherText  = "<group><subgroup hint-textStacking=\"center\"><text hint-style=\"caption\" hint-align=\"left\">" + BgStatusWeatherCurrentText + "</text></subgroup></group>";
                    GroupWeatherTemps = "<group><subgroup hint-textStacking=\"center\" hint-weight=\"1\"><image src=\"ms-appx:///Assets/Weather" + WeatherIconStyle + "/" + WeatherIconCurrent + ".png\" hint-removeMargin=\"true\"/></subgroup> <subgroup hint-textStacking=\"center\" hint-weight=\"2\"><text hint-style=\"titleNumeral\" hint-align=\"left\">" + BgStatusWeatherCurrentTemp + "</text></subgroup></group>";
                    if (setDisplayWeatherTileLocation || setDisplayWeatherTileProvider)
                    {
                        GroupWeatherForecast = "<group><subgroup hint-textStacking=\"center\"><text hint-style=\"captionSubtle\" hint-align=\"left\">" + WeatherDetailed + "</text><text hint-style=\"captionSubtle\" hint-align=\"left\">" + WeatherLastUpdate + "</text></subgroup></group>";
                    }
                    else
                    {
                        GroupWeatherForecast = "<group><subgroup hint-textStacking=\"center\"><text hint-style=\"captionSubtle\" hint-align=\"left\">" + WeatherLastUpdate + "</text></subgroup></group>";
                    }
                    string WeatherMediumTile = "<binding template=\"TileMedium\">" + TileWeather_BackgroundPhotoXml + GroupWeatherTemps + GroupWeatherText + GroupWeatherForecast + "</binding>";

                    //Set Wide Tile Texts
                    string WeatherTextDetailed = "";
                    string WeatherTextUpdate   = "";
                    if (setDisplayWeatherTileLocation || setDisplayWeatherTileProvider)
                    {
                        WeatherTextDetailed = "<text hint-align=\"right\">" + WeatherDetailed + "</text>";
                    }
                    if (setDisplayWeatherTileUpdateTime)
                    {
                        WeatherTextUpdate = "<text hint-style=\"captionSubtle\" hint-align=\"right\">" + WeatherLastUpdate + "</text>";
                    }
                    GroupWeatherText     = "<group><subgroup hint-textStacking=\"center\"><text hint-style=\"caption\" hint-align=\"left\">" + BgStatusWeatherCurrentText + "</text></subgroup> <subgroup hint-weight=\"25\"><text hint-style=\"caption\" hint-align=\"right\">" + BgStatusWeatherCurrentRainChance + " Rain</text></subgroup></group>";
                    GroupWeatherTemps    = "<group><subgroup hint-textStacking=\"center\" hint-weight=\"15\"><image src=\"ms-appx:///Assets/Weather" + WeatherIconStyle + "/" + WeatherIconCurrent + ".png\" hint-removeMargin=\"true\"/></subgroup> <subgroup hint-textStacking=\"center\" hint-weight=\"45\"><text hint-style=\"titleNumeral\" hint-align=\"left\">" + BgStatusWeatherCurrentTemp + "</text></subgroup> <subgroup hint-weight=\"40\">" + WeatherTextDetailed + WeatherTextUpdate + "</subgroup></group>";
                    GroupWeatherForecast = "<group>" + WeatherTile2 + WeatherTile3 + WeatherTile4 + "</group>";
                    string WeatherWideTile = "<binding template=\"TileWide\">" + TileWeather_BackgroundPhotoXml + GroupWeatherTemps + GroupWeatherText + GroupWeatherForecast + "</binding>";

                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\">" + WeatherSmallTile + WeatherMediumTile + WeatherWideTile + "</visual></tile>");
                    Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
                }

                //Render forecast words tile
                else if (setWeatherTileSizeName == "WeatherWords")
                {
                    //Set Medium Tile Texts
                    string WeatherMediumTile = "<binding template=\"TileMedium\">" + TileWeather_BackgroundPhotoXml + "<group><subgroup><text hint-align=\"left\" hint-wrap=\"true\" hint-style=\"caption\">" + WeatherTile1 + "</text></subgroup></group><group><subgroup><text hint-align=\"left\" hint-style=\"captionSubtle\">" + WeatherLastUpdate + "</text><text hint-align=\"left\" hint-style=\"caption\">" + WeatherDetailed + "</text></subgroup></group></binding>";

                    //Set Wide Tile Texts
                    string WeatherWideTile = "<binding template=\"TileWide\">" + TileWeather_BackgroundPhotoXml + "<group><subgroup><text hint-align=\"left\" hint-wrap=\"true\" hint-style=\"caption\">" + WeatherTile1 + "</text><text hint-align=\"left\" hint-wrap=\"true\" hint-style=\"captionSubtle\">" + WeatherTile2 + "</text></subgroup></group><group><subgroup><text hint-align=\"left\" hint-style=\"caption\">" + WeatherDetailed + "</text></subgroup><subgroup><text hint-align=\"right\" hint-style=\"captionSubtle\">" + WeatherLastUpdate + "</text></subgroup></group></binding>";

                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\">" + WeatherMediumTile + WeatherWideTile + "</visual></tile>");
                    Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
                }

                Debug.WriteLine("The weather tile has been updated.");
            }
            catch { }
        }
Exemple #14
0
        //Update the lockscreen information
        void UpdateLockscreen()
        {
            try
            {
                Debug.WriteLine("Updating the lock screen information.");

                //Set enter string if enabled
                if (setLockEnter)
                {
                    LockscreenEnter = "\n";
                }

                //Load lockscreen calendar
                if (setLockCalendar && !String.IsNullOrEmpty(CalendarAppoName))
                {
                    string CalendarInfoLock = "";
                    if (!String.IsNullOrEmpty(CalendarAppoSummary))
                    {
                        CalendarInfoLock = "\n" + CalendarAppoSummary;
                    }
                    if (!String.IsNullOrEmpty(CalendarAppoEstimated))
                    {
                        CalendarInfoLock = CalendarInfoLock + "\n" + CalendarAppoEstimated;
                    }
                    LockscreenText = CalendarAppoName + CalendarInfoLock + LockscreenEnter;
                }

                //Load lockscreen countdown
                if (setLockCountdown && !String.IsNullOrEmpty(CountdownEventDate))
                {
                    string CalenderCountInfo = CountdownEventName + " (" + CountdownEventDate + "d)";
                    if (String.IsNullOrEmpty(LockscreenText))
                    {
                        LockscreenText = CalenderCountInfo + LockscreenEnter;
                    }
                    else
                    {
                        LockscreenText = LockscreenText + "\n" + CalenderCountInfo + LockscreenEnter;
                    }
                }

                //Load lockscreen week number
                if (setLockWeekNumber)
                {
                    if (String.IsNullOrEmpty(LockscreenText))
                    {
                        LockscreenText = "Week number " + WeekNumberCurrent + LockscreenEnter;
                    }
                    else
                    {
                        LockscreenText = LockscreenText + "\nWeek number " + WeekNumberCurrent + LockscreenEnter;
                    }
                }

                //Load lockscreen Weather
                if (setBackgroundDownload && setDownloadWeather && setLockWeather)
                {
                    if (String.IsNullOrEmpty(LockscreenText))
                    {
                        if ((setLockWeatherDetailed || setLockLocation) && setLockEnter)
                        {
                            LockscreenText = BgStatusWeatherCurrent;
                        }
                        else
                        {
                            LockscreenText = BgStatusWeatherCurrent + LockscreenEnter;
                        }
                    }
                    else
                    {
                        if ((setLockWeatherDetailed || setLockLocation) && setLockEnter)
                        {
                            LockscreenText = LockscreenText + "\n" + BgStatusWeatherCurrent;
                        }
                        else
                        {
                            LockscreenText = LockscreenText + "\n" + BgStatusWeatherCurrent + LockscreenEnter;
                        }
                    }
                }

                //Load lockscreen Weather Detailed
                if (setBackgroundDownload && setDownloadWeather && setLockWeatherDetailed)
                {
                    string LockRainChance = BgStatusWeatherCurrentRainChance + " chance of rain";
                    string LockWindSpeed  = BgStatusWeatherCurrentWindSpeed + " windspeed";

                    if (String.IsNullOrEmpty(LockscreenText))
                    {
                        LockscreenText = LockRainChance + "\n" + LockWindSpeed + LockscreenEnter;
                    }
                    else
                    {
                        if (setLockLocation && setLockEnter)
                        {
                            LockscreenText = LockscreenText + "\n" + LockRainChance + "\n" + LockWindSpeed;
                        }
                        else
                        {
                            LockscreenText = LockscreenText + "\n" + LockRainChance + "\n" + LockWindSpeed + LockscreenEnter;
                        }
                    }
                }

                //Load lockscreen location
                if (setBackgroundDownload && setDownloadWeather && setLockLocation)
                {
                    string LockLocation = BgStatusWeatherCurrentLocation;
                    if (LockLocation.Length < 7)
                    {
                        LockLocation = "Near town " + LockLocation;
                    }
                    else if (LockLocation.Length < 15)
                    {
                        LockLocation = "Near " + LockLocation;
                    }

                    if (String.IsNullOrEmpty(LockscreenText))
                    {
                        LockscreenText = LockLocation + LockscreenEnter;
                    }
                    else
                    {
                        LockscreenText = LockscreenText + "\n" + LockLocation + LockscreenEnter;
                    }
                }

                //Load lockscreen alarm status
                if (setLockAlarm && TimerAlarmActive)
                {
                    if (String.IsNullOrEmpty(LockscreenText))
                    {
                        LockscreenText = "Timer alarm is on" + LockscreenEnter;
                    }
                    else
                    {
                        LockscreenText = LockscreenText + "\nTimer alarm is on" + LockscreenEnter;
                    }
                }

                //Load custom lockscreen text
                if (setLockscreenNoteText)
                {
                    if (String.IsNullOrEmpty(LockscreenText))
                    {
                        LockscreenText = setLockscreenNoteTextString + LockscreenEnter;
                    }
                    else
                    {
                        LockscreenText = LockscreenText + "\n" + setLockscreenNoteTextString + LockscreenEnter;
                    }
                }

                //Load lockscreen current network name
                if (setLockNetwork)
                {
                    if (String.IsNullOrEmpty(LockscreenText))
                    {
                        LockscreenText = "Network " + TextNetworkName + LockscreenEnter;
                    }
                    else
                    {
                        LockscreenText = LockscreenText + "\nNetwork " + TextNetworkName + LockscreenEnter;
                    }
                }

                //Load lockscreen detailed battery
                if (setLockBatteryDetailed && BatteryLevel != "error")
                {
                    string LockBattery = "";
                    if (BatteryCharging)
                    {
                        LockBattery = "Battery level is " + BatteryLevel + "%\nand is now charging";
                    }
                    else
                    {
                        LockBattery = "Battery level is " + BatteryLevel + "% and\n" + BatteryTime.ToLower() + "time remaining";
                    }

                    if (String.IsNullOrEmpty(LockscreenText))
                    {
                        LockscreenText = LockBattery + LockscreenEnter;
                    }
                    else
                    {
                        LockscreenText = LockscreenText + "\n" + LockBattery + LockscreenEnter;
                    }
                }

                //Update Lockscreen Information
                Tile_XmlContent.LoadXml("<tile><visual><binding template=\"TileWide\" hint-lockDetailedStatus1=\"" + WebUtility.HtmlEncode(LockscreenText) + "\"><image src=\"ms-appx:///Assets/WideLogo310150.scale-200.png\" placement=\"background\"/></binding></visual></tile>");
                TileUpdateManager.CreateTileUpdaterForApplication().Update(new TileNotification(Tile_XmlContent));

                //Update Battery Badge Information
                if (setLockBattery)
                {
                    Tile_XmlContent.LoadXml("<badge value=\"" + BatteryLevel + "\"/>");
                    BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(new BadgeNotification(Tile_XmlContent));
                }
                else
                {
                    Tile_XmlContent.LoadXml("<badge value=\"none\"/>");
                    BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(new BadgeNotification(Tile_XmlContent));
                }
            }
            catch
            {
                Debug.WriteLine("Failed to update the lock screen information");

                //Update Badge Information
                Tile_XmlContent.LoadXml("<badge value=\"error\"/>");
                BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(new BadgeNotification(Tile_XmlContent));

                //Update Lockscreen Information
                Tile_XmlContent.LoadXml("<tile><visual><binding template=\"TileWide\" hint-lockDetailedStatus1=\"Failed to update lock information\"><image src=\"ms-appx:///Assets/WideLogo310150.scale-200.png\" placement=\"background\"/></binding></visual></tile>");
                TileUpdateManager.CreateTileUpdaterForApplication().Update(new TileNotification(Tile_XmlContent));
            }
        }
Exemple #15
0
        //Render Battery tile front
        void RenderBatteryTile()
        {
            try
            {
                Debug.WriteLine("Started rendering the battery tile.");

                //Render icon battery tile
                if (setBatteryTileSizeName == "BatteryIcon")
                {
                    //Set Multi Variables
                    string TileImage = "<group><subgroup><image src=\"ms-appx:///Assets/BatterySquare/BatteryVer" + BatteryIcon + ".png\"/></subgroup></group>";

                    //Set Small Tile Texts
                    string BatterySmallTile = "<binding template=\"TileSmall\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + TileImage + "</binding>";

                    //Set Medium Tile Texts
                    string BatteryMediumTile = "<binding template=\"TileMedium\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + TileImage + "</binding>";

                    //Set Wide Tile Texts
                    string BatteryWideTile = "<binding template=\"TileWide\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + TileImage + "</binding>";

                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\">" + BatterySmallTile + BatteryMediumTile + BatteryWideTile + "</visual></tile>");
                    Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
                }
                //Render text battery tile
                else if (setBatteryTileSizeName == "BatteryText")
                {
                    //Set Multi Variables
                    string TileImageText = "<subgroup><image src=\"ms-appx:///Assets/Battery/BatteryVer" + BatteryIcon + ".png\"/></subgroup>";

                    //Set Small Tile Texts
                    string SmallTileFontSize = "subtitle";
                    if (BatteryLevel.Length > 2)
                    {
                        SmallTileFontSize = "base";
                    }
                    string BatterySmallTile = "<binding template=\"TileSmall\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + "<group><subgroup><text hint-style=\"" + SmallTileFontSize + "\" hint-align=\"center\">" + BatteryLevel + "%</text></subgroup></group></binding>";

                    //Set Medium Tile Texts
                    string BatteryMediumTile = "<binding template=\"TileMedium\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + "<group>" + TileImageText + "<subgroup hint-textStacking=\"center\"><text hint-style=\"base\" hint-align=\"left\">" + BatteryLevel + "%</text><text hint-style=\"baseSubtle\" hint-align=\"left\">Left</text></subgroup></group></binding>";

                    //Set Wide Tile Texts
                    string BatteryWideTile = "<binding template=\"TileWide\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + "<group>" + TileImageText + "<subgroup hint-textStacking=\"center\"><text hint-style=\"titleNumeral\" hint-align=\"left\">" + BatteryLevel + "%</text><text hint-style=\"titleNumeralSubtle\" hint-align=\"left\">Left</text></subgroup></group></binding>";

                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\">" + BatterySmallTile + BatteryMediumTile + BatteryWideTile + "</visual></tile>");
                    Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
                }
                //Render text left battery tile
                else if (setBatteryTileSizeName == "BatteryTextLeft")
                {
                    //Set Multi Variables
                    string TileImageText = "<subgroup><image src=\"ms-appx:///Assets/Battery/BatteryVer" + BatteryIcon + ".png\"/></subgroup>";

                    //Set Small Tile Texts
                    string SmallTileFontSize = "subtitle";
                    if (BatteryLevel.Length > 2)
                    {
                        SmallTileFontSize = "base";
                    }
                    string BatterySmallTile = "<binding template=\"TileSmall\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + "<group><subgroup><text hint-style=\"" + SmallTileFontSize + "\" hint-align=\"center\">" + BatteryLevel + "%</text></subgroup></group></binding>";

                    //Set Medium Tile Texts
                    string BatteryMediumTile = "<binding template=\"TileMedium\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + "<group><subgroup hint-textStacking=\"center\"><text hint-style=\"base\" hint-align=\"right\">" + BatteryLevel + "%</text><text hint-style=\"baseSubtle\" hint-align=\"right\">Left</text></subgroup>" + TileImageText + "</group></binding>";

                    //Set Wide Tile Texts
                    string BatteryWideTile = "<binding template=\"TileWide\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + "<group><subgroup hint-textStacking=\"center\"><text hint-style=\"titleNumeral\" hint-align=\"right\">" + BatteryLevel + "%</text><text hint-style=\"titleNumeralSubtle\" hint-align=\"right\">Left</text></subgroup>" + TileImageText + "</group></binding>";

                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\">" + BatterySmallTile + BatteryMediumTile + BatteryWideTile + "</visual></tile>");
                    Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
                }
                //Render text vert battery tile
                else if (setBatteryTileSizeName == "BatteryTextVert")
                {
                    //Set Multi Variables
                    string TileImage = "<group><subgroup><image src=\"ms-appx:///Assets/BatterySquare/BatteryHor" + BatteryIcon + ".png\"/></subgroup></group>";

                    //Set Small Tile Texts
                    string BatterySmallTile = "<binding template=\"TileSmall\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + TileImage + "</binding>";

                    //Set Medium Tile Texts
                    string TileImageText     = "<group><subgroup hint-weight=\"1\"/><subgroup><image src=\"ms-appx:///Assets/Battery/BatteryHor" + BatteryIcon + ".png\" hint-removeMargin=\"true\"/></subgroup><subgroup hint-weight=\"1\"/></group>";
                    string BatteryMediumTile = "<binding template=\"TileMedium\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + TileImageText + "<text hint-style=\"subtitle\" hint-align=\"center\">" + BatteryLevel + "%</text></binding>";

                    //Set Wide Tile Texts
                    TileImageText = "<group><subgroup hint-weight=\"1\"/><subgroup hint-weight=\"2\"><image src=\"ms-appx:///Assets/Battery/BatteryHor" + BatteryIcon + ".png\" hint-removeMargin=\"true\"/></subgroup><subgroup hint-weight=\"1\"/></group>";
                    string BatteryWideTile = "<binding template=\"TileWide\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + TileImageText + "<text hint-style=\"subtitle\" hint-align=\"center\">" + BatteryLevel + "%</text></binding>";

                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\">" + BatterySmallTile + BatteryMediumTile + BatteryWideTile + "</visual></tile>");
                    Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
                }
                //Render text vert top battery tile
                else if (setBatteryTileSizeName == "BatteryTextVertTop")
                {
                    //Set Multi Variables
                    string TileImage = "<group><subgroup><image src=\"ms-appx:///Assets/BatterySquare/BatteryHor" + BatteryIcon + ".png\"/></subgroup></group>";

                    //Set Small Tile Texts
                    string BatterySmallTile = "<binding template=\"TileSmall\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + TileImage + "</binding>";

                    //Set Medium Tile Texts
                    string TileImageText     = "<group><subgroup hint-weight=\"1\"/><subgroup><image src=\"ms-appx:///Assets/Battery/BatteryHor" + BatteryIcon + ".png\" hint-removeMargin=\"true\"/></subgroup><subgroup hint-weight=\"1\"/></group>";
                    string BatteryMediumTile = "<binding template=\"TileMedium\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + "<text hint-style=\"subtitle\" hint-align=\"center\">" + BatteryLevel + "%</text>" + TileImageText + "</binding>";

                    //Set Wide Tile Texts
                    TileImageText = "<group><subgroup hint-weight=\"1\"/><subgroup hint-weight=\"2\"><image src=\"ms-appx:///Assets/Battery/BatteryHor" + BatteryIcon + ".png\" hint-removeMargin=\"true\"/></subgroup><subgroup hint-weight=\"1\"/></group>";
                    string BatteryWideTile = "<binding template=\"TileWide\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + "<text hint-style=\"subtitle\" hint-align=\"center\">" + BatteryLevel + "%</text>" + TileImageText + "</binding>";

                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\">" + BatterySmallTile + BatteryMediumTile + BatteryWideTile + "</visual></tile>");
                    Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
                }
                //Render perc battery tile
                else if (setBatteryTileSizeName == "BatteryPerc")
                {
                    //Set Small Tile Texts
                    string SmallTileFontSize = "subtitle";
                    if (BatteryLevel.Length > 2)
                    {
                        SmallTileFontSize = "base";
                    }
                    string BatterySmallTile = "<binding template=\"TileSmall\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + "<group><subgroup><text hint-style=\"" + SmallTileFontSize + "\" hint-align=\"center\">" + BatteryLevel + "%</text></subgroup></group></binding>";

                    //Set Medium Tile Texts
                    string BatteryMediumTile = "<binding template=\"TileMedium\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + "<group><subgroup><text hint-style=\"title\" hint-align=\"center\">🗲 " + BatteryLevel + "%</text></subgroup></group></binding>";

                    //Set Wide Tile Texts
                    string BatteryWideTile = "<binding template=\"TileWide\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + "<group><subgroup><text hint-style=\"header\" hint-align=\"center\">🗲 " + BatteryLevel + "%</text></subgroup></group></binding>";

                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\">" + BatterySmallTile + BatteryMediumTile + BatteryWideTile + "</visual></tile>");
                    Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
                }
                //Render summ battery tile
                else if (setBatteryTileSizeName == "BatterySumm")
                {
                    //Set Multi Variables
                    string TileImageText = "<subgroup><image src=\"ms-appx:///Assets/Battery/BatteryVer" + BatteryIcon + ".png\"/></subgroup>";

                    //Set Small Tile Texts
                    string BatterySmallTile = "<binding template=\"TileSmall\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + "<group>" + TileImageText + "</group></binding>";

                    //Set Medium and Wide Tile Texts
                    string BatteryMediumTile = "";
                    string BatteryWideTile   = "";
                    if (BatteryCharging)
                    {
                        BatteryMediumTile = "<binding template=\"TileMedium\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + "<group>" + TileImageText + "<subgroup hint-textStacking=\"center\"><text hint-style=\"caption\" hint-align=\"left\">" + BatteryLevel + "%</text><text hint-style=\"captionSubtle\" hint-align=\"left\">Charg</text></subgroup></group></binding>";
                        BatteryWideTile   = "<binding template=\"TileWide\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + "<group>" + TileImageText + "<subgroup hint-textStacking=\"center\"><text hint-style=\"body\" hint-align=\"left\">" + BatteryLevel + " Percent</text><text hint-style=\"bodySubtle\" hint-align=\"left\">Charging</text></subgroup></group></binding>";
                    }
                    else
                    {
                        BatteryMediumTile = "<binding template=\"TileMedium\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + "<group>" + TileImageText + "<subgroup hint-textStacking=\"center\"><text hint-style=\"caption\" hint-align=\"left\">" + BatteryLevel + "%</text><text hint-style=\"caption\" hint-align=\"left\">" + BatteryTime + "</text><text hint-style=\"captionSubtle\" hint-align=\"left\">Remain</text></subgroup></group></binding>";
                        BatteryWideTile   = "<binding template=\"TileWide\" hint-textStacking=\"center\">" + TileBattery_BackgroundPhotoXml + "<group>" + TileImageText + "<subgroup hint-textStacking=\"center\"><text hint-style=\"body\" hint-align=\"left\">" + BatteryLevel + " Percent</text><text hint-style=\"body\" hint-align=\"left\">" + BatteryTime + "</text><text hint-style=\"bodySubtle\" hint-align=\"left\">Remaining</text></subgroup></group></binding>";
                    }

                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\">" + BatterySmallTile + BatteryMediumTile + BatteryWideTile + "</visual></tile>");
                    Tile_UpdateManager.Update(new TileNotification(Tile_XmlContent));
                }

                Debug.WriteLine("The battery tile has been updated.");
            }
            catch { }
        }
Exemple #16
0
        //Plan and render future live tiles
        async Task PlanLiveTiles()
        {
            try
            {
                //Show render start debug message
                if (setAppDebug)
                {
                    Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastText02\"><text id=\"1\">Renderstart: " + taskInstanceName + "</text><text id=\"2\">" + DateTimeNow.ToString() + "</text></binding></visual><audio silent=\"true\"/></toast>");
                    Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                    {
                        SuppressPopup = true, Tag = "T1", Group = "G3"
                    });
                }

                //Remove old planned live tiles
                Debug.WriteLine("Removing " + Tile_PlannedUpdates.Count + " older live task updates.");
                foreach (ScheduledTileNotification Tile_Update in Tile_PlannedUpdates)
                {
                    try { Tile_UpdateManager.RemoveFromSchedule(Tile_Update); } catch { }
                }

                //Render future live tile back
                if (TileLive_BackRender)
                {
                    Debug.WriteLine("Started rendering back live tile.");
                    await RenderLiveTileBack();
                }

                //Render future live tiles front
                Debug.WriteLine("Started rendering front live tiles.");
                TileTimeNow = DateTime.Now;
                TileTimeMin = TileTimeNow.AddSeconds(-TileTimeNow.Second).AddMinutes(-1);
                for (int LiveTileRenderId = 0; LiveTileRenderId < 18; LiveTileRenderId++)
                {
                    try
                    {
                        TileTimeNow    = DateTime.Now;
                        TileTimeMin    = TileTimeMin.AddMinutes(1);
                        TileContentId  = TileTimeMin.Minute.ToString();
                        TileRenderName = LiveTileRenderId.ToString();

                        if (TileTimeNow.Minute == TileTimeMin.Minute)
                        {
                            Tile_UpdateManager.Update(new TileNotification(await RenderLiveTile()));
                        }
                        else
                        {
                            Tile_UpdateManager.AddToSchedule(new ScheduledTileNotification(await RenderLiveTile(), new DateTimeOffset(TileTimeMin)));
                        }
                        if (TileLive_BackRender)
                        {
                            Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoSize.png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMeBack.png\"/></binding></visual></tile>");
                            if (TileTimeNow < TileTimeMin.AddSeconds(12))
                            {
                                Tile_UpdateManager.AddToSchedule(new ScheduledTileNotification(Tile_XmlContent, new DateTimeOffset(TileTimeMin.AddSeconds(12))));
                            }
                            if (TileTimeNow < TileTimeMin.AddSeconds(32))
                            {
                                Tile_UpdateManager.AddToSchedule(new ScheduledTileNotification(Tile_XmlContent, new DateTimeOffset(TileTimeMin.AddSeconds(32))));
                            }
                            if (TileTimeNow < TileTimeMin.AddSeconds(52))
                            {
                                Tile_UpdateManager.AddToSchedule(new ScheduledTileNotification(Tile_XmlContent, new DateTimeOffset(TileTimeMin.AddSeconds(52))));
                            }
                            Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoSize.png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMe" + TileRenderName + ".png\"/></binding></visual></tile>");
                            if (TileTimeNow < TileTimeMin.AddSeconds(20))
                            {
                                Tile_UpdateManager.AddToSchedule(new ScheduledTileNotification(Tile_XmlContent, new DateTimeOffset(TileTimeMin.AddSeconds(20))));
                            }
                            if (TileTimeNow < TileTimeMin.AddSeconds(40))
                            {
                                Tile_UpdateManager.AddToSchedule(new ScheduledTileNotification(Tile_XmlContent, new DateTimeOffset(TileTimeMin.AddSeconds(40))));
                            }
                        }

                        //Show live tile render debug message
                        if (setAppDebug)
                        {
                            Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastText02\"><text id=\"1\">Renderedtile: " + taskInstanceName + "</text><text id=\"2\">" + TileRenderName + "/17 at " + DateTimeNow.ToString() + " Mem " + (MemoryManager.AppMemoryUsage / 1024f / 1024f).ToString() + "</text></binding></visual><audio silent=\"true\"/></toast>");
                            Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                            {
                                SuppressPopup = true, Tag = "T2", Group = "G3"
                            });
                        }
                    }
                    catch { }
                }

                ////Add tile will be updated shortly on the end
                //Tile_DateTimeMin = Tile_DateTimeMin.AddMinutes(1);
                //Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoUpdate.png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/WideLogoUpdate.png\"/></binding></visual></tile>");
                //Tile_UpdateManager.AddToSchedule(new ScheduledTileNotification(Tile_XmlContent, new DateTimeOffset(Tile_DateTimeMin)));

                Debug.WriteLine("Finished rendering live tiles batch.");
            }
            catch { Debug.WriteLine("Failed rendering live tiles batch."); }
        }
Exemple #17
0
        //Render live tile front
        async Task <XmlDocument> RenderLiveTile()
        {
            try
            {
                //Render Medium live tile
                if (setLiveTileSizeName == "Medium")
                {
                    LoadTileDataTile();
                    if (setShowMoreTiles)
                    {
                        await ClockTileMediumMore();
                    }
                    else
                    {
                        await ClockTileMedium();
                    }
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMe" + TileRenderName + ".png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/WideLogoSize.png\"/></binding></visual></tile>");
                }

                //Render Medium One live tile
                else if (setLiveTileSizeName == "MediumOne")
                {
                    LoadTileDataTile();
                    if (setShowMoreTiles)
                    {
                        await ClockTileMediumOneMore();
                    }
                    else
                    {
                        await ClockTileMediumOne();
                    }
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMe" + TileRenderName + ".png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/WideLogoSize.png\"/></binding></visual></tile>");
                }

                //Render Medium Three live tile
                else if (setLiveTileSizeName == "MediumThree")
                {
                    LoadTileDataTile();
                    if (setShowMoreTiles)
                    {
                        await ClockTileMediumThreeMore();
                    }
                    else
                    {
                        await ClockTileMediumThree();
                    }
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMe" + TileRenderName + ".png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/WideLogoSize.png\"/></binding></visual></tile>");
                }

                //Render Medium Time Only live tile
                else if (setLiveTileSizeName == "MediumTimeOnly")
                {
                    LoadTileDataTile();
                    if (setShowMoreTiles)
                    {
                        await ClockTileMediumTimeOnlyMore();
                    }
                    else
                    {
                        await ClockTileMediumTimeOnly();
                    }
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMe" + TileRenderName + ".png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/WideLogoSize.png\"/></binding></visual></tile>");
                }

                //Render Medium Analog Minimal live tile (Light)
                else if (setLiveTileSizeName == "MediumAnalogMinimal")
                {
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSmall\">" + TileLight_BackgroundPhotoXml + "<image src=\"ms-appx:///Assets/Analog/Minimal/" + TileTimeMin.ToString("hmm") + ".png\"/></binding><binding template=\"TileMedium\">" + TileLight_BackgroundPhotoXml + "<image src=\"ms-appx:///Assets/Analog/Minimal/" + TileTimeMin.ToString("hmm") + ".png\"/></binding><binding template=\"TileWide\">" + TileLight_BackgroundPhotoXml + "<image src=\"ms-appx:///Assets/Analog/Minimal/" + TileTimeMin.ToString("hmm") + ".png\"/></binding></visual></tile>");
                }

                //Render Medium Analog Round live tile (Light)
                else if (setLiveTileSizeName == "MediumAnalogRound")
                {
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSmall\">" + TileLight_BackgroundPhotoXml + "<image src=\"ms-appx:///Assets/Analog/Round/" + TileTimeMin.ToString("hmm") + ".png\"/></binding><binding template=\"TileMedium\">" + TileLight_BackgroundPhotoXml + "<image src=\"ms-appx:///Assets/Analog/Round/" + TileTimeMin.ToString("hmm") + ".png\"/></binding><binding template=\"TileWide\">" + TileLight_BackgroundPhotoXml + "<image src=\"ms-appx:///Assets/Analog/Round/" + TileTimeMin.ToString("hmm") + ".png\"/></binding></visual></tile>");
                }

                //Render Medium Analog Cortana live tile (Light)
                else if (setLiveTileSizeName == "MediumAnalogCortana")
                {
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSmall\">" + TileLight_BackgroundPhotoXml + "<image src=\"ms-appx:///Assets/Analog/Cortana/" + TileTimeMin.ToString("hmm") + ".png\"/></binding><binding template=\"TileMedium\">" + TileLight_BackgroundPhotoXml + "<image src=\"ms-appx:///Assets/Analog/Cortana/" + TileTimeMin.ToString("hmm") + ".png\"/></binding><binding template=\"TileWide\">" + TileLight_BackgroundPhotoXml + "<image src=\"ms-appx:///Assets/Analog/Cortana/" + TileTimeMin.ToString("hmm") + ".png\"/></binding></visual></tile>");
                }

                //Render Medium live tile icon (Light)
                else if (setLiveTileSizeName == "MediumIcon")
                {
                    LoadTileDataTile();
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileMedium\">" + TileLight_BackgroundPhotoXml + "<image src=\"" + TileLight_TileIcon + "\" placement=\"peek\"/><group><subgroup hint-textStacking=\"center\"><text hint-style=\"base\">" + WebUtility.HtmlEncode(TextTimeFull) + " " + TextTimeAmPm + "</text><text hint-style=\"captionSubtle\">" + WebUtility.HtmlEncode(DisplayPosition1Text) + "</text><text hint-style=\"captionSubtle\">" + WebUtility.HtmlEncode(DisplayPosition2Text) + "</text><text hint-style=\"captionSubtle\">" + TextAlarmClock + WebUtility.HtmlEncode(DisplayPosition3Text) + "</text></subgroup></group></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/WideLogoSize.png\"/></binding></visual></tile>");
                }

                //Render Medium live tile text (Light)
                else if (setLiveTileSizeName == "MediumText")
                {
                    LoadTileDataTile();
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileMedium\">" + TileLight_BackgroundPhotoXml + "<group><subgroup hint-textStacking=\"center\"><text hint-style=\"base\">" + WebUtility.HtmlEncode(TextTimeFull) + " " + TextTimeAmPm + "</text><text hint-style=\"captionSubtle\">" + WebUtility.HtmlEncode(DisplayPosition1Text) + "</text><text hint-style=\"captionSubtle\">" + WebUtility.HtmlEncode(DisplayPosition2Text) + "</text><text hint-style=\"captionSubtle\">" + TextAlarmClock + WebUtility.HtmlEncode(DisplayPosition3Text) + "</text></subgroup></group></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/WideLogoSize.png\"/></binding></visual></tile>");
                }

                //Render Medium Round Image live tile (Light)
                else if (setLiveTileSizeName == "MediumRoundImage")
                {
                    LoadTileDataTile();
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSmall\"><image src=\"" + TileLight_BackgroundPhotoXml + "\" hint-crop=\"circle\"/></binding><binding template=\"TileMedium\"><group><subgroup hint-weight=\"10\"/><subgroup hint-weight=\"65\"><image src=\"" + TileLight_BackgroundPhotoXml + "\" hint-crop=\"circle\"/></subgroup><subgroup hint-weight=\"10\"/></group><text hint-style=\"title\" hint-align=\"center\">" + WebUtility.HtmlEncode(TextTimeFull) + " " + TextTimeAmPm + TextAlarmClock + "</text></binding><binding template=\"TileWide\"><group><subgroup hint-weight=\"1\"/><subgroup hint-weight=\"1\"><image src=\"" + TileLight_BackgroundPhotoXml + "\" hint-crop=\"circle\"/></subgroup><subgroup hint-weight=\"1\"/></group><text hint-style=\"base\" hint-align=\"center\">" + WebUtility.HtmlEncode(TextTimeFull) + " " + TextTimeAmPm + TextAlarmClock + "</text></binding></visual></tile>");
                }

                //Render Wide live tile icon (Light)
                else if (setLiveTileSizeName == "WideIcon")
                {
                    LoadTileDataTile();
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoSize.png\"/></binding><binding template=\"TileWide\">" + TileLight_BackgroundPhotoXml + "<group><subgroup hint-weight=\"30\"><image src=\"" + TileLight_TileIcon + "\"/></subgroup><subgroup hint-textStacking=\"center\"><text hint-style=\"base\">" + WebUtility.HtmlEncode(TextTimeFull) + " " + TextTimeAmPm + "</text><text hint-style=\"captionSubtle\">" + WebUtility.HtmlEncode(DisplayPosition1Text) + "</text><text hint-style=\"captionSubtle\">" + WebUtility.HtmlEncode(DisplayPosition2Text) + "</text><text hint-style=\"captionSubtle\">" + TextAlarmClock + WebUtility.HtmlEncode(DisplayPosition3Text) + "</text></subgroup></group></binding></visual></tile>");
                }

                //Render Wide live tile text
                else if (setLiveTileSizeName == "WideText")
                {
                    LoadTileDataTile();
                    if (setShowMoreTiles)
                    {
                        await ClockTileWideTextMore();
                    }
                    else
                    {
                        await ClockTileWideText();
                    }
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoSize.png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMe" + TileRenderName + ".png\"/></binding></visual></tile>");
                }

                //Render Wide live tile lite
                else if (setLiveTileSizeName == "WideLite")
                {
                    LoadTileDataTile();
                    if (setShowMoreTiles)
                    {
                        await ClockTileWideLiteMore();
                    }
                    else
                    {
                        await ClockTileWideLite();
                    }
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoSize.png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMe" + TileRenderName + ".png\"/></binding></visual></tile>");
                }

                //Render Wide live tile lefty
                else if (setLiveTileSizeName == "WideLefty")
                {
                    LoadTileDataTile();
                    if (setShowMoreTiles)
                    {
                        await ClockTileWideLeftyMore();
                    }
                    else
                    {
                        await ClockTileWideLefty();
                    }
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoSize.png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMe" + TileRenderName + ".png\"/></binding></visual></tile>");
                }

                //Render Wide live tile photo
                else if (setLiveTileSizeName == "WidePhoto")
                {
                    LoadTileDataTile();
                    if (setShowMoreTiles)
                    {
                        await ClockTileWidePhotoMore();
                    }
                    else
                    {
                        await ClockTileWidePhoto();
                    }
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoSize.png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMe" + TileRenderName + ".png\"/></binding></visual></tile>");
                }

                //Render Wide live tile date
                else if (setLiveTileSizeName == "WideDate")
                {
                    LoadTileDataTile();
                    if (setShowMoreTiles)
                    {
                        await ClockTileWideDateMore();
                    }
                    else
                    {
                        await ClockTileWideDate();
                    }
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoSize.png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMe" + TileRenderName + ".png\"/></binding></visual></tile>");
                }

                //Render Wide live tile Big
                else if (setLiveTileSizeName == "WideBig")
                {
                    LoadTileDataTile();
                    if (setShowMoreTiles)
                    {
                        await ClockTileWideBigMore();
                    }
                    else
                    {
                        await ClockTileWideBig();
                    }
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoSize.png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMe" + TileRenderName + ".png\"/></binding></visual></tile>");
                }

                //Render Wide live tile multi / one
                else if (setLiveTileSizeName == "WideMulti" || setLiveTileSizeName == "WideOne")
                {
                    LoadTileDataTile();
                    if (setShowMoreTiles)
                    {
                        await ClockTileWideMultiMore();
                    }
                    else
                    {
                        await ClockTileWideMulti();
                    }
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoSize.png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMe" + TileRenderName + ".png\"/></binding></visual></tile>");
                }

                //Render Wide live tile two
                else if (setLiveTileSizeName == "WideTwo")
                {
                    LoadTileDataTile();
                    if (setShowMoreTiles)
                    {
                        await ClockTileWideTwoMore();
                    }
                    else
                    {
                        await ClockTileWideTwo();
                    }
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoSize.png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMe" + TileRenderName + ".png\"/></binding></visual></tile>");
                }

                //Render Wide live tile time only
                else if (setLiveTileSizeName == "WideTimeOnly")
                {
                    LoadTileDataTile();
                    if (setShowMoreTiles)
                    {
                        await ClockTileWideTimeOnlyMore();
                    }
                    else
                    {
                        await ClockTileWideTimeOnly();
                    }
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoSize.png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMe" + TileRenderName + ".png\"/></binding></visual></tile>");
                }

                //Render Wide live tile numm
                else if (setLiveTileSizeName == "WideNumm")
                {
                    LoadTileDataTile();
                    if (setShowMoreTiles)
                    {
                        await ClockTileWideNummMore();
                    }
                    else
                    {
                        await ClockTileWideNumm();
                    }
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoSize.png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMe" + TileRenderName + ".png\"/></binding></visual></tile>");
                }

                //Render Wide live tile words
                else if (setLiveTileSizeName == "WideWords")
                {
                    LoadTileDataTile();
                    if (setShowMoreTiles)
                    {
                        await ClockTileWideWordsMore();
                    }
                    else
                    {
                        await ClockTileWideWords();
                    }
                    Tile_XmlContent.LoadXml("<tile><visual contentId=\"" + TileContentId + "\" branding=\"none\"><binding template=\"TileSquareImage\"><image id=\"1\" src=\"ms-appx:///Assets/Tiles/SquareLogoSize.png\"/></binding><binding template=\"TileWideImage\"><image id=\"1\" src=\"ms-appdata:///local/TimeMe" + TileRenderName + ".png\"/></binding></visual></tile>");
                }

                return(Tile_XmlContent);
            }
            catch { return(RenderTileLiveFailed("TimeMeLiveTile")); }
        }
Exemple #18
0
        //Run Task Agent Update
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            try
            {
                //Set current background task info
                taskInstanceDeferral   = taskInstance.GetDeferral();
                taskInstance.Canceled += delegate { DisposeVariables(); taskInstance.Progress = 100; taskInstanceDeferral.Complete(); return; };
                taskInstanceName       = taskInstance.Task.Name;

                //Load tile and application settings
                taskInstance.Progress = 90;
                if (!LoadAppSettings())
                {
                    if (TileLive_Pinned)
                    {
                        RenderTileAppUpdated("TimeMeLiveTile");
                    }
                    if (TileWeather_Pinned)
                    {
                        RenderTileAppUpdated("TimeMeWeatherTile");
                    }
                    if (TileBattery_Pinned)
                    {
                        RenderTileAppUpdated("TimeMeBatteryTile");
                    }
                    DisposeVariables();
                    taskInstance.Progress = 100;
                    taskInstanceDeferral.Complete();
                    return;
                }

                //Show task start debug message
                if (setAppDebug)
                {
                    Tile_XmlContent.LoadXml("<toast><visual><binding template=\"ToastText02\"><text id=\"1\">Taskstart: " + taskInstanceName + "</text><text id=\"2\">" + DateTimeNow.ToString() + "</text></binding></visual><audio silent=\"true\"/></toast>");
                    Toast_UpdateManager.Show(new ToastNotification(Tile_XmlContent)
                    {
                        SuppressPopup = true, Tag = "T3", Group = "G3"
                    });
                }

                //Load other used data first
                if (!await LoadOtherDataFirst())
                {
                    if (TileLive_Pinned)
                    {
                        RenderTileLiveFailed("TimeMeLiveTile");
                    }
                    if (TileWeather_Pinned)
                    {
                        RenderTileLiveFailed("TimeMeWeatherTile");
                    }
                    if (TileBattery_Pinned)
                    {
                        RenderTileLiveFailed("TimeMeBatteryTile");
                    }
                    DisposeVariables();
                    taskInstance.Progress = 100;
                    taskInstanceDeferral.Complete();
                    return;
                }

                //Download the background updates
                taskInstance.Progress = 10;
                await DownloadBackground();

                //Update the lockscreen information
                taskInstance.Progress = 20;
                UpdateLockscreen();

                //Check if weather tile is pinned
                if (TileWeather_Pinned)
                {
                    taskInstance.Progress = 40;
                    Tile_UpdateManager    = TileUpdateManager.CreateTileUpdaterForSecondaryTile("TimeMeWeatherTile");
                    Tile_UpdateManager.EnableNotificationQueue(false);
                    Tile_PlannedUpdates = Tile_UpdateManager.GetScheduledTileNotifications();
                    if (await LoadTileDataWeather())
                    {
                        RenderWeatherTile();
                    }
                    else
                    {
                        RenderTileWeatherDisabled();
                    }
                }

                //Check if battery tile is pinned
                if (TileBattery_Pinned)
                {
                    taskInstance.Progress = 50;
                    Tile_UpdateManager    = TileUpdateManager.CreateTileUpdaterForSecondaryTile("TimeMeBatteryTile");
                    Tile_UpdateManager.EnableNotificationQueue(false);
                    Tile_PlannedUpdates = Tile_UpdateManager.GetScheduledTileNotifications();
                    if (await LoadTileDataBattery())
                    {
                        RenderBatteryTile();
                    }
                    else
                    {
                        RenderTileBatteryDisabled();
                    }
                }

                //Check if live tile is pinned
                if (TileLive_Pinned)
                {
                    taskInstance.Progress = 30;
                    Tile_UpdateManager    = TileUpdateManager.CreateTileUpdaterForSecondaryTile("TimeMeLiveTile");
                    Tile_UpdateManager.EnableNotificationQueue(false);
                    Tile_PlannedUpdates = Tile_UpdateManager.GetScheduledTileNotifications();

                    //Delay timer task to avoid collision
                    //if (TaskInstanceName.StartsWith("TimeMeTaskTimer")) { await Task.Delay(1000); }

                    //Check if there is a live tile update needed
                    if (!FreshDeviceBoot && !TileLive_ForceUpdate && taskInstanceName != "TimeMeTaskTimeZone" && BgStatusLastRunDate != "Never" && Tile_PlannedUpdates.Any())
                    {
                        //Check if the live tile has failed to update
                        if (Tile_PlannedUpdates.Last().DeliveryTime.Subtract(DateTime.Parse(BgStatusLastRunDate, vCultureInfoEng)).TotalMilliseconds <= 960000)
                        {
                            Debug.WriteLine("Live tile has failed to render succesfully.");
                        }
                        else
                        {
                            if (taskInstanceName == "TimeMeTaskUser")
                            {
                                Debug.WriteLine("There is no user live tile update needed."); TileLive_NeedUpdate = false;
                            }
                            else if (taskInstanceName == "TimeMeTaskTimer" && Tile_PlannedUpdates.Last().DeliveryTime.Subtract(DateTimeNow).TotalMilliseconds >= 960000)
                            {
                                Debug.WriteLine("There is no timer live tile update needed."); TileLive_NeedUpdate = false;
                            }
                        }
                    }

                    //Update the live tile if needed
                    if (TileLive_NeedUpdate)
                    {
                        //Load first one time live tile data
                        if (await LoadTileDataFirst())
                        {
                            //Plan and render future live tiles
                            await PlanLiveTiles();
                        }
                        else
                        {
                            RenderTileLiveFailed("TimeMeLiveTile");
                        }
                    }
                }
            }
            catch { }
            DisposeVariables();
            taskInstance.Progress = 100;
            taskInstanceDeferral.Complete();
            return;
        }