private void LoadAttackTemplFunction(object sender, LoadAttackTemplEventArgs e) { if (attacks == null) { attacks = new List <AttackPlanner>(); LvwAttacks.ItemsSource = attacks; } attacks.Clear(); StreamReader reader = new StreamReader(e.FilePath); string line = reader.ReadLine(); while (line != null) { string[] splittedLine = line.Split(','); AttackPlanner attack = new AttackPlanner(); attack.Time = e.StartTime + TimeSpan.Parse(splittedLine[0]); attack.Src = Village.Parse(splittedLine[1]); attack.Dest = Village.Parse(splittedLine[2]); attack.Army = ArmyClass.Parse(splittedLine[3]); attacks.Add(attack); line = reader.ReadLine(); } refreshID(attacks); LvwAttacks.Items.Refresh(); }
public int CompareTo(object obj) { if (obj == null) { return(1); } AttackPlanner other = obj as AttackPlanner; return(DateTime.Compare(this.Time, other.Time)); }