Esempio n. 1
0
 public LavelViewModel(LavelModel model, bool SelectFlag)
 {
     _lavelModel     = model;
     this.IsEditMode = SelectFlag;
     this.IsSelected = SelectFlag;
     Children        = new ObservableCollection <LavelViewModel>();
 }
Esempio n. 2
0
        public void InsertLavel(LavelModel lavel)
        {
            // Вставить новый уровень
            XDocument xDoc = XDocument.Load(NameFile);
            var       tmp  = xDoc.Element("ProgramParam").Elements("level").First(i => i.Attribute("Id").Value.ToString() == lavel.paremtId.ToString());

            tmp.Add(new XElement("level",
                                 new XAttribute("Id", lavel.id),
                                 new XAttribute("paremtId", lavel.paremtId),
                                 new XAttribute("Name", lavel.name),
                                 new XAttribute("Comment", "")
                                 ));
            xDoc.Save(NameFile);
        }
Esempio n. 3
0
        public void SaveLavel(LavelModel lavel)
        {
            // Обновить уровень
            XDocument xDoc = XDocument.Load(NameFile);

            // записать
            foreach (XElement tmp in xDoc.Element("ProgramParam").Elements("level"))
            {
                foreach (XElement tmp1 in tmp.Elements("level"))
                {
                    if (lavel.id != 0)
                    {
                        if (tmp1.Attribute("Id").Value.ToString() == lavel.id.ToString())
                        {
                            tmp1.Attribute("Name").Value    = lavel.name;
                            tmp1.Attribute("Comment").Value = lavel.comment;
                            break;
                        }
                    }
                }
            }
            xDoc.Save(NameFile);
        }
Esempio n. 4
0
 public LavelViewModel(LavelModel model)
 {
     _lavelModel = model;
     Children    = new ObservableCollection <LavelViewModel>();
 }