2
ライブタイルを使用するアプリケーションを作成しました。私は、それがBackgroundTaskので仕事を得ることは正しいメッセージを示していますが、イメージは完全に黒です...ここでタイルの作成と読み込みで何が問題になりますか?
私は/Shared/ShellContent/
に画像を保存私のコードです:
public MainPage()
{
InitializeComponent();
CurrentPlaceList = new ObservableCollection<CurrentPlaceListItemModel>();
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
var bmp = new WriteableBitmap(173, 173);
var weatherImage = new BitmapImage(new Uri("/Images/WeatherIcons/01d.png", UriKind.Relative));
var img = new Image { Source = weatherImage };
weatherImage.CreateOptions = BitmapCreateOptions.None;
var tt = new TranslateTransform();
tt.X = 0;
tt.Y = 0;
bmp.Render(img, tt);
bmp.Invalidate();
var filename = "/Shared/ShellContent/01d.jpg";
using (var st = new IsolatedStorageFileStream(filename, FileMode.OpenOrCreate, FileAccess.Write, store))
{
bmp.SaveJpeg(st, 173, 173, 0, 100);
}
}
StartAgent();
}
そして、私のコードがあります私ScheduledTaskは、テキストや画像を更新することになっている場合、画像が完全に黒である:(
protected override void OnInvoke(ScheduledTask task)
{
//TODO: Add code to perform your task in background
UpdateAppTile("-99");
NotifyComplete();
}
private void UpdateAppTile(string message)
{
ShellTile appTile = ShellTile.ActiveTiles.FirstOrDefault();
if (appTile != null)
{
StandardTileData tileData = new StandardTileData
{
Title = message,
BackgroundImage = new System.Uri("isostore:/Shared/ShellContent/01d.jpg", System.UriKind.Absolute)
};
appTile.Update(tileData);
}
}
これは、いくつかのチュートリアルから取られ、誰もが間違っているものに指を置くことができる?
'ImageLoaded'イベントを' bmp'にレンダリングする前に待つか、Imageを '/ Shared/ShellContent /'ディレクトリにコピーするだけです。また、ここに保存されているものを見るには 'Isolated Storage'を調べることができます – Ku6opr