Пример #1
0
 void _client_Error(object sender, ErrorArgs e)
 {
     Application.Current.Dispatcher.Invoke(() =>
     {
         StatusLabel.Content = e.ErrorMessage;
     });
 }
Пример #2
0
 protected void OnError(ErrorArgs arg)
 {
     if (ErrorOccured != null)
     {
         ErrorOccured(this, arg);
     }
 }
Пример #3
0
        public static void SendErrorMessage(Exception exception,
                                            bool showStackTrace = false)
        {
            try
            {
                var errorArgs = new ErrorArgs
                {
                    Exception      = exception,
                    ShowStackTrace = showStackTrace
                };

                if (ErrorMessagingAvailable)
                {
                    MessagingCenter.Send(Application.Current, Error.ToString(),
                                         errorArgs);
                }
                else
                {
                    DebugWriteException(exception);
                }
            }
            catch (Exception sendException)
            {
                DebugWriteException(sendException);
            }
        }
Пример #4
0
 protected virtual void OnError(object o, ErrorArgs args)
 {
     if (Error != null)
     {
         Error(o, args.Message);
     }
 }
 private void OnError(ErrorArgs e)
 {
     if (Error != null)
     {
         Error(this, e);
     }
 }
Пример #6
0
 /// <summary>
 /// Any errors coming up from the broker are added to a list of errors to be emailed at the end of the job
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void _broker_Error(object sender, ErrorArgs e)
 {
     if (_settings.Errors)
     {
         _errors.Add(e.ErrorMessage);
     }
 }
Пример #7
0
 protected virtual void OnError(ErrorArgs e)
 {
     if (Error != null)
     {
         Error(this, e);
     }
 }
 private void OnError(ErrorArgs e)
 {
     if (Error != null)
     {
         Error(this, e);
     }
 }
Пример #9
0
 protected virtual void OnError (string error) {
   ErrorHandler handler = Error;
   if (handler != null) {
     ErrorArgs args = new ErrorArgs();
     args.Error = error;
     handler (this, args);
   }
 }
 protected virtual void OnError(ErrorArgs e)
 {
     Debug.WriteLine($"Error: GlowReader / OnError", e);
     if (Error != null)
     {
         Error(this, e);
     }
 }
Пример #11
0
        protected virtual void OnError(object o, ErrorArgs args)
        {
            if (Error != null)
            {
                Error(o, args);
            }

            Close();
        }
Пример #12
0
        private string EnsureOutOfBrowserSettingsFile(ref bool shouldSaveProjectFile)
        {
            string str;
            string outOfBrowserSettingsFileLocation = this.GetOutOfBrowserSettingsFileLocation();

            if (string.IsNullOrEmpty(outOfBrowserSettingsFileLocation))
            {
                if (!base.AttemptToMakeProjectWritable())
                {
                    return(null);
                }
                PathHelper.ClearFileOrDirectoryReadOnlyAttribute(base.DocumentReference.Path);
                string str1 = (this.PropertiesPath != null ? Path.Combine(this.PropertiesPath, SilverlightProject.OutOfBrowserSettingsFile) : SilverlightProject.OutOfBrowserSettingsFile);
                base.ProjectStore.SetProperty("OutOfBrowserSettingsFile", str1);
                shouldSaveProjectFile            = true;
                outOfBrowserSettingsFileLocation = PathHelper.ResolveRelativePath(base.ProjectRoot.Path, str1);
            }
            if (!PathHelper.FileOrDirectoryExists(outOfBrowserSettingsFileLocation))
            {
                TemplateItemHelper   templateItemHelper  = new TemplateItemHelper(this, null, base.Services);
                IProjectItemTemplate projectItemTemplate = templateItemHelper.FindTemplateItem("OutOfBrowserSettings");
                if (projectItemTemplate != null)
                {
                    try
                    {
                        List <IProjectItem> projectItems = new List <IProjectItem>();
                        string str2 = PathHelper.EnsurePathEndsInDirectorySeparator(PathHelper.GetDirectoryNameOrRoot(outOfBrowserSettingsFileLocation));
                        string fileNameWithoutExtension          = Path.GetFileNameWithoutExtension(outOfBrowserSettingsFileLocation);
                        IEnumerable <IProjectItem> projectItems1 = templateItemHelper.AddProjectItemsForTemplateItem(projectItemTemplate, fileNameWithoutExtension, str2, CreationOptions.DoNotSelectCreatedItems, out projectItems);
                        if (projectItems1 == null || !projectItems1.CountIs <IProjectItem>(1))
                        {
                            str = null;
                        }
                        else
                        {
                            return(outOfBrowserSettingsFileLocation);
                        }
                    }
                    catch (Exception exception1)
                    {
                        Exception exception = exception1;
                        if (!(exception is NotSupportedException) && !ErrorHandling.ShouldHandleExceptions(exception))
                        {
                            throw;
                        }
                        ErrorArgs errorArg = new ErrorArgs()
                        {
                            Exception = exception
                        };
                        base.Services.MessageDisplayService().ShowError(errorArg);
                        str = null;
                    }
                    return(str);
                }
            }
            return(outOfBrowserSettingsFileLocation);
        }
Пример #13
0
        private void System_ErrorOccured(object sender, ErrorArgs e)
        {
            OnError(e);

            if (e.Fatal)
            {
                Application.Current.Shutdown();
            }
        }
Пример #14
0
        private void DisposeAll()
        {
            BeforeCollect?.Invoke(this, new CollectArgs()
            {
                ObjectCount = _objQueue.Count
            });
#if FINALIZER_CHECK
            lock (_queueLock)
#endif
            {
#if FINALIZER_CHECK
                ValidateRefCount();
#endif
                IntPtr obj;
                Runtime.PyErr_Fetch(out var errType, out var errVal, out var traceback);

                try
                {
                    while (!_objQueue.IsEmpty)
                    {
                        if (!_objQueue.TryDequeue(out obj))
                        {
                            continue;
                        }

                        Runtime.XDecref(obj);
                        try
                        {
                            Runtime.CheckExceptionOccurred();
                        }
                        catch (Exception e)
                        {
                            var errorArgs = new ErrorArgs
                            {
                                Error = e,
                            };

                            ErrorHandler?.Invoke(this, errorArgs);

                            if (!errorArgs.Handled)
                            {
                                throw new FinalizationException(
                                          "Python object finalization failed",
                                          disposable: obj, innerException: e);
                            }
                        }
                    }
                }
                finally
                {
                    // Python requires finalizers to preserve exception:
                    // https://docs.python.org/3/extending/newtypes.html#finalization-and-de-allocation
                    Runtime.PyErr_Restore(errType.StealNullable(), errVal.StealNullable(), traceback.StealNullable());
                }
            }
        }
Пример #15
0
        private void OnError(IntPtr converter, string message)
        {
            var eventArgs = new ErrorArgs
            {
                Document = _processingDocument,
                Message  = message
            };

            Error?.Invoke(this, eventArgs);
        }
Пример #16
0
        public static void ShowErrorMessage(this IServiceProvider source, string message, Exception exception)
        {
            ErrorArgs errorArg = new ErrorArgs()
            {
                Message   = message,
                Exception = exception
            };

            source.MessageDisplayService().ShowError(errorArg);
        }
Пример #17
0
 public void UpdateNotifications(ErrorArgs eventArgs)
 {
     if (eventArgs.Error.Message == "Connection closed.")
     {
         eventArgs.Error.Message = eventArgs.Error.Message + " " + DateTime.Now;
         SetConnectionStatus(false);
     }
     lstNotifications.Invoke(new Action(() => lstNotifications.Items.Insert(0, eventArgs.Error.Message)));
     lstNotifications.Invoke(new Action(() => updateNotifications()));
 }
    protected virtual void OnError(string error)
    {
        ErrorHandler handler = Error;

        if (handler != null)
        {
            ErrorArgs args = new ErrorArgs();
            args.Error = error;
            handler(this, args);
        }
    }
Пример #19
0
    // 连接失败时执行的函数
    void OnConnectFailed(ConnectionArgs args, ErrorArgs error, object state)
    {
        Debug.Log("OnConnectFailed !!!");
        LCMsgSender.Singleton.IsTryingConn = false;
        //ClientNetProperty.Singleton.NotifyChanged((int)ClientNetProperty.ENPropertyChanged.enConnectionFailed, error.ErrorType);

        // 如果没有得到SESSION才弹提示框
        //if (false == LCMsgSender.Singleton.GotSession)
        {
            UICommonMsgBoxCfg boxCfg = new UICommonMsgBoxCfg();
            boxCfg.mainTextPrefab = "UILostConnectionLabel";
            boxCfg.buttonNum      = 1;
            UICommonMsgBox.GetInstance().ShowMsgBox(OnConnectFailedButtonClick, null, boxCfg);
        }
    }
Пример #20
0
 /// <summary>
 /// NB: this will always conver the exception to a LiftFormatException, if it isn't already
 /// </summary>
 /// <param name="error"></param>
 private void NotifyFormatError(Exception error)
 {
     if (ParsingWarning != null)
     {
         //it's important to pass this on as a format error, which the client should be expecting
         //to report without crashing.
         if (!(error is LiftFormatException))
         {
             error = new LiftFormatException(error.Message, error);
         }
         ErrorArgs e = new ErrorArgs();
         e.Exception = error;
         ParsingWarning.Invoke(this, e);
     }
 }
Пример #21
0
        static void ErrorSignalCallback(IntPtr arg0, IntPtr arg1, IntPtr gch)
        {
            ErrorArgs args = new ErrorArgs();

            try {
                GLib.Signal sig = ((GCHandle)gch).Target as GLib.Signal;
                if (sig == null)
                {
                    throw new Exception("Unknown signal GC handle received " + gch);
                }

                args.Args     = new object[1];
                args.Args [0] = GLib.Marshaller.Utf8PtrToString(arg1);
                GlibErrorHandler handler = (GlibErrorHandler)sig.Handler;
                handler(GLib.Object.GetObject(arg0), args);
            } catch (Exception e) {
                GLib.ExceptionManager.RaiseUnhandledException(e, false);
            }
        }
Пример #22
0
 private async Task OnError(ErrorArgs args, Delivery delivery)
 {
     _logger.LogWarning(args.Exception, args.Message);
     if (args.Job is not null)
     {
         var      job = args.Job;
         JobError jobError;
         if (args.Exception is null)
         {
             jobError = JobError.FromMessage(args.Message);
         }
         else
         {
             jobError = JobError.FromException(args.Exception);
         }
         job.Error(jobError);
         await _jobRepository.UpdateAsync(job, CancellationToken.None);
     }
 }
Пример #23
0
        public override bool OpenDocument(bool isReadOnly, bool suppressUI)
        {
            bool flag;

            if (this.document != null)
            {
                return(true);
            }
            KnownProjectBase project = base.Project as KnownProjectBase;

            if (project != null && project.IsDisposed)
            {
                return(false);
            }
            try
            {
                IDocument document = base.DocumentType.OpenDocument(this, base.Project, isReadOnly);
                this.SetDocument(document);
                if (project != null)
                {
                    project.OnItemOpened(new ProjectItemEventArgs(this));
                }
                return(true);
            }
            catch (IOException oException1)
            {
                IOException oException = oException1;
                if (!suppressUI)
                {
                    ErrorArgs errorArg = new ErrorArgs()
                    {
                        Message      = StringTable.ProjectItemOpenDocumentErrorMessage,
                        Exception    = oException,
                        AutomationId = "ProjectItemOpenDocumentErrorDialog"
                    };
                    base.Services.MessageDisplayService().ShowError(errorArg);
                }
                flag = false;
            }
            return(flag);
        }
Пример #24
0
        public override bool CreateDocument(string initialContents)
        {
            bool flag;

            if (this.document != null)
            {
                throw new InvalidOperationException();
            }
            if (!base.DocumentType.CanCreate)
            {
                throw new InvalidOperationException();
            }
            try
            {
                IDocument document = base.DocumentType.CreateDocument(this, base.Project, initialContents);
                this.SetDocument(document);
                bool             flag1   = this.SaveDocumentFile();
                KnownProjectBase project = base.Project as KnownProjectBase;
                if (project != null)
                {
                    project.OnItemOpened(new ProjectItemEventArgs(this));
                }
                return(flag1);
            }
            catch (IOException oException1)
            {
                IOException oException = oException1;
                ErrorArgs   errorArg   = new ErrorArgs()
                {
                    Message      = StringTable.ProjectItemOpenDocumentErrorMessage,
                    Exception    = oException,
                    AutomationId = "ProjectItemOpenDocumentErrorDialog"
                };
                base.Services.MessageDisplayService().ShowError(errorArg);
                flag = false;
            }
            return(flag);
        }
        /// <summary>
        /// When the slave raises an error, log or report the the specified error
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="type"></param>
        void validator_OnError(object sender, ErrorArgs type)
        {
            Console.WriteLine("Error has occured: {0}", type.ToString());


            switch (type.Error)
            {
            case Errors.CashboxMissing:
                setError(btnCB);
                break;

            case Errors.ChecksumError:
                // TODO
                break;

            case Errors.InvalidCommand:
                // TODO
                break;

            case Errors.PortError:
                // TODO
                break;

            case Errors.Timeout:
                // TODO
                break;

            case Errors.WriteError:
                // TODO
                break;

            case Errors.FailedToOpenPort:
                DoOnUIThread(() => MessageBox.Show("Failed to open Port"));
                break;
            }
        }
Пример #26
0
 /// <summary>
 /// Error occurred with the specified exception.
 /// </summary>
 /// <param name="ex">The exception that has occurred.</param>
 /// <param name="args">The arguments.</param>
 public override void Error(Exception ex, ErrorArgs args) { }
Пример #27
0
 /// <summary>
 /// Error occurred with the specified exception.
 /// </summary>
 /// <param name="ex">The exception that has occurred.</param>
 /// <param name="args">The arguments.</param>
 public void Error(Exception ex, ErrorArgs args) { }
Пример #28
0
 /// <summary>
 /// Error occurred with the specified exception.
 /// </summary>
 /// <param name="ex">The exception that has occurred.</param>
 /// <param name="args">The arguments.</param>
 /// <exception cref="Exception"></exception>
 public virtual void Error(Exception ex, ErrorArgs args)
 {
     throw new Exception();
 }
Пример #29
0
 static void client_Error(object sender, ErrorArgs e)
 {
     Console.WriteLine("Error {0}: {1}", e.ErrorCode, e.ErrorMessage);
 }
Пример #30
0
 /// <summary>
 /// Error method
 /// </summary>
 /// <param name="sender">Some sender </param>
 /// <param name="e">Some getter </param>
 private static void OnError(object sender, ErrorArgs e)
 {
     Console.WriteLine("Bad age value... paremetr can't be changed..." +
                       " \nThis message was generated by evenet");
 }
Пример #31
0
 private static void client_Error(object sender, ErrorArgs e)
 {
     Console.WriteLine($"Error {e.ErrorCode}: {e.ErrorMessage}");
 }
Пример #32
0
 protected virtual void OnError(ErrorArgs e)
 {
     if(Error != null)
     Error(this, e);
 }
Пример #33
0
 private void Core_onError(ErrorArgs e)
 {
     onError?.Invoke($"На этапе {e.Stage} возникла ошибка {e.Message}");
 }
Пример #34
0
 private void _broker_Error(object sender, ErrorArgs e)
 {
     _errors.Add(e.ErrorMessage);
 }
Пример #35
0
        private void p_OutputDataReceived(object sender, DataReceivedEventArgs e)
        {
            StreamWriter sw = new StreamWriter("log.log", true); sw.WriteLine(e.Data); sw.Close();
            if (!running == false)
            {
                if (program == MinerProgram.poclbm)
                {
                    if (e.Data.Contains(" "))
                    {

                        string[] split = e.Data.Split(' ');
                        if (e.Data.Length != 0)
                        {
                            if (e.Data.Length != 60)
                            {
                                if (e.Data.Contains("khash"))
                                {
                                    SpeedChangedArgs a = new SpeedChangedArgs();
                                    a.CurrentSpeed = split[0];
                                    a.TabIndex = TabIndex;

                                    this.SpeedChanged(this, a);
                                }

                                else if (e.Data.Contains("new block"))
                                {
                                    System.Net.WebClient s = new System.Net.WebClient();
                                    Stream ss = s.OpenRead("http://blockexplorer.com/q/getblockcount");
                                    StreamReader sr = new StreamReader(ss);
                                    int t;
                                    bool b = int.TryParse(sr.ReadLine().ToString(), out t);
                                    if(b)
                                        BLOCKID = t;
                                    NewBlockArgs a = new NewBlockArgs();
                                    BLOCKID++;
                                    a.BlockID = BLOCKID;
                                    a.TabIndex = TabIndex;
                                    this.NewBlock(this, a);
                                }

                                else if (e.Data.Contains("accepted"))
                                {
                                    AcceptedShareArgs a = new AcceptedShareArgs();
                                    a.TabIndex = TabIndex;
                                    ASHARES++;
                                    a.Accepted = ASHARES;
                                    this.AcceptedShare(this, a);
                                }

                                else if (e.Data.Contains("invalid"))
                                {
                                    StaleShareArgs a = new StaleShareArgs();
                                    SSHARES++;
                                    a.Stale = SSHARES;
                                    a.TabIndex = TabIndex;
                                    this.StaleShare(this, a);
                                }
                                else if ((e.Data.ToLower().Contains("rpc")) && (e.Data.ToLower().Contains("problem")))
                                {
                                    FailOverArgs a = new FailOverArgs();
                                    a.nick = nickname;
                                    a.framerate = f;
                                    a.device = d;
                                    a.worksize = w;
                                    a.vectors = v;
                                    a.pooluser = pu;
                                    a.poolpass = pp;
                                    a.phost = ph;
                                    a.TabPage = TabIndex;
                                    a.pool = pool;
                                    a.mp = program;
                                    this.FailOver(this, a);
                                }

                                else
                                {
                                    ErrorArgs a = new ErrorArgs();
                                    this.Error(this, a);
                                }

                            }
                        }
                    }
                }
            }
        }