private void onlinedataLoad(ProtocolBase proto) { CustomProtocol protocol = (CustomProtocol)proto; int tnum = protocol.GetInt(this.start, ref this.start); bool flag = tnum > 0; if (flag) { for (int i = 0; i < tnum; i++) { string temp = GlobalData.UserName; RidingData dr = new RidingData(); dr.ID = (this.num + 1 + i).ToString(); dr.Name = temp; dr.TrackName = protocol.GetString(this.start, ref this.start); dr.Time1 = protocol.GetString(this.start, ref this.start); dr.Time2 = protocol.GetString(this.start, ref this.start); dr.Distance = protocol.GetString(this.start, ref this.start); dr.Velocity = protocol.GetString(this.start, ref this.start); base.Dispatcher.Invoke(delegate { this.ObservableObj.Add(dr); }); } } }
private void listView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { sender = this.listView.SelectedItem; RidingData temp = sender as RidingData; bool flag = temp == null; if (!flag) { GlobalData.RecordName = temp.Name; GlobalData.RecordData = XMLHelper.RecordReader(temp.Name, 5); bool flag2 = GlobalData.RecordData != null; if (flag2) { ChartWindow cw = new ChartWindow(); cw.ShowDialog(); this.ObservableObj.Clear(); this.dataLoad(); bool recordflag = GlobalData.Recordflag; if (recordflag) { this.start = 11; this.onlinedataLoad(GlobalData.proto); } } } }
private void dataLoad() { int tnum = XMLHelper.RecordGetNum(); this.num = tnum; bool flag = tnum > 0; if (flag) { for (int i = 0; i < tnum; i++) { string temp = XMLHelper.RecordGetName(i); RidingData dr = new RidingData(); dr.ID = (i + 1).ToString(); dr.Name = temp; dr.TrackName = XMLHelper.RecordReader(temp, 0); bool flag2 = XMLHelper.RecordReader(temp, 3) == ""; if (flag2) { dr.Time1 = null; } else { double start = Convert.ToDouble(XMLHelper.RecordReader(temp, 3)); dr.Time1 = UTCTimeOperate.ConvertIntDatetime(start).ToString(); } dr.Time2 = XMLHelper.RecordReader(temp, 4); dr.Distance = XMLHelper.RecordReader(temp, 5); dr.Velocity = XMLHelper.RecordReader(temp, 6); this.ObservableObj.Add(dr); } } this.listView.DataContext = this.ObservableObj; }
private void RecordDelete_Click(object sender, RoutedEventArgs e) { sender = this.listView.SelectedItem; RidingData temp = sender as RidingData; bool flag = temp == null; if (!flag) { bool flag2 = MessageBox.Show(MultiLanguage.Warn24, MultiLanguage.Warn22, MessageBoxButton.YesNo) != MessageBoxResult.Yes; if (!flag2) { GlobalData.RecordName = temp.Name; GlobalData.RecordData = XMLHelper.RecordReader(temp.Name, 5); string FileName = XMLHelper.RecordReader(temp.Name, 3); string NowFileName = Environment.CurrentDirectory + "\\" + FileName + ".xml"; bool flag3 = GlobalData.RecordData != null; if (flag3) { XMLHelper.RecordDeleter(GlobalData.RecordName); bool flag4 = File.Exists(NowFileName); if (flag4) { File.Delete(NowFileName); } this.ObservableObj.Clear(); this.dataLoad(); bool recordflag = GlobalData.Recordflag; if (recordflag) { this.start = 11; this.onlinedataLoad(GlobalData.proto); } } else { int id = Convert.ToInt32(temp.ID) - this.num; CustomProtocol proto = new CustomProtocol(); proto.AddString("EF1"); proto.AddInt(id); Connection.Send(proto); this.deleteID = temp.ID; } } } }