public void ImportDroppedFile(string filename) { var deviceList = GetDevicesInEagleModel(filename); string device; if (deviceList.Count == 1) { device = deviceList.First(); } else { var dp = new CyPhyComponentAuthoring.GUIs.EagleDevicePicker(deviceList); dp.ShowDialog(); if (String.IsNullOrWhiteSpace(dp.selectedDevice)) { LogMessage("Eagle device selection was cancelled.", CyPhyGUIs.SmartLogger.MessageType_enum.Error); disposeLogger(); return; } device = dp.selectedDevice; } ImportSelectedEagleDevice(device, filename); }
public void ImportEagleModel(CyPhy.Component component, IWin32Window owner = null) { String eagleFilePath = ""; // Open file dialog box DialogResult dr; using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.CheckFileExists = true; ofd.DefaultExt = "test.mdl"; ofd.Multiselect = false; ofd.Filter = "SCH and LBR files (*.sch, *.lbr)|*.sch;*.lbr|All files (*.*)|*.*"; dr = ofd.ShowDialog(owner); if (dr == DialogResult.OK) { eagleFilePath = ofd.FileName; } else { LogMessage("No file was selected. Eagle Schematic Import will not complete.", CyPhyGUIs.SmartLogger.MessageType_enum.Error); disposeLogger(); return; } } var deviceList = GetDevicesInEagleModel(eagleFilePath); var dp = new CyPhyComponentAuthoring.GUIs.EagleDevicePicker(deviceList); dp.ShowDialog(); if (String.IsNullOrWhiteSpace(dp.selectedDevice)) { LogMessage("Eagle device selection was cancelled.", CyPhyGUIs.SmartLogger.MessageType_enum.Error); disposeLogger(); return; } ImportSelectedEagleDevice(dp.selectedDevice, eagleFilePath); }