/// <summary>
 /// Captures the exception.
 /// </summary>
 /// <param name="exception">The exception.</param>
 /// <param name="title">The title.</param>
 /// <param name="buttons">The buttons.</param>
 /// <param name="icon">The icon.</param>
 /// <param name="className">Name of the class.</param>
 /// <param name="methodSignature">The method signature.</param>
 public static void CaptureException(Exception exception, string title = @"Exception Caught", MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxIcon icon = MessageBoxIcon.Error, string className = "", string methodSignature = "")
 {
     if (className != "")
     {
         ExtendedKryptonMessageBox.Show($"An unexpected error has occurred: { exception.Message }.\n\nError in class: '{ className }.cs'.", title, buttons, icon);
     }
     else if (methodSignature != "")
     {
         ExtendedKryptonMessageBox.Show($"An unexpected error has occurred: { exception.Message }.\n\nError in method: '{ methodSignature }'.", title, buttons, icon);
     }
     else if (className != "" && methodSignature != "")
     {
         ExtendedKryptonMessageBox.Show($"An unexpected error has occurred: { exception.Message }.\n\nError in class: '{ className }.cs'.\n\nError in method: '{ methodSignature }'.", title, buttons, icon);
     }
     else
     {
         ExtendedKryptonMessageBox.Show($"An unexpected error has occurred: { exception.Message }.", title, buttons, icon);
     }
 }
        private async Task RunScan(string filePath)
        {
            try
            {
                VirusTotalAPI virusTotal = new VirusTotalAPI(SettingsManager.GetVirusTotalAPIKey());

                virusTotal.UseTLS = SettingsManager.GetVirusTotalUseTLS();

                byte[] file = File.ReadAllBytes(filePath);

                FileReport report = await virusTotal.GetFileReportAsync(file);

                bool hasBeenSeenBefore = report.ResponseCode == FileReportResponseCode.Present;

                if (hasBeenSeenBefore)
                {
                    DialogResult result = ExtendedKryptonMessageBox.Show($"The file: '{ Path.GetFileName(filePath) }' has been scanned before.\nDo you want to rescan it?", "Scanning File", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                    if (result == DialogResult.Yes)
                    {
                        ScanResult scanResult = await virusTotal.ScanFileAsync(file, filePath + ".vtr");

                        ShowResults(scanResult);
                    }
                    else
                    {
                        ShowResults(report);
                    }
                }
                else
                {
                    ScanResult scanResult = await virusTotal.ScanFileAsync(file, filePath + ".vtr");

                    ShowResults(scanResult);
                }
            }
            catch (Exception exc)
            {
                ExceptionHandler.CaptureException(exc);
            }
        }
        /// <summary>
        /// Captures the exception.
        /// </summary>
        /// <param name="exception">The exception.</param>
        /// <param name="currentWindow">The current window.</param>
        /// <param name="title">The title.</param>
        /// <param name="buttons">The buttons.</param>
        /// <param name="icon">The icon.</param>
        /// <param name="className">Name of the class.</param>
        /// <param name="methodSignature">The method signature.</param>
        /// <param name="defaultTypeface">The default typeface.</param>
        public static void CaptureException(Exception exception, KryptonForm currentWindow, Control control = null, string title = @"Exception Caught", MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxIcon icon = MessageBoxIcon.Error, string className = "", string methodSignature = "", Font defaultTypeface = null)
        {
            defaultTypeface = new Font(currentWindow.Font.FontFamily, currentWindow.Font.Size, currentWindow.Font.Style, currentWindow.Font.Unit);

            if (className != "")
            {
                ExtendedKryptonMessageBox.Show($"An unexpected error has occurred: { exception.Message }.\n\nError in class: '{ className }.cs'.", title, buttons, icon, messageboxTypeface: defaultTypeface);
            }
            else if (methodSignature != "")
            {
                ExtendedKryptonMessageBox.Show($"An unexpected error has occurred: { exception.Message }.\n\nError in method: '{ methodSignature }'.", title, buttons, icon, messageboxTypeface: defaultTypeface);
            }
            else if (className != "" && methodSignature != "")
            {
                ExtendedKryptonMessageBox.Show($"An unexpected error has occurred: { exception.Message }.\n\nError in class: '{ className }.cs'.\n\nError in method: '{ methodSignature }'.", title, buttons, icon, messageboxTypeface: defaultTypeface);
            }
            else
            {
                ExtendedKryptonMessageBox.Show($"An unexpected error has occurred: { exception.Message }.", title, buttons, icon, messageboxTypeface: defaultTypeface);
            }
        }
        /// <summary>Resets to defaults.</summary>
        public void ResetToDefaults()
        {
            DialogResult result = ExtendedKryptonMessageBox.Show("WARNING! You are about to reset these settings back to their original state. This action cannot be undone!\nDo you want to proceed?", "Reset Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);

            if (result == DialogResult.Yes)
            {
                SetAlwaysElevateNewTasks(false);

                SetAlwaysShowProcessIcon(true);

                SetAlwaysShowSettingsButton(true);

                SetUseLaunchProcessArguements(false);

                SaveRunDialogSettings(GetAlwaysUsePrompt());

                if (ExtendedKryptonMessageBox.Show($"Done! Do you want to restart the application now?", "Action Complete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Application.Restart();
                }
            }
        }
Exemple #5
0
        /// <summary>
        /// Called when [clear recent files click].
        /// </summary>
        /// <param name="obj">The object.</param>
        /// <param name="evt">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void OnClearRecentFiles_Click(object obj, EventArgs evt)
        {
            try
            {
                if (UseConfirmClearListDialogue)
                {
                    if (globalMethods.CheckIfTargetPlatformIsSupported(UseConfirmClearListDialogue))
                    {
                        if (globalMethods.GetIsTargetPlatformSupported())
                        {
                            if (ExtendedKryptonMessageBox.Show("You are about to clear your recent files list. Do you want to continue?", "Clear Recent Files", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                ClearRecentFiles();
                            }
                            else if (ExtendedKryptonMessageBox.Show("You are about to clear your recent files list. Do you want to continue?", "Clear Recent Files", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                ClearRecentFiles();
                            }
                        }
                    }
                }
                else
                {
                    ClearRecentFiles();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            if (OnClearRecentFilesClick != null)
            {
                OnClearRecentFilesClick(obj, evt);
            }
        }
 private void kbtnTopMostFalse_Click(object sender, EventArgs e)
 {
     ExtendedKryptonMessageBox.Show("TopMost = False", null, new Font("Segoe UI", 9f), false);
 }
Exemple #7
0
        /// <summary>
        /// Resets to defaults.
        /// </summary>
        public void ResetToDefaults()
        {
            if (ExtendedKryptonMessageBox.Show("WARNING! You are about to reset these settings back to their original state. This action cannot be undone!\nDo you want to proceed?", "Reset Settings", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
            {
                SetBaseColour(Color.Empty);

                SetDarkColour(Color.Empty);

                SetMediumColour(Color.Empty);

                SetLightColour(Color.Empty);

                SetLightestColour(Color.Empty);

                SetCustomColourOne(Color.Empty);

                SetCustomColourTwo(Color.Empty);

                SetCustomColourThree(Color.Empty);

                SetCustomColourFour(Color.Empty);

                SetCustomColourFive(Color.Empty);

                SetCustomColourSix(Color.Empty);

                SetCustomTextColourOne(Color.Empty);

                SetCustomTextColourTwo(Color.Empty);

                SetCustomTextColourThree(Color.Empty);

                SetCustomTextColourFour(Color.Empty);

                SetCustomTextColourFive(Color.Empty);

                SetCustomTextColourSix(Color.Empty);

                SetLinkDisabledColour(Color.Empty);

                SetLinkFocusedColour(Color.Empty);

                SetLinkHoverColour(Color.Empty);

                SetLinkNormalColour(Color.Empty);

                SetLinkVisitedColour(Color.Empty);

                SetBorderColour(Color.Empty);

                SetDisabledControlColour(Color.Empty);

                SetMenuTextColour(Color.Empty);

                SetStatusStripTextColour(Color.Empty);

                SetRibbonTabTextColour(Color.Empty);

                SetDisabledTextColour(Color.Empty);

                SetFocusedTextColour(Color.Empty);

                SetNormalTextColour(Color.Empty);

                SetPressedTextColour(Color.Empty);

                SaveAllMergedColourSettings();

                if (ExtendedKryptonMessageBox.Show($"Done! Do you want to restart the application now?", "Action Complete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Application.Restart();
                }
            }
        }
Exemple #8
0
 private void kbtnMessageboxTest_Click(object sender, EventArgs e)
 {
     KryptonMessageBox.Show(this, @"Test KryptonMessagebox", @"Check Title Text Size", MessageBoxButtons.OK, MessageBoxIcon.Information);
     ExtendedKryptonMessageBox.Show(this, @"Test ExtendedKryptonMessageBox Default 12", @"Check Title Text Size", MessageBoxButtons.OK, MessageBoxIcon.Information);
     ExtendedKryptonMessageBox.Show(this, @"Test ExtendedKryptonMessageBox specified 20", @"Check Title Text Size", MessageBoxButtons.OK, MessageBoxIcon.Information, messageboxTypeface: new Font(@"Tahoma", 20F));
 }