示例#1
0
        public void AddPortal(PortalModel portalModel)
        {
            var portalGun = new PortalGun(this, portalModel);

            portalGun.Start();
            portalGunDict[portalModel] = portalGun;
            PortalList.Add(portalModel);
            portalModel.IsRuning = true;
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }