private void DataProvider_OnUpdateCompleted(object sender, EventArgs e) { if (!dataProvider.IsUpdateSuccessfull) { pageChairsRoot.ShowErrorPage(); return; } if (isChairPagesCreationCompleted) { return; } Logging.ToLog("MainWindow - Создание страниц для кресел"); if (dataProvider.ChairsDict.Count == 0) { Logging.ToLog("MainWindow - Отсутствует информация о креслах"); pageChairsRoot.SetupTitle("Кабинет не выбран"); return; } else { foreach (DataProvider.ItemChair itemChair in dataProvider.ChairsDict.Values) { PageChair pageChair = new PageChair(itemChair.ChID, itemChair.RNum, isLiveQueue, dataProvider); Border border = PageChairsRoot.CreateIndicator(); if (dataProvider.ChairsDict.Count > 1) { pageChairsRoot.StackPanelPageIndicator.Children.Add(border); } chairPages.Add(pageChair, border); } if (chairPages.Count > 1) { StartChairSwitch(); } NavigateToPage(); } isChairPagesCreationCompleted = true; }
private void NavigateToPage() { PageChair pageToShow = chairPages.Keys.ToList()[currentPageIndex]; chairPages[pageToShow].Background = Brushes.Gray; chairPages[pageToShow].Height = 10; if (chairPages.Keys.Where(x => x.IsReceptionConducted).Count() > 0 && !pageToShow.IsReceptionConducted) { TimerChangePage_Tick(null, null); return; } if (pageChairsRoot.FrameMain.Content == pageToShow) { return; } Logging.ToLog("MainWindow - Новое значение: " + pageToShow.ToString()); pageChairsRoot.SetupTitle("Кабинет " + pageToShow.RNum); pageChairsRoot.FrameMain.Navigate(pageToShow); }