public void AddPin(ConnectorPin pin)
 {
     var item = new ListViewItem("" + pin.ID);
     item.SubItems.Add(pin.name);
     item.SubItems.Add(pin.Definition!=null?pin.Definition.Description:"");
     item.SubItems.Add("");
     item.Tag = pin;
     lvList.Items.Add(item);
 }
 public void AddPin(dbConnectorPin pin)
 {
     var cpin = new ConnectorPin();
     cpin.ID = pin.pinIdx.ToString();
     cpin.name = pin.pinName;
     //------------------------------------------------------------------------------------------------------------//
     //--- Note: The description is intentially left out from this update due to a poor schema design for ATML. ---//
     //---       The Definition (ItemDescription) is for the manufacturer pin description and should not be     ---//
     //---       part of a pin instance.                                                                        ---//
     //------------------------------------------------------------------------------------------------------------//
     AddPin(cpin);
 }
        private void ControlsToData()
        {
            if (connectorPin == null )
                connectorPin = new ConnectorPin();

            connectorPin.baseIndexSpecified = !String.IsNullOrEmpty(edtReplacementCharacter.Text);
            connectorPin.countSpecified = !String.IsNullOrEmpty(edtCount.Text) && int.Parse(edtCount.Text) > 0;
            connectorPin.incrementBySpecified = !String.IsNullOrEmpty(edtIncrementBy.Text) && int.Parse(edtIncrementBy.Text) > 0;
            if (connectorPin.baseIndexSpecified )
                connectorPin.baseIndex = connectorPin.baseIndexSpecified ? int.Parse(edtBaseIndex.Text) : 0;
            if (connectorPin.countSpecified )
                connectorPin.count = connectorPin.countSpecified ? int.Parse(edtCount.Text) : 0;
            if (connectorPin.incrementBySpecified)
                connectorPin.incrementBy = connectorPin.incrementBySpecified ? int.Parse(edtIncrementBy.Text) : 0;
            connectorPin.ID = edtId.Text;
            connectorPin.name = edtName.Text;
            connectorPin.replacementCharacter = !String.IsNullOrEmpty(edtReplacementCharacter.Text) ? edtReplacementCharacter.Text : null;
        }
Exemplo n.º 4
0
 public static bool LoadFromFile(string fileName, out ConnectorPin obj)
 {
     System.Exception exception;
     return LoadFromFile(fileName, out obj, out exception);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Deserializes xml markup from file into an ConnectorPin object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output ConnectorPin object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out ConnectorPin obj, out System.Exception exception)
 {
     exception = null;
     obj = default(ConnectorPin);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
Exemplo n.º 6
0
 public static bool Deserialize(string input, out ConnectorPin obj)
 {
     System.Exception exception;
     return Deserialize(input, out obj, out exception);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Deserializes workflow markup into an ConnectorPin object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output ConnectorPin object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string input, out ConnectorPin obj, out System.Exception exception)
 {
     exception = null;
     obj = default(ConnectorPin);
     try
     {
         obj = Deserialize(input);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 public void GeneratePinList(int pinCount)
 {
     int pins = Items.Count;
     if (pinCount > pins)
     {
         for (int i = 1; i <= (pinCount - pins); i++)
         {
             var item = new ListViewItem("" + (pins + i + 1));
             var pin = new ConnectorPin();
             pin.ID = "" + (Items.Count + 1);
             pin.name = "N/A";
             AddPin(pin);
         }
     }
     else if (pinCount < pins)
     {
         for (int i = pins; i > pinCount; i--)
         {
             try
             {
                 Items.RemoveAt(i - 1);
             }
             catch (Exception er)
             {
                 MessageBox.Show(string.Format("An Error occurred removing connector pin {0}\n{1}", i, er.Message));
             }
         }
     }
 }
 private void ControlsToData()
 {
     _connectorPin = connectorPinControl.ConnectorPin;
     _connectorPin.Definition = chkIncludeDefinition.Checked ? itemDescriptionControl.ItemDescription : null;
 }