public void OpenCdrFile() { if (lst.SelectedIndex == -1) { return; } CdrFile c = (CdrFile)lst.SelectedItem; if (File.Exists(c.cdr_filepath)) { foreach (Document doc in RFcontrol.dApp.Documents) { if (doc.FullFileName == c.cdr_filepath) { MessageBox.Show("This file is already open.", RFcontrol.mName, MessageBoxButton.OK, MessageBoxImage.Error); return; } } RFcontrol.dApp.OpenDocument(c.cdr_filepath); this.Visibility = Visibility.Hidden; } else { MessageBox.Show("The file not found", RFcontrol.mName, MessageBoxButton.OK, MessageBoxImage.Information); if (RFcontrol.db.DeleteFromDB(c.cdr_filepath)) { RFcontrol.db.LoadList(); } } }
private void mDelete(object sender, RoutedEventArgs e) { if (lst.SelectedIndex == -1) { return; } if (MessageBox.Show("Are you sure you want to delete this file from disk?", RFcontrol.mName, MessageBoxButton.YesNo, MessageBoxImage.Question).GetHashCode() == 6) { CdrFile c = (CdrFile)lst.SelectedItem; try { if (File.Exists(c.cdr_filepath)) { File.Delete(c.cdr_filepath); if (RFcontrol.db.DeleteFromDB(c.cdr_filepath)) { RFcontrol.db.LoadList(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void mReveal(object sender, RoutedEventArgs e) { if (lst.SelectedIndex == -1) { return; } CdrFile c = (CdrFile)lst.SelectedItem; openFolder(c.cdr_filepath); }
private void mDeleteItem(object sender, RoutedEventArgs e) { if (lst.SelectedIndex == -1) { return; } CdrFile c = (CdrFile)lst.SelectedItem; if (RFcontrol.db.DeleteFromDB(c.cdr_filepath)) { RFcontrol.db.LoadList(); } }
private void mCloseFile(object sender, RoutedEventArgs e) { if (lst.SelectedIndex == -1) { return; } CdrFile c = (CdrFile)lst.SelectedItem; foreach (Corel.Interop.VGCore.Document d in RFcontrol.dApp.Documents) { if (c.cdr_filepath == d.FullFileName) { if (d.Dirty) { int state = MessageBox.Show( "Save changes to " + c.cdr_file_name + "?", RFcontrol.mName, MessageBoxButton.YesNoCancel, MessageBoxImage.Question ).GetHashCode(); switch (state) { //case 2: //Cansel case 6: d.Save(); d.Close(); break; case 7: d.Close(); break; } return; } else { d.Close(); return; } } } }