/// <summary> /// Remove the last shown showable from the UI. /// </summary> public virtual void ClearLastShowable() { if (lastShowableButtons == null) { return; } lastShowableButtons.OnButtonsChanges -= UpdateButtons; lastShowableButtons.OnButtonChange -= UpdateButton; lastShowableButtons = null; }
/// <summary> /// Keeps the new showable. /// </summary> /// <param name="showable">The showable.</param> protected virtual void KeepNewShowable(IShowable showable) { var showableButtons = showable as IShowableButtons; var show = showable != null && showableButtons != null; SetVisible(show); if (showableButtons == null) { return; } var data = showableButtons.GetButtons(); UpdateButtons(data); showableButtons.OnButtonsChanges += UpdateButtons; showableButtons.OnButtonChange += UpdateButton; lastShowableButtons = showableButtons; }