コード例 #1
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()
            });
        }
コード例 #2
0
 public DeviceTypeSelectForm()
 {
     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);
         devList.Items.Add(new ListViewItem()
         {
             Text = attr.UserFriendlyName, ImageKey = devType.Name.ToLower(), Tag = devType
         });
     }
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: craftersmine/LVM
        static void Main()
        {
            Settings.LoggerInstance = new Logger(Environment.GetEnvironmentVariable("TEMP"), "LVM");

            Settings.LoggerInstance.Log(LogEntryType.Info, "dev-registry", "Registering standard devices...");
            DeviceTypeRegistry.RegisterDeviceType(typeof(MachineComponent));
            DeviceTypeRegistry.RegisterDeviceType(typeof(EEPROM));
            DeviceTypeRegistry.RegisterDeviceType(typeof(Screen));
            DeviceTypeRegistry.RegisterDeviceType(typeof(GPU));
            Settings.LoggerInstance.Log(LogEntryType.Done, "dev-registry", "Standard devices successfully registered!");
            DeviceTypeRegistry.RegisterDeviceTypeIcon(typeof(MachineComponent), DeviceDefaultIcons.Machine);


            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MachineLauncherForm());
        }