Exemple #1
0
        private void WriteToLog(string stateText, StateResult stateResult, Exception ex = null)
        {
            if (stateResult == StateResult.Error)
            {
                if (ex != null)
                {
                    var wrappedEx       = ex.WrapException();
                    var wrapedStateText = wrappedEx.Message;

                    _log.Error(wrapedStateText, wrappedEx);

                    new ErrorDialogView(wrapedStateText).ShowDialog();

                    stateText = wrapedStateText;
                }
                else
                {
                    _log.Error(stateText);

                    new ErrorDialogView(stateText).ShowDialog();
                }
            }

            var message = stateResult.StateResultToString() + stateText;

            _mainViewModel.Log  += message + Environment.NewLine;
            _mainViewModel.State = message;
        }