コード例 #1
0
        private void ForceReset_Click(object sender, RoutedEventArgs e)
        {
            FileDataSource2 ds = Grid1.ItemsSource as FileDataSource2;

            if (ds != null)
            {
                ds.ResetCollection();
            }
        }
コード例 #2
0
ファイル: FileDataSource2.cs プロジェクト: ice0/test
        // Factory method to create the datasource
        // Requires async work which is why it needs a factory rather than being part of the constructor
        public static async Task <FileDataSource2> GetDataSoure(string path)
        {
            FileDataSource2 ds = new FileDataSource2();
            StorageFolder   f  = await StorageFolder.GetFolderFromPathAsync(path);

            await ds.SetFolder(f);

            return(ds);
        }
コード例 #3
0
        async void initdata()
        {
            StorageLibrary pictures = await StorageLibrary.GetLibraryAsync(KnownLibraryId.Pictures);

            string path = pictures.SaveFolder.Path;

            FileDataSource2 ds = await FileDataSource2.GetDataSoure(path);

            if (ds.Count > 0)
            {
                Grid1.ItemsSource = ds;
            }
            else
            {
                MainPage.Current.NotifyUser("Error: The pictures folder doesn't contain any files", NotifyType.ErrorMessage);
            }
        }
コード例 #4
0
 // Factory method to create the datasource
 // Requires async work which is why it needs a factory rather than being part of the constructor
 public static async Task<FileDataSource2> GetDataSoure(string path)
 {
     FileDataSource2 ds = new FileDataSource2();
     StorageFolder f = await StorageFolder.GetFolderFromPathAsync(path);
     await ds.SetFolder(f);
     return ds;
 }