示例#1
0
        private static PageLinker GetInstance()
        {
            if (instance == null)
            {
                instance = new PageLinker();
            }

            return(instance);
        }
示例#2
0
        private async Task _ShowAlert(
            Exception e)
        {
            Error error = this.GetErrorByException(e);

            error.Id = -1;

            await PageLinker.ShowAlert(ERROR_INFO, error);
        }
示例#3
0
        /// <summary>
        /// Write an error into the log right now, without have to invoke AddError method
        /// Usually used outside actions logic, for example trying to detect and connect with a puck
        /// </summary>
        /// <param name="e">Exception launched</param>
        private void _LogErrorNow(
            Exception e,
            int portIndex)
        {
            Error error = this.AddErrorByException(e, portIndex);

            PageLinker.ShowAlert(ERROR_TITLE, error);

            this.logger.LogError();
        }
示例#4
0
        /// <summary>
        /// Writes the errors registered with AddError method. It is almost the same as
        /// the _LogErrorNow method but using the last registered error for the alert pop-up
        /// </summary>
        private void _LogRegisteredErrors(
            bool forceException)
        {
            if (this.errorsToLog.Count > 0)
            {
                Error error = this.errorsToLog[this.errorsToLog.Count - 1];
                PageLinker.ShowAlert(ERROR_TITLE, this.lastError);

                lastErrorLogGenerated = this.logger.Error();

                if (forceException)
                {
                    throw error.Exception;
                }
            }
        }
示例#5
0
        /// <summary>
        /// Write an error into the log right now, without have to invoke AddError method
        /// Usually used outside actions logic, for example trying to detect and connect with a puck
        /// </summary>
        /// <param name="e">Exception that represents the last error happened</param>
        private void _LogErrorNow(
            Exception e,
            int portIndex,
            bool forceException,
            bool kill = false)
        {
            Error error = this.AddErrorByException(e, portIndex);

            PageLinker.ShowAlert(ERROR_TITLE, error, kill);

            // Method can be invoked when Configuration is not instantiated yet
            if (Singleton.Has <Configuration> ())
            {
                lastErrorLogGenerated = this.logger.Error();
            }

            if (forceException)
            {
                throw error.Exception;
            }
        }
示例#6
0
        /// <summary>
        /// Write errors registered using AddError method
        /// Usually used when performing an action
        /// </summary>
        private void _LogRegisteredErrors(
            bool forceException,
            Exception e)
        {
            if (this.errorsToLog.Count > 0)
            {
                //Error lastError = ( Error )this.errorsToLog[ this.errorsToLog.Count - 1 ].Clone ();
                Exception lastException = (e != null) ? e : this.errorsToLog[this.errorsToLog.Count - 1].Exception;

                if (forceException)
                {
                    PageLinker.ShowAlert(ERROR_TITLE, this.lastError);
                }

                this.logger.LogError();

                if (forceException)
                {
                    throw lastException;
                }
            }
        }