示例#1
0
 private void DeleteFile_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     var fileInfo = e.Parameter as FileInfo;
     if (MessageBox.Show(
         string.Format("Delete file {0} ({1})?", fileInfo.Name, fileInfo.Id),
         "Confirm",
         MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         this.Asynch(() =>
         {
             var id = fileInfo.Id;
             using (var client = new RepositoryClientFactory().CreateClient())
             {
                 client.Open();
                 client.Delete(id);
                 client.Close();
             }
         }, ShowWait, HideWait);
     }
 }
示例#2
0
        private void LoadPage(int page, int pageNumber)
        {
            IEnumerable<FileInfo> files = null;

            this.Asynch(() =>
            {
                using (var client = new RepositoryClientFactory().CreateClient())
                {
                    client.Open();
                    files = client.Browse(page * pageNumber, page).Select(x => new FileInfo { Id = x.Id, Name = x.Name });
                    client.Close();
                }
            }, ShowWait, HideWait, () =>
            {
                filesListView.ItemsSource = files;
            });
        }