public void Clear() { list.Clear(); SetVisibleText(""); Communicate(() => changed = true); // Note: we leave the index alone so things can be set in any order. }
private void Draw_Click(object sender, RoutedEventArgs e) { DateTime dateTimeStart = DateTime.ParseExact(textBoxStart2.Text, "dd-MMM-yy HH:mm:ss", new CultureInfo("en-US"), DateTimeStyles.None); DateTime dateTimeEnd = DateTime.ParseExact(textBoxEnd2.Text, "dd-MMM-yy HH:mm:ss", new CultureInfo("en-US"), DateTimeStyles.None); string path = "../../../AMS/bin/Debug/Controllers/ams.xml"; XDocument doc = XDocument.Load(path); IEnumerable <XElement> elements = (from el in doc.Descendants("device") where (string)el.Attribute("code").Value == textBoxLD2.Text.ToString() select el); //ovde su svi device IEnumerable <XElement> values = (from el in elements.Descendants("value") select el); //ovde su sve vrednosti foreach (XElement xe in values) { if (DateTime.ParseExact(xe.FirstAttribute.Value, "dd-MMM-yy HH:mm:ss", new CultureInfo("en-US"), DateTimeStyles.None) >= dateTimeStart && DateTime.ParseExact(xe.FirstAttribute.Value, "dd-MMM-yy HH:mm:ss", new CultureInfo("en-US"), DateTimeStyles.None) <= dateTimeEnd) { ListValue.Add(Int32.Parse(xe.Value)); //ovde ubacujemo one vrednosti koje upadaju u vreme izmedju ListTime.Add(DateTime.ParseExact(xe.FirstAttribute.Value, "dd-MMM-yy HH:mm:ss", new CultureInfo("en-US"), DateTimeStyles.None)); } } int countTemp = ListValue.Count; int countTime = ListTime.Count; List <KeyValuePair <DateTime, int> > data1 = new List <KeyValuePair <DateTime, int> >(); if (countTemp == countTime) { for (int i = 0; i < countTemp; i++) { KeyValuePair <DateTime, int> dt = new KeyValuePair <DateTime, int>(ListTime[i], ListValue[i]); data1.Add(dt); } } if (data1[0].Value == 0 || data1[0].Value == 1) { MessageBox.Show("This graph works only for analog local devices!", "", MessageBoxButton.OK, MessageBoxImage.Error); ListValue.Clear(); ListTime.Clear(); doc.Save(path); } else { series.ItemsSource = data1; ListValue.Clear(); ListTime.Clear(); doc.Save(path); } }
public void Clear() { switch (fieldType) { case FieldType.Object: HashValue.Clear(); break; case FieldType.Array: ListValue.Clear(); break; default: throw new NotSupportedException(); } }