protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { base.OnClicked(controlId, control, actionType); if (control == btnSortBy) { OnShowSort(); } if (control == facadeLayout) { if (actionType == Action.ActionType.ACTION_SHOW_INFO) { OnInfo(SelectedFacadeItem()); facadeLayout.RefreshCoverArt(); } if (actionType == Action.ActionType.ACTION_SELECT_ITEM) { OnClick(SelectedFacadeItem()); } if (actionType == Action.ActionType.ACTION_QUEUE_ITEM) { OnQueueItem(SelectedFacadeItem()); } } UpdateButtonStates(); }
protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { base.OnClicked(controlId, control, actionType); if (control == btnSortBy) { OnShowSort(); } if (control == facadeLayout) { if (actionType == Action.ActionType.ACTION_SHOW_INFO) { OnInfo(SelectedFacadeItem()); facadeLayout.RefreshCoverArt(); } if (actionType == Action.ActionType.ACTION_SELECT_ITEM) { OnClick(SelectedFacadeItem()); } if (actionType == Action.ActionType.ACTION_QUEUE_ITEM) { OnQueueItem(SelectedFacadeItem()); } if (actionType == Action.ActionType.ACTION_MOVE_SELECTED_ITEM_DOWN || actionType == Action.ActionType.ACTION_MOVE_SELECTED_ITEM_UP) { GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECTED, GetID, 0, controlId, 0, 0, null); OnMessage(msg); } } UpdateButtonStates(); }
/// <summary> /// Handles click events of GUI controls /// </summary> /// <param name="controlId">ID of the GUI control</param> /// <param name="control">Control Object</param> /// <param name="actionType">Performed ActionType</param> protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType) { if (control == btnViewAs) { bool shouldContinue; do { shouldContinue = false; switch (CurrentView) { case View.List: CurrentView = View.Icons; if (facadeView.ThumbnailLayout == null) { shouldContinue = true; } else { facadeView.CurrentLayout = GUIFacadeControl.Layout.SmallIcons; } break; case View.Icons: CurrentView = View.LargeIcons; if (facadeView.ThumbnailLayout == null) { shouldContinue = true; } else { facadeView.CurrentLayout = GUIFacadeControl.Layout.LargeIcons; } break; case View.LargeIcons: CurrentView = View.FilmStrip; if (facadeView.FilmstripLayout == null) { shouldContinue = true; } else { facadeView.CurrentLayout = GUIFacadeControl.Layout.Filmstrip; } break; case View.FilmStrip: CurrentView = View.List; if (facadeView.ListLayout == null) { shouldContinue = true; } else { facadeView.CurrentLayout = GUIFacadeControl.Layout.List; } break; } } while (shouldContinue); SelectCurrentItem(); GUIControl.FocusControl(GetID, controlId); return; } if (control == btnSortBy) { switch (CurrentSortMethod) { case VideoSort.SortMethod.Name: CurrentSortMethod = VideoSort.SortMethod.Date; break; case VideoSort.SortMethod.Date: CurrentSortMethod = VideoSort.SortMethod.Size; break; case VideoSort.SortMethod.Size: CurrentSortMethod = VideoSort.SortMethod.Name; break; } OnSort(); GUIControl.FocusControl(GetID, control.GetID); } if (control == btnPlayDisc) { OnPlayDisc(); return; } if (control == btnPlayStream) { OnPlayStream(); return; } if (control == facadeView) { GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECTED, GetID, 0, controlId, 0, 0, null); OnMessage(msg); if (actionType == Action.ActionType.ACTION_SHOW_INFO) { //OnInfo(iItem); facadeView.RefreshCoverArt(); } if (actionType == Action.ActionType.ACTION_SELECT_ITEM) { OnClick(); } if (actionType == Action.ActionType.ACTION_QUEUE_ITEM) { //OnQueueItem(iItem); } } if (control == btnDelete) { OnAction(new Action(Action.ActionType.ACTION_DELETE_ITEM, 0, 0)); } }