public override void AwakeFromNib() { base.AwakeFromNib(); // ensure we can safely change shortcuts without executing other bound actions UnbindGlobalShortcuts(); Level = NSWindowLevel.ModalPanel; NSWindow.Notifications.ObserveWillClose(OnClose); _settings = new Settings(); // setup shortcut recorders _validator = new SRValidator(this); _controlDelegate = new ShortcutRecorderDelegate(_validator, x => PresentError(x)); WdgRecorderScanSelect.Delegate = _controlDelegate; WdgRecorderScanClick.Delegate = _controlDelegate; var defaults = NSUserDefaultsController.SharedUserDefaultsController; WdgRecorderScanSelect.Bind(ShortcutRecorder.Constants.NSValueBinding, defaults, Constants.KEY_HOTKEY_SCAN_SELECT, null); WdgRecorderScanClick.Bind(ShortcutRecorder.Constants.NSValueBinding, defaults, Constants.KEY_HOTKEY_SCAN_CLICK, null); // setup settings BtnResultsClipboard.State = _settings.ShouldOutputScanResultsToClipboard ? NSCellStateValue.On : NSCellStateValue.Off; BtnResultsNotificationCenter.State = _settings.ShouldOutputScanResultsToNotificationCenter ? NSCellStateValue.On : NSCellStateValue.Off; _btnResultsClipboardObserver = BtnResultsClipboard.AddObserver(Constants.KEY_CHECKBOX_CHANGED, NSKeyValueObservingOptions.Initial, OnCheckboxChanged); _btnResultsNotificationCenterObserver = BtnResultsNotificationCenter.AddObserver(Constants.KEY_CHECKBOX_CHANGED, NSKeyValueObservingOptions.Initial, OnCheckboxChanged); }
void ReleaseDesignerOutlets() { if (WdgRecorderScanSelect != null) { WdgRecorderScanSelect.Dispose(); WdgRecorderScanSelect = null; } if (WdgRecorderScanClick != null) { WdgRecorderScanClick.Dispose(); WdgRecorderScanClick = null; } if (BtnResultsClipboard != null) { BtnResultsClipboard.Dispose(); BtnResultsClipboard = null; } if (BtnResultsNotificationCenter != null) { BtnResultsNotificationCenter.Dispose(); BtnResultsNotificationCenter = null; } }