private void updateCell(int index) { switch (index) { case 0: Cells[0].Value = pif.Name(); break; case 1: Cells[1].Value = pif.MAC; break; case 2: Cells[2].Value = pif.Carrier() ? Messages.CONNECTED : Messages.DISCONNECTED; break; case 3: Cells[3].Value = pif.Carrier() ? pif.Speed() : Messages.HYPHEN; break; case 4: Cells[4].Value = pif.Carrier() ? pif.Duplex() : Messages.HYPHEN; break; case 5: Cells[5].Value = vendor; break; case 6: Cells[6].Value = device; break; case 7: Cells[7].Value = busPath; break; case 8: Cells[8].Value = pif.FCoECapable().ToYesNoStringI18n(); break; } }
private void Update() { _cellName.Value = Pif.Name(); _cellMac.Value = Pif.MAC; _cellConnected.Value = Pif.Carrier() ? Messages.CONNECTED : Messages.DISCONNECTED; _cellSpeed.Value = Pif.Carrier() ? Pif.Speed() : Messages.HYPHEN; _cellDuplex.Value = Pif.Carrier() ? Pif.Duplex() : Messages.HYPHEN; var pifMetrics = Pif.PIFMetrics(); _cellVendor.Value = pifMetrics == null ? Messages.HYPHEN : pifMetrics.vendor_name; _cellDevice.Value = pifMetrics == null ? Messages.HYPHEN : pifMetrics.device_name; _cellBusPath.Value = pifMetrics == null ? Messages.HYPHEN : pifMetrics.pci_bus_path; _cellFcoe.Value = Pif.FCoECapable().ToYesNoStringI18n(); if (!Pif.SriovCapable()) { _cellSriov.Value = Messages.NO; } else if (!Pif.IsSriovPhysicalPIF()) { _cellSriov.Value = Messages.SRIOV_NETWORK_SHOULD_BE_CREATED; } else { var networkSriov = Pif.Connection.Resolve(Pif.sriov_physical_PIF_of[0]); if (networkSriov == null || networkSriov.requires_reboot) { _cellSriov.Value = Messages.HOST_NEEDS_REBOOT_ENABLE_SRIOV; return; } PIF sriovLogicalPif = Pif.Connection.Resolve(networkSriov.logical_PIF); if (sriovLogicalPif == null || !sriovLogicalPif.currently_attached) { _cellSriov.Value = Messages.SRIOV_LOGICAL_PIF_UNPLUGGED; return; } var sriovSupported = ""; var action = new DelegatedAsyncAction(Pif.Connection, "", "", "", delegate(Session session) { try { var remainingCapacity = Network_sriov.get_remaining_capacity(session, Pif.sriov_physical_PIF_of[0].opaque_ref); sriovSupported = string.Format(Messages.REMAINING_VFS, remainingCapacity); } catch { sriovSupported = Messages.YES; } }, true); action.Completed += delegate { Program.Invoke(Program.MainWindow, () => _cellSriov.Value = sriovSupported); }; action.RunAsync(); } }
private void updateCell(int index) { switch (index) { case 0: Cells[0].Value = pif.Name(); break; case 1: Cells[1].Value = pif.MAC; break; case 2: Cells[2].Value = pif.Carrier() ? Messages.CONNECTED : Messages.DISCONNECTED; break; case 3: Cells[3].Value = pif.Carrier() ? pif.Speed() : Messages.HYPHEN; break; case 4: Cells[4].Value = pif.Carrier() ? pif.Duplex() : Messages.HYPHEN; break; case 5: Cells[5].Value = vendor; break; case 6: Cells[6].Value = device; break; case 7: Cells[7].Value = busPath; break; case 8: Cells[8].Value = pif.FCoECapable().ToYesNoStringI18n(); break; case 9: string sriovSupported = ""; if (!pif.SriovCapable() || !pif.IsSriovPhysicalPIF()) { sriovSupported = !pif.SriovCapable() ? Messages.NO : Messages.SRIOV_DISABLED; Cells[9].Value = sriovSupported; } else { DelegatedAsyncAction action = new DelegatedAsyncAction(pif.Connection, "", "", "", delegate(Session session) { try { var remainingCapacity = Network_sriov.get_remaining_capacity(session, pif.sriov_physical_PIF_of[0].opaque_ref); sriovSupported = string.Format(Messages.REAMININF_VFS, remainingCapacity); } catch { sriovSupported = Messages.YES; } }, true); action.Completed += delegate { Program.Invoke(Program.MainWindow, delegate { Cells[9].Value = sriovSupported; }); }; action.RunAsync(); } break; } }