private void AddController(object sender, RoutedEventArgs e) { CPolicyData cpd = new CPolicyData() { Version = CPolicyData.MaxVersion, ID = Aipolicy.Controllers.Count > 0 ? Aipolicy.Controllers.Last().ID + 1 : 1 }; Aipolicy.Controllers.Add(cpd); }
private void ImportController(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog() { Filter = "AIE export files(*.aie)|*.aie|All files(*.*)|*.*" }; if (ofd.ShowDialog() == true) { BinaryReader br = new BinaryReader(File.OpenRead(ofd.FileName)); int count = br.ReadInt32(); for (int i = 0; i < count; ++i) { var data = new CPolicyData(); data.Read(br); Aipolicy.Controllers.Add(data); } br.Close(); } }