示例#1
0
 public async void WatchfulWatcher()
 {
     await Task.Run(() =>
     {
         DataMan.Watcher = new FileSystemWatcher(DownMan.AppData());
         DataMan.Watcher.BeginInit();
         DataMan.Watcher.EnableRaisingEvents = true;
         DataMan.Watcher.NotifyFilter        = NotifyFilters.LastWrite;
         DataMan.Watcher.Filter   = "*.xml";
         DataMan.Watcher.Changed += FileSystemWatcher_Changed;
         DataMan.Watcher.EndInit();
     });
 }
示例#2
0
 private void DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var book = (BookModel)DataContext;
         DataMan.DeleteBook(book);
         File.Delete(Path.Combine(DownMan.AppData(), book.DocPath));
         File.Delete(Path.Combine(DownMan.AppData(), book.ImageUrl));
         ((WrapPanel)this.Parent).Children.Remove(this);
     }
     catch (Exception e3)
     {
         MessageBox.Show("Error | " + e3.Message);
     }
 }
示例#3
0
        private void OpenButton_Click(object sender, RoutedEventArgs e)
        {
            if (!File.Exists(Path.Combine(DownMan.AppData(), "sumatra.exe")))
            {
                var zip = Ionic.Zip.ZipFile.Read(Path.Combine(DownMan.AppData(), "sumatra.zip"));
                zip.ExtractAll(DownMan.AppData());
            }

            if (!File.Exists(((BookModel)DataContext).DocPath))
            {
                MessageBox.Show("Error: No File");
                return;
            }

            Process.Start(Path.Combine(DownMan.AppData(), "sumatra.exe"), Path.Combine(DownMan.AppData(), ((BookModel)DataContext).DocPath));
        }