Ejemplo n.º 1
0
        private static void WorkException(Exception ex)
        {
            // На всякий случай
            try
            {
                Form parentForm = null;
                if (FormManager.MainForm != null && !FormManager.MainForm.IsDisposed)
                {
                    parentForm = FormManager.MainForm;
                }

                if (ex.IsAssignableTo(typeof(UserException)))
                {
                    MessageBox.Show(parentForm, ex.Message, FormManager.AppCaptionName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    if (Log != null)
                    {
                        Log.Write(LogMessageType.Error, ex.GetDebugInformation());
                    }
                    FormError.TryShow(parentForm, ex);
                }
            }
            catch { }
        }