Beispiel #1
0
        void StartTilePolling_Click(object sender, RoutedEventArgs e)
        {
            List <Uri> urisToPoll = new List <Uri>(5);

            foreach (TextBox input in new TextBox[] { PollURL1, PollURL2, PollURL3, PollURL4, PollURL5 })
            {
                String polledUrl = input.Text;

                // The default string for this text box is "http://".
                // Make sure the user has entered some data.
                if (polledUrl != "http://" && polledUrl != "")
                {
                    urisToPoll.Add(new Uri(polledUrl));
                }
            }

            PeriodicUpdateRecurrence recurrence = (PeriodicUpdateRecurrence)PeriodicRecurrence.SelectedIndex;

            if (urisToPoll.Count == 1)
            {
                TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(urisToPoll[0], recurrence);
                rootPage.NotifyUser("Started polling " + urisToPoll[0].AbsolutePath + ". Look at the application’s tile on the Start menu to see the latest update.", NotifyType.StatusMessage);
            }
            else if (urisToPoll.Count > 1)
            {
                TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdateBatch(urisToPoll, recurrence);
                rootPage.NotifyUser("Started polling the specified URLs. Look at the application’s tile on the Start menu to see the latest update.", NotifyType.StatusMessage);
            }
            else
            {
                rootPage.NotifyUser("Specify a URL that returns tile XML to begin tile polling.", NotifyType.ErrorMessage);
            }
        }
Beispiel #2
0
        public static void changeTilePolling(PeriodicUpdateRecurrence t)
        {
            Uri polledUri = new Uri(ReturnUrlPolling());
            PeriodicUpdateRecurrence recurrence = t;

            TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(polledUri, recurrence);

            switch (t)
            {
            case PeriodicUpdateRecurrence.HalfHour: localSettings.Values["UPDATE_TIME"] = 0;
                break;

            case PeriodicUpdateRecurrence.Hour: localSettings.Values["UPDATE_TIME"] = 1;
                break;

            case PeriodicUpdateRecurrence.SixHours: localSettings.Values["UPDATE_TIME"] = 2;
                break;

            case PeriodicUpdateRecurrence.TwelveHours: localSettings.Values["UPDATE_TIME"] = 3;
                break;

            case PeriodicUpdateRecurrence.Daily: localSettings.Values["UPDATE_TIME"] = 4;
                break;
            }
            localSettings.Values["UPDATE_START"] = true;
        }
Beispiel #3
0
        public static void changeTilePolling(int i)
        {
            Uri polledUri = new Uri(ReturnUrlPolling());

            PeriodicUpdateRecurrence t;

            switch (i)
            {
            case 0: t = PeriodicUpdateRecurrence.HalfHour;
                break;

            case 1: t = PeriodicUpdateRecurrence.Hour;
                break;

            case 2: t = PeriodicUpdateRecurrence.SixHours;
                break;

            case 3: t = PeriodicUpdateRecurrence.TwelveHours;
                break;

            case 4: t = PeriodicUpdateRecurrence.Daily;
                break;

            default: t = PeriodicUpdateRecurrence.Daily;
                break;
            }

            PeriodicUpdateRecurrence recurrence = t;

            TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(polledUri, recurrence);

            localSettings.Values["UPDATE_START"] = true;
        }
Beispiel #4
0
        public static void initiateTilePolling()
        {
            // update the tile poll URI
            Uri polledUri = new Uri(ReturnUrlPolling());
            PeriodicUpdateRecurrence recurrence = PeriodicUpdateRecurrence.TwelveHours;

            TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(polledUri, recurrence);


            localSettings.Values["UPDATE_TIME"]  = 3;
            localSettings.Values["UPDATE_START"] = true;
        }
Beispiel #5
0
        void InitTileScheduler()
        {
            TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);

            PeriodicUpdateRecurrence recurrence = PeriodicUpdateRecurrence.HalfHour;

            TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdateBatch(new [] {
                new Uri("http://7xpj2g.com1.z0.glb.clouddn.com/Tile1.xml"),
                new Uri("http://7xpj2g.com1.z0.glb.clouddn.com/Tile2.xml"),
                new Uri("http://7xpj2g.com1.z0.glb.clouddn.com/Tile3.xml"),
                new Uri("http://7xpj2g.com1.z0.glb.clouddn.com/Tile4.xml"),
                new Uri("http://7xpj2g.com1.z0.glb.clouddn.com/Tile5.xml"),
            }, recurrence);
        }
        /// <summary>
        /// アプリケーションがエンド ユーザーによって正常に起動されたときに呼び出されます。他のエントリ ポイントは、
        /// アプリケーションが特定のファイルを開くために呼び出されたときに
        /// 検索結果やその他の情報を表示するために使用されます。
        /// </summary>
        /// <param name="args">起動要求とプロセスの詳細を表示します。</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // ウィンドウに既にコンテンツが表示されている場合は、アプリケーションの初期化を繰り返さずに、
            // ウィンドウがアクティブであることだけを確認してください
            if (rootFrame == null)
            {
                // ナビゲーション コンテキストとして動作するフレームを作成し、最初のページに移動します
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: 以前中断したアプリケーションから状態を読み込みます。
                }

                // フレームを現在のウィンドウに配置します
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // ナビゲーション スタックが復元されていない場合、最初のページに移動します。
                // このとき、必要な情報をナビゲーション パラメーターとして渡して、新しいページを
                // 構成します
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // 現在のウィンドウがアクティブであることを確認します
            Window.Current.Activate();

            #region タイル更新

            // タイル更新の設定
            PeriodicUpdateRecurrence recurrence = PeriodicUpdateRecurrence.HalfHour;
            TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);

            TileUpdateManager.CreateTileUpdaterForApplication().Clear();

            // ローカルにある画像ファイルをタイル更新に利用します。
            //TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(new Uri("http://coelacanth.heteml.jp/win8/tilesample/titleUpdateLocalImage.html"), recurrence);

            // サーバーにある画像ファイルをタイル更新に利用します。
            TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(new Uri("http://coelacanth.heteml.jp/win8/tilesample/titleUpdateRemoteImage.html"), recurrence);

            #endregion
        }
Beispiel #7
0
        // Tile
        public void showTile()
        {
            XmlDocument smallTileData  = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquare150x150PeekImageAndText02);
            XmlNodeList smallTextData  = smallTileData.GetElementsByTagName("text");
            XmlNodeList smallImageData = smallTileData.GetElementsByTagName("image");

            smallTextData[0].InnerText = postsList.ElementAt(0).brief;
            smallTextData[1].InnerText = postsList.ElementAt(0).date;
            ((XmlElement)smallImageData[0]).SetAttribute("src", "ms-appx:///" + postsList.ElementAt(0).imageUrl);
//            ((XmlElement)smallImageData[0]).SetAttribute("src", "ms-appx:///Assets/Logo.jpg");
            ((XmlElement)smallImageData[0]).SetAttribute("alt", "red graphic");

            //宽版
//            XmlDocument wideTileData = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWide310x150BlockAndText01);
//            XmlNodeList wideTextData = smallTileData.GetElementsByTagName("text");
//            XmlNodeList wideImageData = smallTileData.GetElementsByTagName("image");
//            wideTextData[0].InnerText = postsList.ElementAt(0).brief;
//            wideTextData[1].InnerText = postsList.ElementAt(0).date;
//            ((XmlElement)wideImageData[0]).SetAttribute("src", "ms-appx:///" + postsList.ElementAt(0).imageUrl);
////            ((XmlElement)wideImageData[0]).SetAttribute("src", "ms-appx:///Assets/Wide310x150Logo.scale-100.jpg");
//            ((XmlElement)wideImageData[0]).SetAttribute("alt", "red graphic");
//            IXmlNode newNode = wideTileData.ImportNode(smallTileData.GetElementsByTagName("binding").Item(0), true);

            // 计划通知
            Int16    dueTimeInSeconds = 3;
            DateTime dueTime          = DateTime.Now.AddSeconds(dueTimeInSeconds);
            ScheduledTileNotification scheduledTile = new ScheduledTileNotification(smallTileData, dueTime);

            scheduledTile.Id = "Future_Tile";
            //TileUpdateManager.CreateTileUpdaterForApplication().AddToSchedule(scheduledTile);


            TileNotification notification = new TileNotification(smallTileData);
            //TileNotification notification = new TileNotification(wideTileData);
            //notification.ExpirationTime = DateTimeOffset.UtcNow.AddSeconds(10);
            // TileUpdateManager.CreateTileUpdaterForApplication().Update(notification);
            //定期通知
            string polledUrl = "http://appdev.sysu.edu.cn/~mad/Tools/Test/sample.xml";
            PeriodicUpdateRecurrence recurrence = PeriodicUpdateRecurrence.HalfHour;

            System.Uri url = new System.Uri(polledUrl);

            // TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(url, recurrence);
        }
        void StartBadgePolling_Click(object sender, RoutedEventArgs e)
        {
            string polledUrl = BadgePollingURL.Text;

            // The default string for this text box is "http://".
            // Make sure the user has entered some data.
            if (Uri.IsWellFormedUriString(polledUrl, UriKind.Absolute))
            {
                PeriodicUpdateRecurrence recurrence = (PeriodicUpdateRecurrence)PeriodicRecurrence.SelectedIndex;

                // You can also specify a time you would like to start polling. Secondary tiles can also receive
                // polled updates using BadgeUpdateManager.createBadgeUpdaterForSecondaryTile(tileId).
                BadgeUpdateManager.CreateBadgeUpdaterForApplication().StartPeriodicUpdate(new Uri(polledUrl), recurrence);

                rootPage.NotifyUser("Started polling " + polledUrl + ". Look at the application’s tile on the Start menu to see the latest update.", NotifyType.StatusMessage);
            }
            else
            {
                rootPage.NotifyUser("Specify a URL that returns badge XML to begin badge polling.", NotifyType.ErrorMessage);
            }
        }
        static void StartTilePolling(List <Uri> Uris)
        {
            List <Uri> urisToPoll = new List <Uri>(5);

            foreach (Uri uri in Uris)
            {
                string polledUrl = uri.ToString();

                // The default string for this text box is "http://".
                // Make sure the user has entered some data.
                if (Uri.IsWellFormedUriString(polledUrl, UriKind.Absolute))
                {
                    urisToPoll.Add(new Uri(polledUrl));
                }
                else
                {
                    //rootPage.NotifyUser("Please enter a valid uri to poll.", NotifyType.ErrorMessage);
                }
            }

            PeriodicUpdateRecurrence recurrence = PeriodicUpdateRecurrence.Hour;

            if (urisToPoll.Count == 1)
            {
                TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(urisToPoll[0], recurrence);
                //rootPage.NotifyUser("Started polling " + urisToPoll[0].AbsolutePath + ". Look at the application’s tile on the Start menu to see the latest update.", NotifyType.StatusMessage);
            }
            else if (urisToPoll.Count > 1)
            {
                TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdateBatch(urisToPoll, recurrence);
                //rootPage.NotifyUser("Started polling the specified URLs. Look at the application’s tile on the Start menu to see the latest update.", NotifyType.StatusMessage);
            }
            else
            {
                //rootPage.NotifyUser("Specify a URL that returns tile XML to begin tile polling.", NotifyType.ErrorMessage);
            }
        }
 public void ActivateTileNotifications(string tileId, Uri tileContentUri, PeriodicUpdateRecurrence recurrence)
 {
     ActivateTileNotificationsDelegate(tileId, tileContentUri, recurrence);
 }
        public void ActivateTileNotifications(string tileId, Uri tileContentUri, PeriodicUpdateRecurrence recurrence)
        {
            var tileUpdater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(tileId);

            tileUpdater.StartPeriodicUpdate(tileContentUri, recurrence);
        }
 public void ActivateTileNotifications(string tileId, Uri tileContentUri, PeriodicUpdateRecurrence recurrence)
 {
     ActivateTileNotificationsDelegate(tileId, tileContentUri, recurrence);
 }
Beispiel #13
0
 public static void StartPeriodicUpdate(string url, PeriodicUpdateRecurrence periodicUpdateRecurrenceType,
     DateTime startTime)
 {
     TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(new Uri(url, UriKind.Absolute), startTime == null? DateTimeOffset.Now : new DateTimeOffset(startTime), (Windows.UI.Notifications.PeriodicUpdateRecurrence)periodicUpdateRecurrenceType);
 }
 public void ActivateTileNotifications(string tileId, Uri tileContentUri, PeriodicUpdateRecurrence recurrence) {
     var tileUpdater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(tileId);
     tileUpdater.StartPeriodicUpdate(tileContentUri, recurrence);
 }
Beispiel #15
0
 public static void StartPeriodicUpdate(string url, PeriodicUpdateRecurrence periodicUpdateRecurrenceType,
                                        DateTime startTime)
 {
     TileUpdateManager.CreateTileUpdaterForApplication().StartPeriodicUpdate(new Uri(url, UriKind.Absolute), startTime == null? DateTimeOffset.Now : new DateTimeOffset(startTime), (Windows.UI.Notifications.PeriodicUpdateRecurrence)periodicUpdateRecurrenceType);
 }
Beispiel #16
0
 public static void StartPeriodicUpdate(string url, PeriodicUpdateRecurrence periodicUpdateRecurrenceType,
     DateTime startTime)
 {
 }
Beispiel #17
0
 public static void StartPeriodicUpdate(string url, PeriodicUpdateRecurrence periodicUpdateRecurrenceType)
 {
 }