public static UserControl GetOptionsControl(IBatchCleanController controller) { string optionPath = System.IO.Path.Combine(GetInstallDirectory(), "bc-gui.exe"); if (File.Exists(optionPath)) { Assembly asm = Assembly.LoadFrom(optionPath); Type type = asm.GetType("bc_gui.Options"); Object[] args = { controller }; Object obj = Activator.CreateInstance(type, args); return obj as UserControl; } else { // if bc-gui.exe doesn't exist (i.e. Protect is not enabled) return null; } }
public Options(IBatchCleanController controller) { m_controller = controller as CleanerController; notOverridableItems = new Dictionary<int, string>(); InitializeComponent(); // Hide this groupbox we get used as an options list in PDFCombine // ContainerForm will show it when loading this control. ShowSavingGroupBox(false); m_bInit = true; foreach (Option option in m_controller.Options) { if (m_controller.Options.ShouldShowOptionForFileList(option.ID, m_controller.Files)) { optionsList.Items.Add(option, option.Checked); m_controller.Options[option.ID].Checked = option.Checked; } } for (int index = 0; index < optionsList.Items.Count; index++) { var opt = optionsList.Items[index] as Option; if (opt != null && !opt.CanUserOverride) { notOverridableItems.Add(index, opt.ID); optionsList.DisableItem(index, opt.ID); } } if (!String.IsNullOrEmpty(m_controller.WriteToFolder)) { txtWriteToFolder.Text = m_controller.WriteToFolder; radSaveNewLocation.Checked = true; } if (!CanOwerwriteAllFiles(m_controller.Files)) { radOverwrite.Enabled = false; radSaveNewLocation.Checked = true; } m_bInit = false; }