コード例 #1
0
        public void DisplayEEPROM()
        {
            //if (_eeprom == null)
            {
                //_eeprom = new EEPROM();
                //_eeprom.ReadEEPROM(version.Bytes_To_Read_Write);
                TabControl  tb       = new TabControl();
                FieldInfo[] fieldInf = _eeprom.GetType().GetFields();
                for (int i = 0; i < fieldInf.Length; i++)
                {
                    TabPage tbPage = new TabPage();

                    FieldInfo[] tempInf = fieldInf[i].FieldType.GetFields(System.Reflection.BindingFlags.Public | BindingFlags.Instance);
                    string      output  = "";
                    //This below foreach has been added by Darshan on 08-09-2015 to solve Defect no 0000631: The spaces are not left for the Labels in settings window.
                    foreach (char letter in fieldInf[i].FieldType.Name)
                    {
                        if (Char.IsUpper(letter) && output.Length > 0)
                        {
                            output += " " + letter;
                        }
                        else
                        {
                            output += letter;
                        }
                    }
                    vIndent = 10;

                    tbPage.Text       = output;
                    tbPage.AutoScroll = true;
                    addLeaf(tempInf, tbPage.Text, 1, tbPage);
                    tb.Controls.Add(tbPage);
                }
                tb.Multiline = true;
                tb.Dock      = DockStyle.Fill;
                this.Controls.Add(tb);
            }
        }
コード例 #2
0
        public MachineCreateForm()
        {
            InitializeComponent();
            foreach (var devType in DeviceTypeRegistry.GetRegisteredDeviceTypes(out string[] types))
            {
                var attr = devType.GetCustomAttribute <DeviceComponentAttribute>();
                var icon = DeviceTypeRegistry.GetDeviceTypeIcon(devType.Name.ToLower());
                icons.Images.Add(devType.Name.ToLower(), icon);
            }

            machineComp = Machine.CreateDevice <MachineComponent>();
            eeprom      = Machine.CreateDevice <EEPROM>();
            scr         = Machine.CreateDevice <Screen>();
            gpu         = Machine.CreateDevice <GPU>();


            devices.Items.Add(new ListViewItem()
            {
                Text = machineComp.GetComponentAttribute().UserFriendlyName, Tag = machineComp, ImageKey = machineComp.GetType().Name.ToLower()
            });
            devices.Items.Add(new ListViewItem()
            {
                Text = eeprom.GetComponentAttribute().UserFriendlyName, Tag = eeprom, ImageKey = eeprom.GetType().Name.ToLower()
            });
            devices.Items.Add(new ListViewItem()
            {
                Text = scr.GetComponentAttribute().UserFriendlyName, Tag = scr, ImageKey = scr.GetType().Name.ToLower()
            });
            devices.Items.Add(new ListViewItem()
            {
                Text = gpu.GetComponentAttribute().UserFriendlyName, Tag = gpu, ImageKey = gpu.GetType().Name.ToLower()
            });
        }