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(); }); }
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); } }
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)); }