private void UpdateBusListPanels() //외부 쓰레드에서 호출되는 함수 { BusThread_RunningState += 1; while (BusThread_RunningState < 3) { BusInfo.UpdateBusInfoList(); foreach (BusListPanel b in BusListPanelList) { this.Dispatcher.Invoke(new de(() => b.SetPanelBusInfo(BusInfo.FindByBusName(b.BusName.Content.ToString())))); } Update057(); Thread.Sleep(base_.BUS_UPDATE_TERM); } BusThread_RunningState += 1; d.write($"UpdateBusListPanels() Termination, BusThread_RunningState={BusThread_RunningState}"); }
public BusInfoPage() { InitializeComponent(); this.IsVisibleChanged += (object sender, DependencyPropertyChangedEventArgs e) => //sender, e는 사실상 사용되지 않는다. { if (this.Visibility == Visibility.Hidden) { StopUpdate(); } }; //업데이트 BusInfo.UpdateBusInfoList(); // base_.Update057Average(0, true); //app.xaml에서 담당. // base_.UpdateBusShowList(); //Bus057Panel 2개 추가 MainGrid.Children.Add(Bus057ActivePanel); MainGrid.Children.Add(Bus057NormalPanel); Bus057PanelNormalMode(); //4개의 BusListPanel int bus_list_panel_add_cnt = 0; foreach (string i in base_.BUS_SHOW_LIST) { var fb = BusInfo.FindByBusName(i); if (fb != null) { BusListPanel b = new BusListPanel(); b.SetPanelBusInfo(fb); MainGrid.Children.Add(b); //todo: 4개 이상 버스 있을시 전환효과. b.Margin = new Thickness( this.Width - b.Width, //left, 여기서부터 시계방향으로 돌아감 TopPanel.Height + bus_list_panel_add_cnt * b.Height, 0, this.Height - (TopPanel.Height + bus_list_panel_add_cnt * b.Height + b.Height) ); BusListPanelList.Add(b); bus_list_panel_add_cnt += 1; } } //업데이트 쓰레드 설정 BusListPanelsUpdateThread = new Thread(UpdateBusListPanels); BusListPanelsUpdateThread.Start(); Thread.Sleep(base_.BUS_FIRST_START_WAIT_TIME); Bus057UpdateThread = new Thread(Update057Text); Bus057UpdateThread.Start(); }