예제 #1
0
        /// <summary>
        /// Background worker compile counters
        /// </summary>
        /// <param name="sender">Sender object</param>
        /// <param name="e">Work event args</param>
        private void backgroundWorker_CompileCounters(object sender, DoWorkEventArgs e)
        {
            // Get the BackgroundWorker that raised this event.
            BackgroundWorker worker = sender as BackgroundWorker;

            var args = e.Argument as BackgroundWorkerArgs;

            DisplayMessageHandler("\nCompiling API " + args.api + " for GPU Family " + args.gpu);

            _counterCompiler.CompileCounters(args.api, args.gpu, DisplayMessageHandler, ErrorHandler);
        }
예제 #2
0
        /// <summary>
        /// Ensures that the apiName and GPUFamily fields are not empty, then
        /// compiles the associated counters
        /// </summary>
        /// <param name="sender">the compile button</param>
        /// <param name="e">default event args</param>
        private void CompileButton_Click(object sender, EventArgs e)
        {
            richTextBoxOutput.Text = "";

            string api = apiName.Text.Trim();
            string gpu = GPUFamily.Text.Trim();

            if (string.IsNullOrEmpty(api) ||
                string.IsNullOrEmpty(gpu))
            {
                MessageBox.Show("Required data not provided.\nPlease fill in all the fields on the form.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Registry.SetValue(registryKey, registryApiEntry, api);

            Registry.SetValue(registryKey, registryGpuFamilyEntry, gpu);

            // For compatibility with InternalCounterCompiler project
            if (false == counterCompiler.CompileCounters(api, gpu, DisplayMessageHandler, ErrorHandler))
            {
                ErrorHandler("Failed to compile counters");
            }
        }