Exemple #1
0
        private void CopyButton_Click(object sender, EventArgs e)
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendLine(CallerName);
            try
            {
                int index = 1;
                foreach (ListViewItem item in exceptionListView.Items)
                {
                    if (builder.Length > 0)
                    {
                        builder.AppendLine();
                    }
                    Exception exception = (Exception)item.Tag;
                    builder.AppendLine($"[{index++}] {exception}");
                    string stackTrace = exception.StackTrace;
                    if (!string.IsNullOrEmpty(stackTrace))
                    {
                        builder.AppendLine("StackTrace:");
                        builder.AppendLine($"{stackTrace}");
                    }
                }
                Clipboard.SetText(builder.ToString());
            }
            catch (BaseException ex)
            {
                ExceptionDialog.Show(ex);
            }
        }
Exemple #2
0
        // ----------------------------------------------------------------------------------------
        #region BaseForm

        /// <summary>
        /// The window location and size is loaded from XmlSettings
        /// </summary>
        //[DebuggingCheck(Action = CheckAction.Exit)]
        //[TamperCheck(Action = CheckAction.Exit)]
        private void BaseForm_Load(object sender, EventArgs e)
        {
            //if (CustomTampering.HasBeenTampered)
            //{
            //    NotificationForm.ShowNotification("BaseForm_Load: Tamper detected", 500);
            //    //Close();
            //    //return;
            //}
            //if (CustomTampering.IsBeingDebugged)
            //{
            //    NotificationForm.ShowNotification("BaseForm_Load: Debugger detected", 500);
            //    //Close();
            //    //return;
            //}
            try
            {
                if (!DesignMode)
                {
                    LoadSettingsFromDocument();
                }
            }
            catch (BaseException ex)
            {
                ExceptionDialog.Show(ex);
            }
        }
Exemple #3
0
        public static void Show(Exception exception, [CallerMemberName] string callerName = null)
        {
            if (string.IsNullOrEmpty(callerName))
            {
                StackTrace stackTrace = new StackTrace();
                MethodBase methodBase = stackTrace.GetFrame(1).GetMethod();
                callerName = methodBase.Name;
            }
            bool debugging = Debugger.IsAttached;

            if (debugging)
            {
                using (ExceptionDialog exceptionDialog = new ExceptionDialog
                {
                    Exception = exception,
                    CallerName = callerName,
                })
                {
                    exceptionDialog.ShowDialog();
                }
            }
            else
            {
                while (exception.InnerException != null)
                {
                    exception = exception.InnerException;
                }
                string caption = exception is BaseException baseException ? $"Error {baseException.ErrorCode}" : "Error";
                string message = exception.Message;
                MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #4
0
 private void ClearButton_Click(object sender, EventArgs e)
 {
     try
     {
         Clear();
     }
     catch (BaseException ex)
     {
         ExceptionDialog.Show(ex);
     }
 }
Exemple #5
0
 private void InsertButton_Click(object sender, EventArgs e)
 {
     try
     {
         Insert(layersListBox.SelectedIndex);
     }
     catch (BaseException ex)
     {
         ExceptionDialog.Show(ex);
     }
 }
Exemple #6
0
 private void RandomizePointButton_Click(object sender, EventArgs e)
 {
     try
     {
         RandomizePoint();
     }
     catch (Exception ex)
     {
         ExceptionDialog.Show(ex);
     }
 }
Exemple #7
0
 private void TestConjugateGradientButton_Click(object sender, EventArgs e)
 {
     try
     {
         ConjugateGradient();
     }
     catch (Exception ex)
     {
         ExceptionDialog.Show(ex);
     }
 }
Exemple #8
0
 private void TestSteepestDescentButton_Click(object sender, EventArgs e)
 {
     try
     {
         SteepestDescent();
     }
     catch (Exception ex)
     {
         ExceptionDialog.Show(ex);
     }
 }
Exemple #9
0
 private void OKButton1_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult = DialogResult.OK;
         Close();
     }
     catch (BaseException ex)
     {
         ExceptionDialog.Show(ex);
     }
 }
Exemple #10
0
 /// <summary>
 /// The window location and size is saved to XmlSettings
 /// </summary>
 private void BaseForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     try
     {
         if (!DesignMode)
         {
             SaveSettingsToDocument();
         }
     }
     catch (BaseException ex)
     {
         ExceptionDialog.Show(ex);
     }
 }
Exemple #11
0
 private void BugsButton_Click(object sender, EventArgs e)
 {
     try
     {
         using (BugForm form = new BugForm())
         {
             form.ShowDialog(this);
         }
     }
     catch (Exception ex)
     {
         ExceptionDialog.Show(ex);
     }
 }
Exemple #12
0
 private void IdleTimer_Tick(object sender, EventArgs e)
 {
     try
     {
         if (disableIdle)
         {
             return;
         }
         Idle();
     }
     catch (Exception ex)
     {
         disableIdle = true;
         ExceptionDialog.Show(ex);
     }
 }
Exemple #13
0
        // ----------------------------------------------------------------------------------------
        #region BaseObject

        #endregion
        // ----------------------------------------------------------------------------------------
        #region BaseDialog

        #endregion
        // ----------------------------------------------------------------------------------------
        #region NetworkDialog

        private void NeuronsTextBox_ValueChanged(object sender, EventArgs e)
        {
            try
            {
                int n = neuronsTextBox.Value;
                Layer.Clear();
                for (int i = 0; i < n; i++)
                {
                    Layer.Add(new Sigmoid());
                }
            }
            catch (BaseException ex)
            {
                ExceptionDialog.Show(ex);
            }
        }
Exemple #14
0
        // ----------------------------------------------------------------------------------------
        #region BaseForm

        #endregion
        // ----------------------------------------------------------------------------------------
        #region NotificationForm

        private async void NotificationForm_Load(object sender, EventArgs e)
        {
            try
            {
                DialogResult = DialogResult.None;
                Task  task = Task.Run(() => Thread.Sleep(Duration));
                await task;
                DialogResult = DialogResult.OK;
            }
            catch (BaseException ex)
            {
                ExceptionDialog.Show(ex);
            }
            finally
            {
                //Close();
            }
        }
Exemple #15
0
        // ----------------------------------------------------------------------------------------
        #region BaseForm

        #endregion
        // ----------------------------------------------------------------------------------------
        #region BaseDialog

        #endregion
        // ----------------------------------------------------------------------------------------
        #region CalculationSettingsForm

        private void DefaultButton_Click(object sender, EventArgs e)
        {
            try
            {
                const string            message = "The settings will be changed to default values. Continue?";
                const string            caption = "Settings";
                const MessageBoxButtons buttons = MessageBoxButtons.OKCancel;
                if (MessageBox.Show(message, caption, buttons) == DialogResult.Cancel)
                {
                    return;
                }
                Settings = Settings?.DefaultSettings();
            }
            catch (Exception ex)
            {
                ExceptionDialog.Show(ex);
            }
        }