/// <summary> /// Copies the elements of the specified <see cref="MyTopicInfo">MyTopicInfo</see> array to the end of the collection. /// </summary> /// <param name="value">An array of type <see cref="MyTopicInfo">MyTopicInfo</see> containing the Components to add to the collection.</param> public void AddRange(MyTopicInfo[] value) { for (int i = 0; (i < value.Length); i = (i + 1)) { this.Add(value[i]); } }
private void buttonSendMessage_Click(object sender, EventArgs e) { System.Collections.IEnumerator myEnumerator; myEnumerator = checkedListBoxTopics.CheckedIndices.GetEnumerator(); while (myEnumerator.MoveNext() != false) { int idx = (int)myEnumerator.Current; MyTopicInfo info = MyTopicInfoList[idx]; int idx2 = info.Index; if (info.TypeName == PizzaData.GetTypeName()) { Pizza[idx2].Data.cheese = "From C# " + Convert.ToString(myMessageCounter); Pizza[idx2].Data.tomatoSauce = "tomatosauce " + Convert.ToString(myMessageCounter); // Setup spareBytes test int numBytes = 0; int.TryParse(textBoxNumBytes.Text, out numBytes); if (numBytes > 0) { Pizza[idx2].Data.spareBytes = new byte[numBytes]; byte b = 0; for (int i = 0; i < numBytes; i++) { Pizza[idx2].Data.spareBytes[i] = b; if (b < 255) { b++; } else { b = 0; } } } else { if (Pizza[idx2].Data.spareBytes.Length > 0) { Pizza[idx2].Data.spareBytes = new byte[0]; } } // Pizza[idx2].Write(); } else { Vessuvio[idx2].Data.cheese = "cheese " + Convert.ToString(myMessageCounter); Vessuvio[idx2].Data.tomatoSauce = "tomatosauce " + Convert.ToString(myMessageCounter); int numBytes = 0; int.TryParse(textBoxNumBytes.Text, out numBytes); StringBuilder strb = new StringBuilder(); strb.Length = numBytes; Vessuvio[idx2].Data.ham = strb.ToString(); Vessuvio[idx2].Write(); } myMessageCounter++; } }
private void buttonStopSubscriber_Click(object sender, EventArgs e) { System.Collections.IEnumerator myEnumerator; myEnumerator = checkedListBoxTopics.CheckedIndices.GetEnumerator(); while (myEnumerator.MoveNext() != false) { int idx = (int)myEnumerator.Current; MyTopicInfo info = MyTopicInfoList[idx]; info.OpsHelper.StopSubscriber(); } }
private void buttonDeletePublisher_Click(object sender, EventArgs e) { System.Collections.IEnumerator myEnumerator; myEnumerator = checkedListBoxTopics.CheckedIndices.GetEnumerator(); while (myEnumerator.MoveNext() != false) { int idx = (int)myEnumerator.Current; MyTopicInfo info = MyTopicInfoList[idx]; info.OpsHelper.DeletePublisher(); info.PubExists = false; } checkedListBoxTopics.Invalidate(); }
private void buttonSetDeadLineInterval_Click(object sender, EventArgs e) { if (int.TryParse(textBoxDeadLineInterval.Text, out deadLineEventInterval)) { System.Collections.IEnumerator myEnumerator; myEnumerator = checkedListBoxTopics.CheckedIndices.GetEnumerator(); while (myEnumerator.MoveNext() != false) { int idx = (int)myEnumerator.Current; MyTopicInfo info = MyTopicInfoList[idx]; info.OpsHelper.SetDeadLineInterval(deadLineEventInterval); } } }
private void buttonCreatePublisher_Click(object sender, EventArgs e) { if (!verifyParticipants()) { return; } System.Collections.IEnumerator myEnumerator; myEnumerator = checkedListBoxTopics.CheckedIndices.GetEnumerator(); while (myEnumerator.MoveNext() != false) { int idx = (int)myEnumerator.Current; MyTopicInfo info = MyTopicInfoList[idx]; info.PubExists = info.OpsHelper.CreatePublisher(info.Part, info.TopicName); } checkedListBoxTopics.Invalidate(); }
/// <summary> /// Gets a value indicating whether the collection contains the specified <see cref="MyTopicInfoCollection">MyTopicInfoCollection</see>. /// </summary> /// <param name="value">The <see cref="MyTopicInfoCollection">MyTopicInfoCollection</see> to search for in the collection.</param> /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns> public bool Contains(MyTopicInfo value) { return this.List.Contains(value); }
/// <summary> /// Initializes a new instance of the <see cref="MyTopicInfoCollection">MyTopicInfoCollection</see> class containing the specified array of <see cref="MyTopicInfo">MyTopicInfo</see> Components. /// </summary> /// <param name="value">An array of <see cref="MyTopicInfo">MyTopicInfo</see> Components with which to initialize the collection. </param> public MyTopicInfoCollection(MyTopicInfo[] value) { this.AddRange(value); }
public int Add(MyTopicInfo value) { return this.List.Add(value); }
public void Remove(MyTopicInfo value) { List.Remove(value); }
public void Insert(int index, MyTopicInfo value) { List.Insert(index, value); }
/// <summary> /// Gets the index in the collection of the specified <see cref="MyTopicInfoCollection">MyTopicInfoCollection</see>, if it exists in the collection. /// </summary> /// <param name="value">The <see cref="MyTopicInfoCollection">MyTopicInfoCollection</see> to locate in the collection.</param> /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns> public int IndexOf(MyTopicInfo value) { return this.List.IndexOf(value); }
/// <summary> /// Copies the collection Components to a one-dimensional <see cref="T:System.Array">Array</see> instance beginning at the specified index. /// </summary> /// <param name="array">The one-dimensional <see cref="T:System.Array">Array</see> that is the destination of the values copied from the collection.</param> /// <param name="index">The index of the array at which to begin inserting.</param> public void CopyTo(MyTopicInfo[] array, int index) { this.List.CopyTo(array, index); }
private void buttonSendMessage_Click(object sender, EventArgs e) { System.Collections.IEnumerator myEnumerator; myEnumerator = checkedListBoxTopics.CheckedIndices.GetEnumerator(); while (myEnumerator.MoveNext() != false) { int idx = (int)myEnumerator.Current; MyTopicInfo info = MyTopicInfoList[idx]; int idx2 = info.Index; if (info.TypeName == PizzaData.GetTypeName()) { int version = 0; int.TryParse(textBoxPizzaDataVersion.Text, out version); if (version < 0) { Pizza[idx2].Data.IdlVersionMask = 0; Pizza[idx2].Data.PizzaData_version = 0; } else { Pizza[idx2].Data.IdlVersionMask = 1; Pizza[idx2].Data.PizzaData_version = (byte)version; } Pizza[idx2].Data.cheese = "From C# " + Convert.ToString(myMessageCounter); Pizza[idx2].Data.tomatoSauce = "tomatosauce " + Convert.ToString(myMessageCounter); // Setup spareBytes test int numBytes = 0; int.TryParse(textBoxNumBytes.Text, out numBytes); if (numBytes > 0) { Pizza[idx2].Data.spareBytes = new byte[numBytes]; byte b = 0; for (int i = 0; i < numBytes; i++) { Pizza[idx2].Data.spareBytes[i] = b; if (b < 255) { b++; } else { b = 0; } } } else { if (Pizza[idx2].Data.spareBytes.Length > 0) { Pizza[idx2].Data.spareBytes = new byte[0]; } } // Pizza[idx2].Write(); } else if (info.TypeName == VessuvioData.GetTypeName()) { Vessuvio[idx2].Data.cheese = "From C# " + Convert.ToString(myMessageCounter); Vessuvio[idx2].Data.tomatoSauce = "tomatosauce " + Convert.ToString(myMessageCounter); int numBytes = 0; int.TryParse(textBoxNumBytes.Text, out numBytes); StringBuilder strb = new StringBuilder(); strb.Length = numBytes; Vessuvio[idx2].Data.ham = strb.ToString(); Vessuvio[idx2].Write(); } else { ExAllt[idx2].Data.cheese = "From C# " + Convert.ToString(myMessageCounter); ExAllt[idx2].Data.tomatoSauce = "tomatosauce " + Convert.ToString(myMessageCounter); ExAllt[idx2].Data.sh = -7; if (ExAllt[idx2].Data.shs.Count() == 0) { ExAllt[idx2].Data.shs.Add(100); ExAllt[idx2].Data.shs.Add(200); ExAllt[idx2].Data.shs.Add(300); ExAllt[idx2].Data.shs.Add(400); } if (ExAllt[idx2].Data.strings.Count() == 0) { ExAllt[idx2].Data.strings.Add("qwerty"); ExAllt[idx2].Data.strings.Add("asdfgh"); } ExAllt[idx2].Write(); } myMessageCounter++; } }