private void ChangeViewModel(IBoxes viewModel) { if (!PageViewModels.Contains(viewModel)) { PageViewModels.Add(viewModel); } CurrentPageViewModel = PageViewModels .FirstOrDefault(vm => vm == viewModel); }
/// <summary> /// Initializes this instance. /// </summary> /// <remarks>Documented by Dev03, 2007-08-06</remarks> private void Initialize(bool ignoreOldVersion) { m_generalSettings = (XmlElement)m_dictionary.SelectSingleNode(m_xpathGenSet); m_userSettings = (XmlElement)m_dictionary.SelectSingleNode(m_xpathUsrSet); m_queryOptions = new MLifter.DAL.XML.XmlQueryOptions(this, parent); settings = new XmlSettings(this, Parent.GetChildParentClass(this)); allowed_settings = new XmlAllowedSettings(this, Parent.GetChildParentClass(this)); //check dictionary version if (this.Version > m_CurrentVersion) { CloseStream(); throw new DictionaryFormatNotSupported(this.Version); } else if (this.Version < m_CurrentVersion && !ignoreOldVersion) { CloseStream(); throw new DictionaryFormatOldVersion(this.Version); } XPathNavigator navigator; XPathExpression expression; XPathNodeIterator nodeIterator; //read commentsound m_audioComments = new List<string>(); navigator = m_generalSettings.CreateNavigator(); expression = navigator.Compile(m_xpathCommentSound); expression.AddSort(m_xpathAttributeId, XmlSortOrder.Ascending, XmlCaseOrder.None, String.Empty, XmlDataType.Number); nodeIterator = navigator.Select(expression); while (nodeIterator.MoveNext()) m_audioComments.Add(nodeIterator.Current.Value); //read boxsize m_Boxes = new XmlBoxes(this, Parent.GetChildParentClass(this)); navigator = m_userSettings.CreateNavigator(); expression = navigator.Compile(m_xpathBoxsize); expression.AddSort(m_xpathAttributeId, XmlSortOrder.Ascending, XmlCaseOrder.None, String.Empty, XmlDataType.Number); nodeIterator = navigator.Select(expression); while (nodeIterator.MoveNext()) { string boxSizeValue = nodeIterator.Current.Value; int currentId = 0; if (nodeIterator.Current.MoveToAttribute(m_xpathId, String.Empty)) { if (Int32.TryParse(nodeIterator.Current.Value, out currentId)) { if ((currentId > 0) && (currentId < m_numberOfBoxes)) // box 1 to 9 (pool and box 10 are not written) { m_Boxes.Box[currentId].MaximalSize = XmlConvert.ToInt32(boxSizeValue); } } } } //read querychapter m_queryChapters = new List<int>(); navigator = m_userSettings.CreateNavigator(); expression = navigator.Compile(m_xpathQueryChapter); expression.AddSort(m_xpathAttributeId, XmlSortOrder.Ascending, XmlCaseOrder.None, String.Empty, XmlDataType.Number); nodeIterator = navigator.Select(expression); while (nodeIterator.MoveNext()) m_queryChapters.Add(XmlConvert.ToInt32(nodeIterator.Current.Value)); m_cards = new MLifter.DAL.XML.XmlCards(this, parent.GetChildParentClass(this)); m_chapters = new MLifter.DAL.XML.XmlChapters(this, Parent.GetChildParentClass(this)); m_statistics = new MLifter.DAL.XML.XmlStatistics(this); m_AllowedQueryTypes = new XML.XmlAllowedQueryTypes(this, Parent.GetChildParentClass(this)); m_AllowedQueryDirections = new XML.XmlAllowedQueryDirections(this, Parent.GetChildParentClass(this)); this.Category.IdChanged += new EventHandler(Category_IdChanged); }