public void PrepareHotkeys(HotkeyManager hotkeyManager, Workflow workflow) { if (hotkeyManager != null) { _manager = hotkeyManager; _workflow = workflow; log.DebugFormat("{0} hotkeys are ready.", _manager.Workflows.Count); flpHotkeys.Controls.Clear(); foreach (Control ctl in this.Controls) { ctl.Enabled = true; } foreach (Workflow wf in _manager.Workflows) { HotkeySelectionControl control = new HotkeySelectionControl(wf); control.HotkeyChanged += new EventHandler(control_HotkeyChanged); flpHotkeys.Controls.Add(control); } } else { log.Debug("Hotkeys are not ready yet."); foreach (Control ctl in this.Controls) { ctl.Enabled = false; } flpHotkeys.Controls.Clear(); flpHotkeys.Controls.Add(new Label() { Text = "Hotkeys are not ready yet. \n\nThis is most probably due to Dropbox Sync is still in progress.", AutoSize = true }); } }
private void btnAdd_Click(object sender, EventArgs e) { Workflow wf = new Workflow("New Workflow", new HotkeySetting(), false); WindowWorkflow wwf = new WindowWorkflow(wf); if (wwf.ShowDialog() == DialogResult.OK) { _manager.Workflows.Add(wf); HotkeySelectionControl control = new HotkeySelectionControl(wf); control.HotkeyChanged += new EventHandler(control_HotkeyChanged); flpHotkeys.Controls.Add(control); lblHelp.Text = "Your new hotkey will not be active until you close Settings."; } }