public void loadPosition() { this.favoriteXml_ = new XmlDocument(); this.favoriteList_ = new ObservableCollection <FavoriteViewModel>(); favoriteXml_.Load(bookPath_ + "\\" + "favorite.xml"); System.Xml.XmlNode favoritePositionNode = favoriteXml_["favoritePosition"]; //this.positionFolderName_ = positionFolderNode["positionFolderName"].InnerText; //this.positionFolderCode_ = positionFolderNode["positionFolderCode"].InnerText; #region load WholePositionMaster this.masterFavoriteViewModel_ = new MasterFavoriteViewModel(); this.favoriteList_.Add(this.masterFavoriteViewModel_); #endregion #region unclassifedFavorite Set System.Xml.XmlNode unclassifiedFavoriteNode = favoritePositionNode["unclassifiedFavorite"]; FavoriteViewModel unclassifiedFavoriteBook = new FavoriteViewModel(); unclassifiedFavoriteBook.setFromXml(unclassifiedFavoriteNode); this.unClassifiedFavoriteViewModel_ = unclassifiedFavoriteBook; this.favoriteList_.Add(unclassifiedFavoriteBook); #endregion foreach (System.Xml.XmlNode item in favoritePositionNode.SelectNodes("favorite")) { FavoriteViewModel favoriteBook = new FavoriteViewModel(); favoriteBook.setFromXml(item); this.favoriteList_.Add(favoriteBook); } }
// delete key event가 아니고 이거로 해도 대나...ㅡ.ㅡ;; //Occurs when a ListViewRow object becomes available for reuse. //private void instrumentListListView__UnloadingRow(object sender, ListViewRowEventArgs e) //{ //} private void instrumentListListView__PreviewKeyDown(object sender, KeyEventArgs e) { Excel_instrumentViewModel e_ivm = ((ListView)sender).SelectedItem as Excel_instrumentViewModel; if (Key.Delete == e.Key && e_ivm != null) { int selectionCount = ((ListView)sender).SelectedIndex; //bool fileEdited = selectedFolder_.removeInstrument(e_ivm); bool fileEdited = false; bool masterEdited = selectedFolder_.removeInstrument(e_ivm); MasterFavoriteViewModel vm = this.selectedFolder_ as MasterFavoriteViewModel; if (vm != null) { // masterfavor이면 rookbook에서 지워야함. fileEdited = rootBookViewModel_.removeInstrument(e_ivm); } if (fileEdited) { this.selectedViewModel_.saveXml(); } e_ivm.Excel_eventManagerViewModel_.deleteEvent(); this.instrumentListListView_.Items.Refresh(); ((ListView)sender).SelectedIndex = selectionCount; } //((ListView)sender).SelectionMode //e.Handled = true; }
public void loadPosition() { this.favoriteXml_ = new XmlDocument(); this.favoriteList_ = new ObservableCollection<FavoriteViewModel>(); favoriteXml_.Load(bookPath_ +"\\"+ "favorite.xml"); System.Xml.XmlNode favoritePositionNode = favoriteXml_["favoritePosition"]; //this.positionFolderName_ = positionFolderNode["positionFolderName"].InnerText; //this.positionFolderCode_ = positionFolderNode["positionFolderCode"].InnerText; #region load WholePositionMaster this.masterFavoriteViewModel_ = new MasterFavoriteViewModel(); this.favoriteList_.Add(this.masterFavoriteViewModel_); #endregion #region unclassifedFavorite Set System.Xml.XmlNode unclassifiedFavoriteNode = favoritePositionNode["unclassifiedFavorite"]; FavoriteViewModel unclassifiedFavoriteBook = new FavoriteViewModel(); unclassifiedFavoriteBook.setFromXml(unclassifiedFavoriteNode); this.unClassifiedFavoriteViewModel_ = unclassifiedFavoriteBook; this.favoriteList_.Add(unclassifiedFavoriteBook); #endregion foreach (System.Xml.XmlNode item in favoritePositionNode.SelectNodes("favorite")) { FavoriteViewModel favoriteBook = new FavoriteViewModel(); favoriteBook.setFromXml(item); this.favoriteList_.Add(favoriteBook); } }