Пример #1
0
        private void toolStripEditBooks_Click(object sender, EventArgs e)
        {
            var     dialog = new ChangeProperties();
            FB2File fc     = null;

            if (filesView.FocusedItem != null)
            {
                fc = filesView.FocusedItem.Tag as FB2File;
            }
            dialog.LoadFileProperties(fc, filesView.CheckedItems.Count);
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                InProgress = true;
                var fp = dialog.GetFileProperties();
                foreach (ListViewItem item in filesView.CheckedItems)
                {
                    FB2File fi = item.Tag as FB2File;
                    try
                    {
                        UpdateFileProperties(item, fp);
                        UpdateItem(item);
                        AddMessageRN(String.Format(Properties.Resources.ProgressEditFile, fi.FileInformation.FullName));
                        if (CheckCancel())
                        {
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        AddErrorRN(String.Format(Properties.Resources.ProgressEditFileError, fi.FileInformation.FullName, ex.Message));
                    }
                }
                InProgress = false;
            }
        }
Пример #2
0
 private void metadataSingleToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (filesView.FocusedItem != null)
     {
         var     dialog = new ChangeProperties();
         FB2File fc     = filesView.FocusedItem.Tag as FB2File;
         dialog.LoadFileProperties(fc, 1);
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             var fp = dialog.GetFileProperties();
             try
             {
                 UpdateFileProperties(filesView.FocusedItem, fp);
                 UpdateItem(filesView.FocusedItem);
                 AddMessageRN(String.Format(Properties.Resources.ProgressEditFile, fc.FileInformation.FullName));
             }
             catch (Exception ex)
             {
                 AddErrorRN(String.Format(Properties.Resources.ProgressEditFileError, fc.FileInformation.FullName, ex.Message));
             }
         }
     }
 }