【发布时间】:2013-12-04 07:58:01
【问题描述】:
基本上,我几乎完成了这个用户保存笔记等的笔记应用程序。基本的笔记应用程序功能。我没有完全完成的原因是我只需要帮助我在我的应用程序中添加图块以获取注释。基本上,用户从菜单项中单击“Pin to start”,对于选定的笔记,将其固定到开始。我已经做到了:
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
目前这是创建磁贴的代码。尽管有一个问题,一旦创建了磁贴,它就会抛出异常并说“磁贴只能在应用程序处于前台时创建”,但它仍然继续并毫无问题地创建磁贴。我遇到的第二个错误是我需要一种更新磁贴的方法。我只是不知道怎么做。
谁能帮帮我?
【问题讨论】:
标签: windows-phone-7 add tiles