internal DialogCallbacks(DisplayErrorCallback displayError, DisplayLoginCallback displayLogin, DisplayQuestionCallback displayQuestion, DisplayProgressCallback displayProgress, CancelCallback cancel, UpdateProgressCallback updateProgress) { DisplayError = Marshal.GetFunctionPointerForDelegate(displayError); DisplayLogin = Marshal.GetFunctionPointerForDelegate(displayLogin); DisplayQuestion = Marshal.GetFunctionPointerForDelegate(displayQuestion); DisplayProgress = Marshal.GetFunctionPointerForDelegate(displayProgress); Cancel = Marshal.GetFunctionPointerForDelegate(cancel); UpdateProgress = Marshal.GetFunctionPointerForDelegate(updateProgress); }
internal DialogCallbacks(DisplayErrorCallback displayError, DisplayLoginCallback displayLogin, DisplayQuestionCallback displayQuestion, DisplayProgressCallback displayProgress, CancelCallback cancel, UpdateProgressCallback updateProgress) { DisplayError = displayError; DisplayLogin = displayLogin; DisplayQuestion = displayQuestion; DisplayProgress = displayProgress; Cancel = cancel; UpdateProgress = updateProgress; }
private void DisplayError(string error) { if (InvokeRequired) { DisplayErrorCallback cb = new DisplayErrorCallback(DisplayError); this.Invoke(cb, new object[] { error }); } else { MessageBox.Show(this, error, "API Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void DisplayError() { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.lvError.InvokeRequired) { //call itself on the main thread DisplayErrorCallback d = new DisplayErrorCallback(DisplayError); this.Invoke(d); } else { this.lvError.Items.Clear(); this.lvError.View = View.Details; this.lvError.Columns.Add("Text"); this.lvError.Columns[0].Width = this.lvError.Width - 4; this.lvError.HeaderStyle = ColumnHeaderStyle.None; this.lvError.ShowItemToolTips = true; // break up the text into 40 characters or so, because the view truncates it string[] split_message = m_caching_message.Split(' '); string current_text = ""; for (int split_index = 0; split_index < split_message.Length; ++split_index) { string split_part = split_message[split_index]; if ((40 < current_text.Length + split_part.Length)) { AddError(current_text); current_text = split_part; } else { if (current_text.Trim() != "") { current_text += " "; } current_text += split_part; } // If the current part is the last part, just display it. if (split_index == split_message.Length - 1) { AddError(current_text); } } } }
private void InitCallbacks(ref libvlc_dialog_cbs cbs) { DisplayErrorCallback error = new DisplayErrorCallback(pf_display_error); DisplayLoginCallback login = new DisplayLoginCallback(pf_display_login); DisplayQuestionCallback question = new DisplayQuestionCallback(pf_display_question); DisplayProgressCallback progress = new DisplayProgressCallback(pf_display_progress); CancelCallback cancel = new CancelCallback(pf_cancel); UpdateProgressCallback updateProgress = new UpdateProgressCallback(pf_update_progress); cbs.pf_cancel = Marshal.GetFunctionPointerForDelegate(cancel); cbs.pf_display_error = Marshal.GetFunctionPointerForDelegate(error); cbs.pf_display_login = Marshal.GetFunctionPointerForDelegate(login); cbs.pf_display_progress = Marshal.GetFunctionPointerForDelegate(progress); cbs.pf_display_question = Marshal.GetFunctionPointerForDelegate(question); cbs.pf_update_progress = Marshal.GetFunctionPointerForDelegate(updateProgress); }
private void DisplayError() { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.lvError.InvokeRequired) { //call itself on the main thread DisplayErrorCallback d = new DisplayErrorCallback(DisplayError); this.Invoke(d); } else { this.lvError.Items.Clear(); this.lvError.View = View.Details; this.lvError.Columns.Add("Text"); this.lvError.Columns[0].Width = this.lvError.Width - 4; this.lvError.HeaderStyle = ColumnHeaderStyle.None; this.lvError.ShowItemToolTips = true; // break up the text into 40 characters or so, because the view truncates it string[] split_message = m_caching_message.Split(' '); string current_text = ""; for (int split_index = 0; split_index < split_message.Length; ++split_index) { string split_part = split_message[split_index]; if ((40 < current_text.Length + split_part.Length)) { AddError(current_text); current_text = split_part; } else { if (current_text.Trim() != "") current_text += " "; current_text += split_part; } // If the current part is the last part, just display it. if (split_index == split_message.Length - 1) AddError(current_text); } } }