private void InitializeOpenWithSpecifiedDefinitionMenu() { var hierarchy = FirmwareDefinitionManager.CreateHierarchy(m_definitions); OpenUsingSpecifiedDefinitionMenuItem.DropDownItems.Clear(); foreach (var deviceKvp in hierarchy) { var deviceMenu = new ToolStripMenuItem(deviceKvp.Key, OpenUsingSpecifiedDefinitionMenuItem.Image); foreach (var definitionKvp in deviceKvp.Value) { var kvp = definitionKvp; var definition = kvp.Value; deviceMenu.DropDownItems.Add(definitionKvp.Key, deviceMenu.Image, (s, e) => { OpenDialogAndReadFirmwareOnOk(definition.Name, fileName => m_loader.TryLoadUsingDefinition(fileName, definition)); }); } OpenUsingSpecifiedDefinitionMenuItem.DropDownItems.Add(deviceMenu); } }
private void LoadSettings() { m_configuration = m_configurationManager.Load(); Size = new Size(m_configuration.MainWindowWidth, m_configuration.MainWindowHeight); WindowState = m_configuration.MainWindowMaximaged ? FormWindowState.Maximized : FormWindowState.Normal; LoadTabSettings(); m_definitions = m_firmwareDefinitionManager.Load(); foreach (var definition in m_definitions) { var firmwareDefinition = definition; OpenUsingSpecifiedDefinitionMenuItem.DropDownItems.Add(definition.Name, OpenUsingSpecifiedDefinitionMenuItem.Image, (s, e) => { OpenDialogAndReadFirmwareOnOk(firmwareDefinition.Name, fileName => m_loader.TryLoadUsingDefinition(fileName, firmwareDefinition)); }); } }
private void InitializeOpenWithSpecifiedDefinitionMenu() { OpenUsingSpecifiedDefinitionMenuItem.DropDownItems.Clear(); foreach (var definition in m_definitions) { var firmwareDefinition = definition; OpenUsingSpecifiedDefinitionMenuItem.DropDownItems.Add(definition.Name, OpenUsingSpecifiedDefinitionMenuItem.Image, (s, e) => { OpenDialogAndReadFirmwareOnOk(firmwareDefinition.Name, fileName => m_loader.TryLoadUsingDefinition(fileName, firmwareDefinition)); }); } }