Ejemplo n.º 1
0
 //------------------------------------------------//
 //--- Edit the selected connector location pin ---//
 //------------------------------------------------//
 protected override void btnEdit_Click(object sender, EventArgs e)
 {
     if (lvList.SelectedItems.Count > 0)
     {
         var location = (ConnectorLocation)lvList.SelectedItems[0].Tag;
         var form     = new
                        ConnectorLocationPinForm(_connectors);
         form.ConnectorLocation = location;
         if (DialogResult.OK == form.ShowDialog())
         {
             lvList.SelectedItems[0].Tag              = form.ConnectorLocation;
             lvList.SelectedItems[0].Text             = form.ConnectorLocation.connectorID;
             lvList.SelectedItems[0].SubItems[1].Text = form.ConnectorLocation.pinID;
         }
     }
 }
Ejemplo n.º 2
0
        //----------------------------------------//
        //--- Add a new connector location pin ---//
        //----------------------------------------//
        protected override void btnAdd_Click(object sender, EventArgs e)
        {
            var form = new ConnectorLocationPinForm(_connectors);
            //--------------------------------------------------------------------------------------------------------------//
            //--- If there already locations in the list, then lets grab the last connector id and set it on the new pin ---//
            //--------------------------------------------------------------------------------------------------------------//
            var locationPin = new ConnectorLocation();

            if (lvList.Items.Count > 0)
            {
                locationPin.connectorID = ((ConnectorLocation)lvList.Items[lvList.Items.Count - 1].Tag).connectorID;
            }
            form.ConnectorLocation = locationPin;
            if (DialogResult.OK == form.ShowDialog())
            {
                AddConnectorLocation(form.ConnectorLocation);
            }
        }