bool Hadndled1 = false;//флаг для предотвращения бесконечного цикла выбора сцены private void SelectedLevelVM_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (Hadndled1) { Hadndled1 = false; return; } //Обработка события выбора новой сцены (т.к. ListView надо бы обновлять) if (e.PropertyName == "SelectedSceneVM") { // index = 4; Tools.ToolsTimer.Delay(() => //Die, die die my darling I'll be seeing you in Hell { Hadndled1 = true; int i = 0; SceneVM sceneVM = ViewModel.SelectedLevelVM.SelectedSceneVM; foreach (SceneVM s in ViewModel.SelectedLevelVM.SceneVMs) { i++; if (s.SceneId == sceneVM.SceneId) { break; } } SceneListBox.SelectedIndex = i - 1; }, TimeSpan.FromMilliseconds(20)); } }
public Interval(TimeLine container, SceneVM _sceneVM, int zindex = 1) { Container = container; Zindex = zindex; Body = new SceneTimeView(this); Body.HorizontalAlignment = HorizontalAlignment.Left; sceneVM = _sceneVM; SubscribeDepPropertyEvents(); Body.Selected = false; UpdateView(); }
//Добавляем интервал public void AddInterval(SceneVM sceneVM) { Interval interval = new Interval(this, sceneVM); this.GridMain.Children.Add(interval.Body); interval.Body.Container = this; Intervals.Add(interval); interval.Body.OnClick += (sender, e) => { SelectInterval(interval, "Клик"); }; interval.UpdateView(); }
private void Button_Click(object sender, RoutedEventArgs e) { i++; SceneVM scene = new SceneVM(); scene.SelectedMapVM = new ViewModel.Map.MapVM(); scene.SelectedMapVM.LayerCollection.Add(new SingleTileLayer() { TileImageURI = AppDomain.CurrentDomain.BaseDirectory + @"map.PNG", MaximumResolution = 10, MinimumResolution = 0.1 }); TabPanelVM vm = new TabPanelVM() { Title = "警卫任务" + i.ToString(), Content = scene }; _mainWindowVM.TabPanelManagerVM.DefaultTabControlVM.TabPanelVMs.Add(vm); _mainWindowVM.TabPanelManagerVM.DefaultTabControlVM.SelectedTabPanelVM = vm; }
private void MetroWindow_Loaded(object sender, RoutedEventArgs e) { SceneVM scene = new SceneVM(); scene.SelectedMapVM = new ViewModel.Map.MapVM(); scene.SelectedMapVM.LayerCollection.Add(new SingleTileLayer() { TileImageURI = AppDomain.CurrentDomain.BaseDirectory + @"map.PNG", MaximumResolution = 10, MinimumResolution = 0.1 }); TabPanelVM vm = new TabPanelVM() { Title = "总指挥屏", Content = scene }; //scene.SelectedMapVM.LayerCollection.Add(new ArcGISTiledMapServiceLayer() { Url = @"http://169.254.80.80:7080/PBS/rest/services/MyPBSService1/MapServer" }); //TabPanelVM vm = new TabPanelVM() { Title = "总指挥屏", Content = scene }; vm.CanClose = false; _mainWindowVM.TabPanelManagerVM.DefaultTabControlVM.TabPanelVMs.Add(vm); _mainWindowVM.TabPanelManagerVM.DefaultTabControlVM.SelectedTabPanelVM = vm; }