Windows phone 7 WP7-如何将互动程序添加到我的应用程序?
基本上,我几乎完成了这个笔记应用程序,用户保存笔记等基本的笔记应用程序功能。我没有完全完成的原因是,我只需要帮助在我的应用程序中添加便笺贴。基本上,用户单击菜单项中的“Pin to start”(锁定开始),对于所选注释,将其锁定到开始。我通过以下方式做到了这一点:Windows phone 7 WP7-如何将互动程序添加到我的应用程序?,windows-phone-7,add,tiles,Windows Phone 7,Add,Tiles,基本上,我几乎完成了这个笔记应用程序,用户保存笔记等基本的笔记应用程序功能。我没有完全完成的原因是,我只需要帮助在我的应用程序中添加便笺贴。基本上,用户单击菜单项中的“Pin to start”(锁定开始),对于所选注释,将其锁定到开始。我通过以下方式做到了这一点: Private Sub PinToStart_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Dim Storage As
Private Sub PinToStart_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs)
Dim Storage As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
Dim data As SampleData = TryCast(TryCast(sender, MenuItem).DataContext, SampleData)
Dim selectedItem As ListBoxItem = TryCast(Me.SavedNotesList.ItemContainerGenerator.ContainerFromItem(data), ListBoxItem)
Dim directory As String = "./MyNote/SavedNotes/*.*"
Dim filenames As String() = Storage.GetFileNames(directory)
Dim dataSource As New List(Of SampleData)()
For Each filename As String In filenames
Dim ISF As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
Dim FS As IsolatedStorageFileStream = ISF.OpenFile("MyNote/SavedNotes/" & filename, FileMode.Open, FileAccess.Read)
Dim FETime As String = Storage.GetCreationTime("MyNote/SavedNotes/" & data.FileNameX).ToString("dd/mm/yyyy h:mmtt")
Dim tileData As New StandardTileData() With { _
.Title = data.FileNameX, _
.BackgroundImage = New Uri("/Assets/202.png", UriKind.Relative), _
.BackTitle = data.FileNameX, _
.BackContent = data.Description}
ShellTile.Create(New Uri("/ViewPage.xaml?Title=" & data.FileNameX & "&Body=" & data.Description, UriKind.Relative), tileData)
Next
End Sub
目前,这是创建平铺的代码。尽管存在一个问题,但创建磁贴后,它会抛出一个异常,并说“只有当应用程序位于前台时才能创建磁贴”,但它仍然继续,并且创建磁贴没有问题。我的第二个错误是,我需要一种方法来更新互动程序。我只是不知道怎么做
有人能帮我吗?使用Microsoft.Phone.Controls.Toolkit中的Hubble控件创建互动程序 您可以尝试以下代码: var shellTileData=新标准TileData { BackgroundImage=新Uri(“图像路径”,UriKind.RelativeOrAbsolute), BackContent=“xyz”
嘿,谢谢你这么做,但是更新互动程序怎么样?我怎么做?你有解决方案吗?嘿,我添加了代码,我试图调试它,但出现了一个错误。它突出显示hubbile.Name、hubbile.Title和hubbile.Message。显示“对非共享成员的引用需要对象引用。”有什么办法可以解决这个问题吗?你在xaml部分使用Hubbile控件吗?没有。我使用的是默认的StandardTileData
};
var tile = ShellTile.ActiveTiles.First();
tile.Update(shellTileData);