private static DialogQuestionType ConvertEnum(libvlc_dialog_question_type i_type) { switch (i_type) { case libvlc_dialog_question_type.LIBVLC_DIALOG_QUESTION_NORMAL: return(DialogQuestionType.DialogQuestionNormal); case libvlc_dialog_question_type.LIBVLC_DIALOG_QUESTION_WARNING: return(DialogQuestionType.DialogQuestionWarning); case libvlc_dialog_question_type.LIBVLC_DIALOG_QUESTION_CRITICAL: return(DialogQuestionType.DialogQuestionCritical); } throw new InvalidCastException("Unexpected enum value " + i_type); }
private unsafe void pf_display_question(void *p_data, IntPtr p_id, char *psz_title, char *psz_text, libvlc_dialog_question_type i_type, char *psz_cancel, char *psz_action1, char *psz_action2) { if (DisplayQuestion == null) { return; } var questionResult = DisplayQuestion(new QuestionDialogInfo() { Action1Text = new string(psz_action1), Action2Text = new string(psz_action2), CancelButtonText = new string(psz_cancel), DialogQuestionType = ConvertEnum(i_type), Text = new string(psz_text), Title = new string(psz_title) }); int success = LibVlcMethods.libvlc_dialog_post_action(p_id, questionResult.Selection); if (success == -1) { throw new LibVlcException("Failed to display dialog"); } }