/// <summary> /// Comverts a <see cref="VirtualSwitch"/> into a <see cref="GrpcVirtualSwitch"/>. /// </summary> /// <param name="virtualSwitch">The input.</param> /// <returns>The output.</returns> public static GrpcVirtualSwitch?ToProto(this VirtualSwitch virtualSwitch) { if (virtualSwitch == null) { return(null); } return(new GrpcVirtualSwitch( name: virtualSwitch.Name, type: NeonHelper.EnumToString(virtualSwitch.Type))); }
private void VirtualSwitchChecker() { try { ChangeStatus(CheckModule.CreateVirtualSwitch, VirtualSwitch.VirtualSwitchExist()); } catch (Exception ex) { logger.Debug(ex.ToString()); MessageBox.Show("Virtual Switch Error:" + ex.Message); } }
public VirtualSwitch CreateSwitch(string name) { try { Log.WriteStart("'{0}' CreateSwitch", ProviderSettings.ProviderName); VirtualSwitch result = VirtualizationProvider.CreateSwitch(name); Log.WriteEnd("'{0}' CreateSwitch", ProviderSettings.ProviderName); return(result); } catch (Exception ex) { Log.WriteError(String.Format("'{0}' CreateSwitch", ProviderSettings.ProviderName), ex); throw; } }
private void CreateSwitch_Click(object sender, EventArgs e) { CheckedListBox.CheckedItemCollection selecets = this.NetAdapterCheckedListBox.CheckedItems; foreach (string item in selecets) { if (string.IsNullOrEmpty(switchTextBox.Text)) { MessageBox.Show("Please enter swich name"); break; } string parseAdapterName = item.Substring(0, item.IndexOf(":")); logger.Debug("adpater nam:" + parseAdapterName + "."); try { bool result = VirtualSwitch.CreateVSwitch(parseAdapterName, switchTextBox.Text); } catch (Exception ex) { MessageBox.Show("Create switch error:" + ex.Message); logger.Error(ex.ToString()); } } }