public void Function()
    {
        BaseException bexAssert =
            new BaseException("Assert", MessageLevel.Assert);
        bexAssert.FixMessage();

        BaseException bexError =
            new BaseException("Error", MessageLevel.Error);
        bexError.FixMessage();

        BaseException bexFatalError =
            new BaseException("FatalError", MessageLevel.FatalError);
        bexFatalError.FixMessage();

        BaseException bexMessage =
            new BaseException("Message", MessageLevel.Message);
        bexMessage.FixMessage();

        BaseException bexTrace =
            new BaseException("Trace", MessageLevel.Trace);
        bexTrace.FixMessage();

        BaseException bexWarning =
            new BaseException("Warning", MessageLevel.Warning);
        bexWarning.FixMessage();

        CommandLineInterpreter oCLI = new CommandLineInterpreter();
        oCLI.Execute("SystemErrDialog");

        return;
    }
Exemplo n.º 2
0
        public static void WriteExceptionToMessages(Exception exception, string name)
        {
            BaseException bexError = new BaseException(
                $"{nameof(name)}: {exception}", MessageLevel.Error);

            bexError.FixMessage();
        }
Exemplo n.º 3
0
    public void Function()
    {
        Eplan.EplApi.Base.BaseException bexAssert = new BaseException("Assert", MessageLevel.Assert);
        bexAssert.FixMessage();

        Eplan.EplApi.Base.BaseException bexError = new BaseException("Error", MessageLevel.Error);
        bexError.FixMessage();

        Eplan.EplApi.Base.BaseException bexFatalError = new BaseException("FatalError", MessageLevel.FatalError);
        bexFatalError.FixMessage();

        Eplan.EplApi.Base.BaseException bexMessage = new BaseException("Message", MessageLevel.Message);
        bexMessage.FixMessage();

        Eplan.EplApi.Base.BaseException bexTrace = new BaseException("Trace", MessageLevel.Trace);
        bexTrace.FixMessage();

        Eplan.EplApi.Base.BaseException bexWarning = new BaseException("Warning", MessageLevel.Warning);
        bexWarning.FixMessage();

        CommandLineInterpreter oCLI = new CommandLineInterpreter();

        oCLI.Execute("SystemErrDialog");

        return;
    }
        private void Execute_OnClick(object sender, RoutedEventArgs e)
        {
            var results = CompileAssembly(editControl1.Text);

            if (!results.Errors.HasErrors)
            {
                InvokeMethod(results.CompiledAssembly);
            }
            else
            {
                foreach (CompilerError compilerError in results.Errors)
                {
                    var baseException = new BaseException(compilerError.ErrorText, MessageLevel.Error);
                    baseException.FixMessage();
                }
            }
        }
        private void InvokeMethod(Assembly assembly)
        {
            Object     obj     = assembly.CreateInstance("Foo.Bar");
            MethodInfo execute = assembly.GetType("Foo.Bar").GetMethod("Execute");

            try
            {
                execute.Invoke(obj, null);
            }
            catch (Exception exception)
            {
                if (exception.InnerException != null)
                {
                    var baseException = new BaseException(exception.InnerException.Message, MessageLevel.Error);
                    baseException.FixMessage();
                }
                else
                {
                    var baseException = new BaseException(exception.Message, MessageLevel.Error);
                    baseException.FixMessage();
                }
            }
        }
Exemplo n.º 6
0
        public static void WriteSystemMessage(string message, MessageLevel level)
        {
            var bexError = new BaseException(message, level);

            bexError.FixMessage();
        }
Exemplo n.º 7
0
        public static void HandleException(Exception exception, string name, UndoStep undoStep = null)
        {
            Decider decider = new Decider();

            string message;

            if (undoStep == null)
            {
                message = "Es ist ein Fehler beim Erzeugen aufgetreten:";
            }
            else
            {
                message = "Es ist ein Fehler beim Erzeugen aufgetreten. Soll die Aktion rückgängig gemacht werden?";
            }

            string        errorText;
            StringBuilder sb = new StringBuilder();

            switch (exception)
            {
            case LockingException e:
                string[] failedLockingObjects = e.GetAllFailed2LockAsString();
                foreach (var id in failedLockingObjects)
                {
                    var storableObject = StorableObject.FromStringIdentifier(id);
                    sb.AppendLine(storableObject.GetType().ToString());
                }

                errorText = $"{message}{Environment.NewLine}{exception.Message}{Environment.NewLine}{Environment.NewLine}{sb}{Environment.NewLine}";
                break;

            default:
                errorText = $"{message}{Environment.NewLine}{exception.Message}{Environment.NewLine}{Environment.NewLine}";
                break;
            }

            // Log
            BaseException bexError = new BaseException($"{name}: {errorText}{Environment.NewLine}{exception}", MessageLevel.Error);

            bexError.FixMessage();

            // Show
            EnumDecisionReturn decision;

            if (undoStep != null)
            {
                decision = decider.Decide(EnumDecisionType.eYesNoDecision, errorText,
                                          name, EnumDecisionReturn.eYES,
                                          EnumDecisionReturn.eYES, name, false, EnumDecisionIcon.eFATALERROR);
            }
            else
            {
                decision = decider.Decide(EnumDecisionType.eOkDecision, errorText,
                                          name, EnumDecisionReturn.eOK,
                                          EnumDecisionReturn.eOK, name, false, EnumDecisionIcon.eFATALERROR);
            }
            switch (decision)
            {
            case EnumDecisionReturn.eYES:
                undoStep?.DoUndo();
                break;
            }
        }
 private static void BaseExceptionError(string error)
 {
     Eplan.EplApi.Base.BaseException bexMessage = new BaseException(error, MessageLevel.Error);
     bexMessage.FixMessage();
 }
 private static void BaseExceptionMessage(string message)
 {
     Eplan.EplApi.Base.BaseException bexMessage = new BaseException(message, MessageLevel.Message);
     bexMessage.FixMessage();
 }
Exemplo n.º 10
0
 private static void AddSystemMessage(BaseException baseException)
 {
     baseException.FixMessage();
 }
 private static void BaseExceptionMessage(string message)
 {
     Eplan.EplApi.Base.BaseException bexMessage = new BaseException(message, MessageLevel.Message);
     bexMessage.FixMessage();
 }
 private static void BaseExceptionError(string error)
 {
     Eplan.EplApi.Base.BaseException bexMessage = new BaseException(error, MessageLevel.Error);
     bexMessage.FixMessage();
 }