当前位置: 首页>>代码示例>>C#>>正文


C# StandardTileData类代码示例

本文整理汇总了C#中StandardTileData的典型用法代码示例。如果您正苦于以下问题:C# StandardTileData类的具体用法?C# StandardTileData怎么用?C# StandardTileData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StandardTileData类属于命名空间,在下文中一共展示了StandardTileData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {
            var tileToFind = ShellTile.ActiveTiles.FirstOrDefault();

            if(tileToFind != null)
            {
                var tileData = new StandardTileData
                                   {
                                       BackTitle = "Jeg lever!",
                                       BackBackgroundImage = new Uri(_pictureUrl, UriKind.Absolute)
                                   };

                tileToFind.Update(tileData);
            }

            /*

            var toast = new ShellToast
                            {
                                Title = "Toast!",
                                Content = "Backgrond agent says hello!",
                            };
            toast.Show();

            */

            NotifyComplete();
        }
开发者ID:estien,项目名称:WP7Data,代码行数:37,代码来源:ScheduledAgent.cs

示例2: Create

        public static void Create(Uri uri, StandardTileData data)
        {
            var bgImage = data.BackgroundImage;
            var backBgImage = data.BackBackgroundImage;

            bool found = false;
            if (bgImage != null && bgImage.IsAbsoluteUri)
            {
                data.BackgroundImage = null;
                found = true;
            }

            if (backBgImage != null && backBgImage.IsAbsoluteUri)
            {
                data.BackBackgroundImage = null;
                found = true;
            }

            ShellTile.Create(uri, data);

            //if no distant uri, do nothing
            if (!found)
                return;

            //find my tile
            ShellTile mytile = ShellTile.ActiveTiles.FirstOrDefault(currentTile => currentTile.NavigationUri == uri);
            if (mytile == null)
                return;

            //update the tile
            mytile.Update(new StandardTileData() { BackgroundImage = bgImage, BackBackgroundImage = backBgImage });
        }
开发者ID:karno,项目名称:NagoyaMetro,代码行数:32,代码来源:ShellTileExtension.cs

示例3: Update

        public static void Update()
        {
            try
            {
                // Application Tile is always the first Tile, even if it is not pinned to Start.
                ShellTile TileToFind = ShellTile.ActiveTiles.First();

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

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

                    TileToFind.Update(NewTileData);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }
        }
开发者ID:SalmanRafiq,项目名称:MetroCalendar,代码行数:34,代码来源:TileHelper.cs

示例4: Update

        public static void Update(AccountData[] accountData)
        {
            if (accountData == null)
            {
                return;
            }

            var netWorth = accountData.Sum(data => data.Balance);
            var balanceIssueCount = accountData.Count(data => data.AccountType == "bank" && data.Balance < 0);
            var loginIssueCount = accountData.Count(data => data.LoginStatus == AccountLoginStatus.Invalid);

            var tile = ShellTile.ActiveTiles.First();

            var tileData = new StandardTileData();

            tileData.Count = loginIssueCount + balanceIssueCount;
            tileData.BackTitle = "Net Worth";
            tileData.BackContent = String.Format("{0:c}", netWorth);
            if (balanceIssueCount > 0)
            {
                tileData.BackgroundImage = new Uri("/Assets/Tiles/TileMediumIconRed.png", UriKind.Relative);
                tileData.BackBackgroundImage = new Uri("/Assets/Tiles/TileMediumRed.png", UriKind.Relative);
            }
            else
            {
                tileData.BackgroundImage = new Uri("/Assets/Tiles/TileMediumIcon.png", UriKind.Relative);
                tileData.BackBackgroundImage = new Uri(String.Empty, UriKind.Relative);
            }

            tile.Update(tileData);
        }
开发者ID:shaftware,项目名称:Mojito,代码行数:31,代码来源:AppLiveTile.cs

示例5: PinTrip

        private void PinTrip()
        {
            ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("/Views/TripDetails.xaml?tripId=" + PathResultsModel.SelectedPathOption.TripId.ToString()));

            if (tile == null)
            {
                IEnumerable<Path> paths = UnitOfWork.PathRepository.GetAllCached(UnitOfWork.PublicTransportOperatorRepository.GetAll());

                Path pinnedPath = paths.Where(x => x.TripId == PathResultsModel.SelectedPathOption.TripId).FirstOrDefault();

                if (pinnedPath == null)
                    return;

                pinnedPath.IsPinned = true;
                UnitOfWork.PathRepository.Insert(pinnedPath);
                UnitOfWork.Save();

                var newTile = new StandardTileData()
                {
                    Title = string.Format(AppResources.TripDetailsLiveTileText, PathResultsModel.Destination.ShortAddressText),
                    BackgroundImage = new Uri("/Images/Tiles/TileTrip7.png", UriKind.Relative),
                    BackContent = string.Format(AppResources.TripDetailsLiveTileBackText, PathResultsModel.SelectedPathOption.StartTime.Value.ToString("HH:mm"), PathResultsModel.Location.ShortAddressText, PathResultsModel.Destination.ShortAddressText)
                     
                };

                ShellTile.Create(new Uri("/Views/TripDetails.xaml?tripId=" + PathResultsModel.SelectedPathOption.TripId.ToString(), UriKind.Relative), newTile);
            }
            else
            {
                ShowPopup(CustomPopupMessageType.Error, AppResources.TileAlreadyPinnedErrorText, AppResources.CustomPopupGenericOkGotItMessage, null);
            }
        }
开发者ID:CodeObsessed,项目名称:drumbleapp,代码行数:32,代码来源:TripDetailsViewModel.cs

示例6: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {

            //TODO: Add code to perform your task in background

            /// If application uses both PeriodicTask and ResourceIntensiveTask
            if (task is PeriodicTask)
            {
                // Execute periodic task actions here.
                ShellTile TileToFind = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("TileID=2"));
                if (TileToFind != null)
                {
                     StandardTileData NewTileData = new StandardTileData
                        {
                            Title= "updated by scheduled task",
                            Count = System.DateTime.Now.Minute
                        };
                     TileToFind.Update(NewTileData);
                }
            }
            else
            {
                // Execute resource-intensive task actions here.
            }

            NotifyComplete();
           
        }
开发者ID:fstn,项目名称:WindowsPhoneApps,代码行数:37,代码来源:TaskScheduler.cs

示例7: OnInvoke

        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        //protected override void OnInvoke(ScheduledTask task)
        //{
        //    //TODO: Add code to perform your task in background
        //    NotifyComplete();
        //}
        protected override void OnInvoke(ScheduledTask task)
        {
            // some random number
            Random random = new Random();
            // get application tile
            ShellTile tile = ShellTile.ActiveTiles.First();
            if (null != tile)
            {
                // creata a new data for tile
                StandardTileData data = new StandardTileData();
                // tile foreground data
                data.Title = "Title text here";
                data.BackgroundImage = new Uri("/Images/Blue.jpg", UriKind.Relative);
                data.Count = random.Next(99);
                // to make tile flip add data to background also
                data.BackTitle = "Secret text here";
                data.BackBackgroundImage = new Uri("/Images/Green.jpg", UriKind.Relative);
                data.BackContent = "Back Content Text here...";
                // update tile
                tile.Update(data);
            }
            #if DEBUG_AGENT
            ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(30));
            System.Diagnostics.Debug.WriteLine("Periodic task is started again: " + task.Name);
            #endif

            NotifyComplete();
        }
开发者ID:Nordic-T,项目名称:Nordic-T-WP,代码行数:42,代码来源:ScheduledAgent.cs

示例8: PodcastListDownloadStringCompleted

        void PodcastListDownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            int j = 0;
           
            if (IsolatedStorageSettings.ApplicationSettings.Contains("LastShowPostedOn"))
                LastShow = (DateTime)IsolatedStorageSettings.ApplicationSettings["LastShowPostedOn"];  

            try
            {
                var doc = XDocument.Parse(e.Result);
                var xChannel = doc.Descendants("channel").First();

                foreach (var item in xChannel.Descendants("item"))
                {                
                    if (RssHelper.ParseRssDate(RssHelper.getElementValue(item, "pubDate")) > LastShow)
                    {
                        j++;
                    }
                }
               
            }
            catch (Exception)
            {
                // do nothing just let the MinValue be returned
            }
            
            var tile = ShellTile.ActiveTiles.First();

            StandardTileData update = new StandardTileData();
            update.Count = j;
            update.BackBackgroundImage = new Uri("/Images/Background.png", UriKind.Relative);
            tile.Update(update);

            NotifyComplete();
        }
开发者ID:juhariis,项目名称:Windows-Phone-Starter-Kit-for-Podcasts,代码行数:35,代码来源:TaskScheduler.cs

示例9: SetNotifications

        public override void SetNotifications(IEnumerable<TileNotification> notifications)
        {
            if (!notifications.Any())
                return;

            StandardTileData mainTile = new StandardTileData();
            string content = "";

            if (notifications.Count() == 1)
            {
                var not = notifications.First();
                if (not.Type == TweetType.Mention)
                    content = String.Format(Resources.NewMention, not.From);
                else
                    content = String.Format(Resources.NewMessage, not.From);
            }
            else
            {
                if (notifications.Any(x => x.Type == TweetType.Mention) && notifications.Any(x => x.Type == TweetType.Message))
                    content = String.Format(Resources.NewXMentionsMessages, notifications.Count());
                else if (notifications.Any(x => x.Type == TweetType.Mention))
                    content = String.Format(Resources.NewXMentions, notifications.Count());
                else if (notifications.Any(x => x.Type == TweetType.Message))
                    content = String.Format(Resources.NewXMessages, notifications.Count());
            }

            mainTile.BackTitle = String.Format(Resources.ForX, GetChainOfNames(notifications.Select(x => x.To).Distinct().ToList()));
            mainTile.BackContent = content;

            mainTile.Count = notifications.Count();
            ShellTile.ActiveTiles.FirstOrDefault().Update(mainTile);
        }
开发者ID:rafaelwinter,项目名称:Ocell,代码行数:32,代码来源:WP7TileManager.cs

示例10: HandlePinClick

        private void HandlePinClick (object sender, EventArgs e)
        {
            var vm = (SpeakerDetailsViewModel)DataContext;

            var uri = "/SpeakerDetails.xaml?key=" + vm.Key;

            var imageUri = default (Uri);
            try {
                imageUri = SpeakerImage.SaveAsTile ("Speaker-" + vm.ID);
            }
            catch (Exception) {
            }            

            var foundTile = ShellTile.ActiveTiles.FirstOrDefault (x => x.NavigationUri.ToString ().Contains (uri));

            if (foundTile != null) {
                foundTile.Delete ();
            }

            var tile = new StandardTileData {
                Title = vm.Name,
                BackContent = string.Format ("{0} at {1}", vm.Title, vm.Company),
                BackTitle = vm.Name,
                BackgroundImage = (imageUri != null) ? imageUri : new Uri ("/Background.png", UriKind.RelativeOrAbsolute),
            };

            ShellTile.Create (new Uri (uri, UriKind.Relative), tile);
        }
开发者ID:Adameg,项目名称:mobile-samples,代码行数:28,代码来源:SpeakerDetails.xaml.cs

示例11: btnUpdate_Click

        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            ShellTile applicationTile = ShellTile.ActiveTiles.First();
            //ApplicationTile永远是所有已经激活了的磁贴中的第一个对象。

            //判断应用程序磁贴时候已经被pin到开始页面
            if (applicationTile != null)
            {
                int newCount=0;//消息数目,数目为0时,数字0将不会被显示到磁贴中去
                if (textBoxCount.Text != "")
                    newCount = int.Parse(textBoxCount.Text);

                //利用StandardTileData类型的数据来更新ApplicationTile
                //将用户输入的内容分别赋值给StandardTileData对象
                StandardTileData updateData = new StandardTileData
                {
                    Title=textBoxTitle.Text,
                    Count=newCount,
                    BackgroundImage=new Uri(textBoxBackgroundImage.Text,UriKind.RelativeOrAbsolute),
                    BackTitle=textBoxBackTitle.Text,
                    BackContent=textBoxBackContent.Text,
                    BackBackgroundImage=new Uri(textBoxBackBackgroundImage.Text,UriKind.RelativeOrAbsolute)
                };
                //调用磁贴对象的函数,传入StandardTileData的对象来更新应用程序磁贴
                applicationTile.Update(updateData);
                MessageBox.Show("已经更新ApplicationTile");
            }
        }
开发者ID:haozzzzzzzz,项目名称:WindowsPhoneApplicationTile,代码行数:28,代码来源:MainPage.xaml.cs

示例12: Pin

        public Task<bool> Pin(TileInfo tileInfo)
        {
            var result = false;
            if (IsPinned(tileInfo))
            {
                Unpin(tileInfo).Wait();
            }

            var tileData = new StandardTileData
            {
                Title = tileInfo.DisplayName,
                BackgroundImage = tileInfo.LogoUri,
                Count = tileInfo.Count,
                BackTitle = tileInfo.AppName,
                BackBackgroundImage = new Uri("", UriKind.Relative),
                BackContent = tileInfo.DisplayName
            };

            try
            {
                ShellTile.Create(new Uri(string.Format("/View/Shell.xaml?routeId={0}&routeName={1}", tileInfo.TileId, tileInfo.DisplayName), UriKind.Relative), tileData);
                result = true;
            }
            catch (Exception)
            {
                result = false;
            }

            return Task.FromResult<bool>(result);
        }
开发者ID:xepher,项目名称:uwp-wxbus,代码行数:30,代码来源:SecondaryPinner.cs

示例13: nzRSS_DSC

 void nzRSS_DSC(object sender, DownloadStringCompletedEventArgs e)
 {
     try
     {
         var rssData = (from rss in XElement.Parse(e.Result).Descendants("item")
                        select new PostMessage
                        {
                            title = rss.Element("title").Value
                        }).ToArray().Reverse();
         foreach (var item in rssData)
         {
             String nameData = item.title;
             var tile = ShellTile.ActiveTiles.First();
             var apptile = new StandardTileData();
             apptile.Title = "Здесь в...";
             apptile.BackgroundImage = new Uri("/TilePic.png", UriKind.RelativeOrAbsolute);
             apptile.BackContent = nameData;
             tile.Update(apptile);
         }
     }
     catch
     {
     }
     finally
     {
         NotifyComplete();
     }
 }
开发者ID:sunrizzi,项目名称:here,代码行数:28,代码来源:ScheduledAgent.cs

示例14: toggleSetting_Clicked

 private void toggleSetting_Clicked(object sender, RoutedEventArgs e)
 {
     StandardTileData tileData = new StandardTileData();
     tileData.BackContent = toggleSetting.IsChecked.ToString();
     tileData.Count = 10;
     ShellTile.ActiveTiles.First().Update(tileData);
 }
开发者ID:rahulpnath,项目名称:Speaking,代码行数:7,代码来源:SettingsPage.xaml.cs

示例15: EntryPage

        public EntryPage()
        {
            InitializeComponent();
            StandardTileData sd = new StandardTileData
            {
                Title = "Property Viewer",
                BackgroundImage = new Uri("Background.png", UriKind.Relative),
                Count = 0
            };

            ShellTile st = ShellTile.ActiveTiles.ElementAt(0);
            st.Update(sd);
            client = new ImageServiceClient();

            string channelName = "ChannelName";
            httpChannel = HttpNotificationChannel.Find(channelName);
            if (httpChannel != null)
            {
                channelUri = httpChannel.ChannelUri;
                client.SetUrlAsync(channelUri);
            }
            else
            {
                httpChannel = new HttpNotificationChannel(channelName);
                httpChannel.ErrorOccurred += OnErrorOccurred;
                httpChannel.Open();
                channelUri = httpChannel.ChannelUri;

            }
            httpChannel.ChannelUriUpdated += OnChannelUriUpdated;
            client.resetCompleted += OnResetCompleted;
        }
开发者ID:luiscrs14,项目名称:CMOV2,代码行数:32,代码来源:EntryPage.xaml.cs


注:本文中的StandardTileData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。