public override bool Equals(object obj) { if (ReferenceEquals(this, obj)) { return(true); } var other = obj as FormatGeneratorOptions; if (other == null) { throw new PSInvalidOperationException("Object to be compared is of different type " + obj.GetType().Name); } if (((Properties == null) != (other.Properties == null)) || ((GroupBy == null) != (other.GroupBy == null)) ) { return(false); } return( Expand.Equals(other.Expand) && Force.Equals(other.Force) && ((GroupBy == null && other.GroupBy == null) || GroupBy.Equals(other.GroupBy)) && DisplayError.Equals(other.DisplayError) && ShowError.Equals(other.ShowError) && String.Equals(View, other.View) && ((Properties == null && other.Properties == null) || Properties.Equals(other.Properties)) ); }
private static void showException(Exception e) { Console.WriteLine(e); var error = new DisplayError(); error.SetError(e); error.Show(); }
/// <summary> /// Register callbacks in order to handle VLC dialogs. /// LibVLC 3.0.0 and later. /// </summary> /// <param name="error">Called when an error message needs to be displayed.</param> /// <param name="login">Called when a login dialog needs to be displayed. /// You can interact with this dialog by calling Dialog.PostLogin() to post an answer or Dialog.Dismiss() to cancel this dialog.</param> /// <param name="question">Called when a question dialog needs to be displayed. /// You can interact with this dialog by calling Dialog.PostLogin() to post an answer or Dialog.Dismiss() to cancel this dialog.</param> /// <param name="displayProgress">Called when a progress dialog needs to be displayed.</param> /// <param name="updateProgress">Called when a progress dialog needs to be updated.</param> public void SetDialogHandlers(DisplayError error, DisplayLogin login, DisplayQuestion question, DisplayProgress displayProgress, UpdateProgress updateProgress) { _error = error ?? throw new ArgumentNullException(nameof(error)); _login = login ?? throw new ArgumentNullException(nameof(login)); _question = question ?? throw new ArgumentNullException(nameof(question)); _displayProgress = displayProgress ?? throw new ArgumentNullException(nameof(displayProgress)); _updateProgress = updateProgress ?? throw new ArgumentNullException(nameof(updateProgress)); Native.LibVLCDialogSetCallbacks(NativeReference, DialogCb, GCHandle.ToIntPtr(_gcHandle)); }
public Task HandleSilent(Exception ex, string message = "") { var msg = ex.Message; if (!string.IsNullOrEmpty(message)) { Console.WriteLine($"ERROR: {message} ->"); msg = message; } Console.WriteLine(ex); DisplayError?.Invoke(msg); return(Task.CompletedTask); }
protected override void CreateChildControls() { try { LogError = new DisplayError(); LogError.isError = false; if (this.AutoLoc) { //Save the City Value to SP DB SaveAutoLoc(); } //Get the weather profile from the properties entered WeatherProfile _profile = GetWeatherProfile(); Control control = Page.LoadControl(_ascxPath); ((WeatherUserControl)control)._weatherProfile = _profile; ((WeatherUserControl)control)._displayError = LogError; Controls.Add(control); //If any error occurs if (LogError.isError && !string.IsNullOrEmpty(LogError.ErrorMessage)) { Label Errorlbl = new Label(); Errorlbl.Text = LogError.ErrorMessage; Errorlbl.CssClass = "colr"; this.Controls.Add(Errorlbl); LogError.isError = false; LogError.ErrorMessage = string.Empty; } } catch (Exception ex) { throw (new SPException(ex.Message)); } }
public override int GetHashCode() { return(Expand.GetHashCode() ^ Force.GetHashCode() ^ GroupBy.GetHashCode() ^ DisplayError.GetHashCode() ^ ShowError.GetHashCode() ^ View.GetHashCode() ^ Properties.GetHashCode()); }
public void SetDialogHandlers(DisplayError error, DisplayLogin login, DisplayQuestion question, DisplayProgress displayProgress, UpdateProgress updateProgress) { if (error == null) { throw new ArgumentNullException(nameof(error)); } if (login == null) { throw new ArgumentNullException(nameof(login)); } if (question == null) { throw new ArgumentNullException(nameof(question)); } if (displayProgress == null) { throw new ArgumentNullException(nameof(displayProgress)); } if (updateProgress == null) { throw new ArgumentNullException(nameof(updateProgress)); } var dialogCbs = new DialogCallbacks { DisplayError = (data, title, text) => { // no dialogId ?! error(title, text); }, DisplayLogin = (data, id, title, text, username, store) => { var cts = new CancellationTokenSource(); var dlg = new Dialog(new DialogId { NativeReference = id }); _cts.Add(id, cts); login(dlg, title, text, username, store, cts.Token); }, DisplayQuestion = (data, id, title, text, type, cancelText, firstActionText, secondActionText) => { var cts = new CancellationTokenSource(); var dlg = new Dialog(new DialogId { NativeReference = id }); _cts.Add(id, cts); question(dlg, title, text, type, cancelText, firstActionText, secondActionText, cts.Token); }, DisplayProgress = (data, id, title, text, indeterminate, position, cancelText) => { var cts = new CancellationTokenSource(); var dlg = new Dialog(new DialogId { NativeReference = id }); _cts.Add(id, cts); displayProgress(dlg, title, text, indeterminate, position, cancelText, cts.Token); }, Cancel = (data, id) => { if (_cts.TryGetValue(id, out var token)) { token.Cancel(); _cts.Remove(id); } }, UpdateProgress = (data, id, position, text) => { var dlg = new Dialog(new DialogId { NativeReference = id }); updateProgress(dlg, position, text); } }; _dialogCbsPtr = Marshal.AllocHGlobal(Marshal.SizeOf <DialogCallbacks>()); Marshal.StructureToPtr(dialogCbs, _dialogCbsPtr, true); Native.LibVLCDialogSetCallbacks(NativeReference, _dialogCbsPtr, IntPtr.Zero); }
public Lexer(string file, string text) { _text = text; _index = 0; _de = new DisplayError(file, text); }