private void Edit_Click(object sender, RoutedEventArgs e) { var res = GetArticlesFromListBox().FirstOrDefault(); if (res != null && !_isGroupsVisible) { var view = new Create(this, isXml, res); view.Title = "Редактировать"; view.ShowDialog(); } else if (_viewingArticle != null) { var view = new Create(this, isXml, _viewingArticle); view.Title = "Редактировать"; view.ShowDialog(); } if (CreatedArticle != null) { var art = Articles.First(c => c.ArticleId == CreatedArticle.ArticleId); art.ArticleName = CreatedArticle.ArticleName; art.InitialText = CreatedArticle.InitialText; art.Link = CreatedArticle.Link; art.Images = CreatedArticle.Images; } CreatedArticle = null; if (_isGroupsVisible) { TreeViewHelper.Instance.FillTreeView(Groups, Articles, ArticleTreeView); TreeViewHelper.Instance.SelectAndExpand(ArticleTreeView, _viewingArticle); } else { CreateListOfArticles(Articles); } InvokeCounter(); }
private void Create_Click(object sender, RoutedEventArgs e) { var view = new Create(this, isXml); view.ShowDialog(); if (CreatedArticle != null) { Articles.Add(CreatedArticle); } if (_isGroupsVisible) { TreeViewHelper.Instance.FillTreeView(Groups, Articles, ArticleTreeView); TreeViewHelper.Instance.SelectAndExpand(ArticleTreeView, CreatedArticle); } else { CreateListOfArticles(Articles); } CreatedArticle = null; InvokeCounter(); }