/// <summary> /// Constructor. /// </summary> public MainForm() { InitializeComponent(); removeBOM = null; countBOMFiles = 0; rtbFiles.AllowDrop = true; rtbFiles.DragEnter += new DragEventHandler(rtbFiles_DragEnter); rtbFiles.DragDrop += new DragEventHandler(rtbFiles_DragDrop); txtExtension.Text = RemoveBOM.EXTENSION_ALL; }
/// <summary> /// Drag files drop. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void rtbFiles_DragDrop(object sender, DragEventArgs e) { if (removeBOM == null) { string[] paths = (string[])e.Data.GetData(DataFormats.FileDrop); removeBOM = new RemoveBOM(this); removeBOM.SetPaths(paths); removeBOM.SetExtension(txtExtension.Text); if (rbRemoveBOM.Checked) { removeBOM.SetRemove(); removeBOM.SetMakeBackup(chkBackup.Checked); } else { removeBOM.SetTest(); } removeThread = new Thread(removeBOM.Execute); removeThread.IsBackground = true; removeThread.Start(); } }
/// <summary> /// Set removing is stopped. /// </summary> public void Stop() { if (pbWorking.InvokeRequired) { try { SetCallback callback = new SetCallback(Stop); Invoke(callback); } catch { } } else { pbWorking.Visible = false; btnCancel.Visible = false; chkBackup.Enabled = true; rbRemoveBOM.Enabled = true; rbTestBOM.Enabled = true; btnClearList.Enabled = true; rbListBOMFiles.Enabled = true; rbListAllFiles.Enabled = true; txtExtension.Enabled = true; removeBOM = null; } }