public void AddPortal(PortalModel portalModel) { var portalGun = new PortalGun(this, portalModel); portalGun.Start(); portalGunDict[portalModel] = portalGun; PortalList.Add(portalModel); portalModel.IsRuning = true; }
private void addPortalToListView(Model.PortalModel model) { var lvi = new ListViewItem(model.RemoteHost); lvi.SubItems.Add(model.RemotePort.ToString()); lvi.SubItems.Add(model.LocalIpAddress.ToString()); lvi.SubItems.Add(model.LocalPort.ToString()); lvi.SubItems.Add(model.IsRuning.ToString()); lvi.Tag = model; lvPortals.Items.Add(lvi); }
public void RemovePortal(PortalModel portalModel) { if (PortalList.Contains(portalModel)) { PortalList.Remove(portalModel); } portalModel.IsRuning = false; if (!portalGunDict.ContainsKey(portalModel)) { return; } var portalGun = portalGunDict[portalModel]; portalGun.Stop(); portalGunDict.Remove(portalModel); }