本文整理汇总了C#中StandardTileData类的典型用法代码示例。如果您正苦于以下问题:C# StandardTileData类的具体用法?C# StandardTileData怎么用?C# StandardTileData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StandardTileData类属于命名空间,在下文中一共展示了StandardTileData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: PinItem_Click
private void PinItem_Click(object sender, RoutedEventArgs e)
{
LocationInformation locationInformation =
(sender as MenuItem).DataContext as LocationInformation;
Uri tileUri = MakeTileUri(locationInformation);
StandardTileData initialData = new StandardTileData()
{
BackgroundImage = new Uri("Images/Clear.png", UriKind.Relative),
Title = locationInformation.Name
};
((sender as MenuItem).Parent as ContextMenu).IsOpen = false;
try
{
ShellTile.Create(tileUri, initialData);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error creating tile", MessageBoxButton.OK);
return;
}
}
开发者ID:xiaya1986,项目名称:PushNotificationExercise,代码行数:25,代码来源:Page1.xaml.cs
示例17: CreateOrUpdateTileForProject
public static void CreateOrUpdateTileForProject(Project project, int count)
{
StandardTileData NewTileData = new StandardTileData
{
Title = project.name,
BackgroundImage = null,
Count = count,
BackTitle = project.name,
BackBackgroundImage = null,
BackContent = "You have uncompleted tasks for today"
};
if (!Tiles.Keys.Select(key => key == project).FirstOrDefault())
{
ShellTile.Create(new Uri("/SecondaryTile.xaml?Project=", UriKind.Relative), NewTileData);
string IdentifyFromString = String.Format("ProjectName={0}&ProjectId={1}", project.name, project.id);
ShellTile TileOfProjectCreated =
ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(IdentifyFromString));
Tiles.Add(project, TileOfProjectCreated);
}
else
{
Tiles[project].Update(NewTileData);
}
}
开发者ID:richardaum,项目名称:Metroist-for-Windows-Phone,代码行数:25,代码来源:TileManager.cs
示例18: Execute
public void Execute(object parameter)
{
var filename = parameter.ToString();
var number = Path.GetFileNameWithoutExtension(filename).Split('_')[2];
if (ShellTile.ActiveTiles.Any(st => st.NavigationUri.ToString().Contains(number)))
{
new MessagePrompt() { Title = "SimInfo", Message = AppResources.TileAlreadyPinned }.Show();
return;
}
var baseDir = Path.GetDirectoryName(filename);
var smallpath = Path.Combine(baseDir, string.Format("{0}_{1}_{2}.jpg", 159, 159, number));
var normalpath = Path.Combine(baseDir, string.Format("{0}_{1}_{2}.jpg", 336, 336, number));
//var widepath = Path.Combine(baseDir, string.Format("{0}_{1}_{2}.jpg", 691, 336, number));
StandardTileData tileData = new StandardTileData
{
Title = " ",
// WideBackgroundImage = new Uri("isostore:" + widepath, UriKind.Absolute),
BackgroundImage = new Uri("isostore:" + normalpath, UriKind.Absolute),
//SmallBackgroundImage = new Uri("isostore:" + smallpath, UriKind.Absolute),
BackBackgroundImage = new Uri("isostore:" + normalpath, UriKind.Absolute),
// WideBackBackgroundImage = new Uri("isostore:" + widepath, UriKind.Absolute),
};
string tileUri = string.Concat("/DataPage.xaml?number=", HttpUtility.UrlEncode(number));
ShellTile.Create(new Uri(tileUri, UriKind.Relative), tileData, false);
}
开发者ID:XVincentX,项目名称:SimInfo,代码行数:30,代码来源:ShellCommand.cs
示例19: ResetTileToDefault
public bool ResetTileToDefault()
{
bool result = false;
try
{
StandardTileData tileData = new StandardTileData()
{
Title = "On This Day...",
BackgroundImage = new Uri("/icons/Application_Icon_336.png", UriKind.Relative),
BackBackgroundImage = new Uri("NONESUCH.png", UriKind.Relative),
BackTitle = string.Empty,
BackContent = string.Empty
};
ShellTile tile = ShellTile.ActiveTiles.First();
tile.Update(tileData);
result = true;
}
catch (Exception)
{
// ignore, best effort cleanup
}
return result;
}
开发者ID:camradal,项目名称:OnThisDayApp,代码行数:26,代码来源:BackgroundAgent.cs
示例20: PinTileToStartMenu
private void PinTileToStartMenu()
{
var thePerson = this.DataContext as Person;
// Check the existence of the secondary tile
var shellTile = ShellTile.ActiveTiles.FirstOrDefault(
x => x.NavigationUri.ToString().Contains("FirstName=" + thePerson.FirstName));
if (shellTile != null)
return;
// Create the tile data with some proeprties
var tileData = new StandardTileData
{
Title = String.Format("{0} {1}", thePerson.FirstName, thePerson.LastName),
Count = DateTime.Now.Year - thePerson.BirthDate.Year,
BackTitle = "Back page",
BackContent = "This is the back page for " + thePerson.FirstName,
BackBackgroundImage = new Uri("back.jpg", UriKind.Relative)
};
// create the tile at the start screen
Uri newUri = new Uri("/DetailsPage.xaml?FirstName=" + thePerson.FirstName, UriKind.Relative);
ShellTile.Create(newUri, tileData);
foreach (var item in ShellTile.ActiveTiles)
{
Debug.WriteLine(item.NavigationUri);
}
}
开发者ID:ChrisKoenig,项目名称:MangoTiles,代码行数:30,代码来源:DetailsPage.xaml.cs
注:本文中的StandardTileData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论