public NewTab(string name, TabControl current_tc, string file_name, Form1 mainForm) { //Get the current form mainform = mainForm; //Init new TabPage to the TabControl tab_name = name; //Try to extract the given filepath UnzipCDTAsync(file_name); //Try to get information getSysInformation gsi = new getSysInformation($"{extract_path}"); getAgentInformation gai = new getAgentInformation($"{extract_path}", gsi.getSysArch()); //Add all the previous elements to the new tab page current_tc.TabPages.Add(tab_name, tab_name); loadContent(current_tc.TabPages[tab_name]); //Add some default file paths to the CDT new_tab.extract_path = extract_path; new_tab.full_path = full_path; //Populate the tabs loadSysInformation(gsi, current_tc.TabPages[tab_name]); loadAgentInformation(gai, current_tc.TabPages[tab_name]); //Set focus to the new tab page current_tc.SelectedTab = current_tc.TabPages[tab_name]; }
private void loadSysInformation(getSysInformation gsi, TabPage tp) { TabControl tc = (TabControl)tp.Controls["TabSystem"]; TabPage page = (TabPage)tc.TabPages["tab_SystemInfo"]; page.Controls["lblHostname_value"].Text = gsi.getHostname(); //Host name page.Controls["lblIPAddress_value"].Text = gsi.getIpAdd(); //Ip Address page.Controls["lblGateway_value"].Text = gsi.getGateway(); //Gateway page.Controls["lblDns_value"].Text = gsi.getDNS(); //DNS page.Controls["lblOperatingSystem_value"].Text = gsi.getOS(); //OS page.Controls["lblOSver_value"].Text = gsi.getOSver(); //OS Version page.Controls["lblSystemArchitecture_value"].Text = gsi.getSysArch(); //System Architecture page.Controls["lblCPU_value"].Text = gsi.getCPU(); //CPU page.Controls["lblRam_value"].Text = gsi.getRAM(); //RAM page.Controls["lblFreeDiskSpace_value"].Text = gsi.getDiskSpace(); //Free Disk Space //NOTE: Currently, disk space can only print free disk space of FIRST disk drive }