private void ButLog_Click(object sender, EventArgs e)
        {
            if (_isMonitoring)
            {
                MsgBox.Show(this, "Stop monitoring queries before creating a log.");
                return;
            }
            if (_dictQueries.Count == 0)
            {
                MsgBox.Show(this, "No queries in the Query Feed to log.");
                return;
            }
            if (ODBuild.IsWeb())
            {
                MsgBox.Show(this, "Logging not supported for the Web version at this time.");
                return;
            }
            if (!MsgBox.Show(MsgBoxButtons.YesNo, Lan.g(this, "Log all queries to a file?  Total query count") + $": {_dictQueries.Count.ToString("N0")}"))
            {
                return;
            }
            string logFolderPath = "QueryMonitorLogs";
            string logFileName   = "";

            try {
                //Create the query monitor log folder in the AtoZ image path.
                if (!OpenDentBusiness.FileIO.FileAtoZ.DirectoryExistsRelative(logFolderPath))
                {
                    OpenDentBusiness.FileIO.FileAtoZ.CreateDirectoryRelative(logFolderPath);
                }
                //Get a unique file name within the log folder.
                logFileName = $"QueryMonitorLog_{DateTime.Now.ToString("yyyyMMdd_HHmmss")}.txt";
                while (OpenDentBusiness.FileIO.FileAtoZ.ExistsRelative(logFolderPath, logFileName))
                {
                    logFileName = $"QueryMonitorLog_{DateTime.Now.ToString("yyyyMMdd_HHmmss")}.txt";
                    Thread.Sleep(100);
                }
                //Dump the entire query history into the log file.
                OpenDentBusiness.FileIO.FileAtoZ.WriteAllTextRelative(logFolderPath, logFileName,
                                                                      $"Query Monitor Log - {DateTime.Now.ToString()}\r\n{string.Join("\r\n",_dictQueries.Values.Select(x => x.ToString()))}");
            }
            catch (ODException ode) {
                MsgBox.Show(ode.Message);
                return;
            }
            catch (Exception ex) {
                MsgBox.Show(Lan.g(this, "Error creating log file") + $":\r\n{ex.Message}");
                return;
            }
            if (MsgBox.Show(this, MsgBoxButtons.YesNo, "Log file created.  Would you like to open the file?"))
            {
                try {
                    FileAtoZ.StartProcessRelative(logFolderPath, logFileName);
                }
                catch (Exception ex) {
                    MsgBox.Show(Lan.g(this, "Could not open log file") + $":\r\n{ex.Message}");
                }
            }
        }