/// <summary> /// Resets the TestPanel application /// </summary> void ResetApplication() { try { // disable all test buttons DisableTestButtons(); // clear the graphics card ComboBox text GraphicsCardComboBox.Text = ""; // clear out the graphics card ComboBox GraphicsCardComboBox.Items.Clear(); // reset all static variables s_graphicsCard = null; s_numOfGpus = 0; s_selectedGpu = 0; // get any Nvidia graphics cards to test s_numOfGpus = GetNvidiaGraphicsCards(); // iterate through the total number of Nvidia GPUs and // add them to the graphics card ComboBox for (uint i = 0; i < s_numOfGpus; i++) { GraphicsCardComboBox.Items.Add(s_graphicsCard.GetName(i)); } } catch (Exception ex) { // let the user know an error occurred resetting the application throw new Exception("ERROR: " + ex.Message); } }
public Computer ( IMotherboard motherboard, IRam ram, IGraphicsCard graphicsCard, IHardDiskDrive hdd, ICPU cpu ) { this.motherboard = motherboard; this.ram = ram; this.graphicsCard = graphicsCard; this.hdd = hdd; this.cpu = cpu; }
/// <summary> /// Initializes the Nvidia GPU API and gets the total number of Nvidia graphics cards available to test /// </summary> /// <returns>The total number of Nvidia graphics cards that are testable</returns> uint GetNvidiaGraphicsCards() { uint numNvidiaCards = 0; // try to get all Nvidia graphics cards available to test try { // instantiate a new NvidiaGraphicsCard object s_graphicsCard = new NvidiaGraphicsCard(); // initialize the graphics card API // if the API does not initialize, throw an exception if (!s_graphicsCard.InitializeApi()) { // let the user know an error occurred initializing the API throw new Exception("Nvidia API failed to initialize."); } // initialize all GPU handlers // if GPUs could not be initialized, throw an exception if (!s_graphicsCard.InitializeHandlers()) { // let the user know an error occurred initializing the GPU handlers throw new Exception("Could not initialize Nvidia GPU handlers."); } // get the total number of GPUs in the system numNvidiaCards = s_graphicsCard.GetNumHandlers(); } catch (Exception ex) { // an error occurred when trying to get all Nvidia graphics cards installed // display a message to the user to let them know that no graphics cards could be found MessageBox.Show(ex.Message + ". No Nvidia graphics cards to test."); } // return the number of Nvidia graphics cards are in the system return(numNvidiaCards); }
public ComputerBuilder GraphicsCard(IGraphicsCard graphicsCard) { this.graphicsCard = graphicsCard; return(this); }