public override NSApplicationTerminateReply ApplicationShouldTerminate(NSApplication sender)
        {
            // Clean up all of the panels, and disposable resources
            if (_usageChecker != null)
            {
                _usageChecker.Dispose();
                _usageChecker = null;
            }

            if (_statusPanelController != null)
            {
                _statusPanelController.Dispose();
                _statusPanelController = null;
            }

            return NSApplicationTerminateReply.Now;
        }
        /// <summary>
        /// Panel to display should be the usage status
        /// </summary>
        private void SetStatusPanel()
        {
            var hashCode = SettingsManager.GetSetting(SettingsManager.KeyHashCode);

            if (string.IsNullOrWhiteSpace(hashCode))
                SetLoginPanel();

            // Since this is init, we may have a different hash code, so create a new usage checker
            // TODO: Ideally UsageChecker needs to be refactored out and put into the UsagePanel
            if (_usageChecker != null)
                _usageChecker.Dispose();

            _usageChecker = new UsageChecker(hashCode);

            // Instantiate the usage panel and hook up the neccessary events
            var panelController = new UsagePanelController();

            panelController.RefreshButtonClicked += (sender, e) => _usageChecker.UpdateUsageInformation();
            panelController.QuitButtonClicked += (sender, e) => NSApplication.SharedApplication.Terminate(sender as UsagePanelController);
            panelController.LogoutButtonClicked += (sender, e) => Logout();

            // Whenever the usage checker gets a new value, update the UI
            _usageChecker.UsageUpdated += (sender, e) =>
            {
                if (e.UsageInformation != null)
                    panelController.UpdateUsage(e.UsageInformation);
            };

            if (_statusPanelController != null)
                _statusPanelController.PanelController = panelController;
            else
                _statusPanelController = new StatusPanelController(panelController);
        }
        /// <summary>
        /// Panel to display should be the login panel
        /// </summary>
        private void SetLoginPanel()
        {
            var loginController = new LoginPanelController();

            loginController.LoggedIn += (sender, e) => SetStatusPanel();
            loginController.QuitButtonClicked += (sender, e) => NSApplication.SharedApplication.Terminate(sender as LoginPanelController);

            if (_statusPanelController == null)
                _statusPanelController = new StatusPanelController(loginController);
            else
                _statusPanelController.PanelController = loginController;
        }