private void mainTree_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (lstRooms.SelectedItem == null) { return; } WindowView wv = null; if (lstRooms.SelectedItem.GetType() == typeof(Room)) { Room r = lstRooms.SelectedItem as Room; var existingWindows = (from a in MainViewModel.MainViewModelStatic.OpenWindows let b = a.Content as RoomEditor where b != null && b.DataContext == r select a); if (existingWindows.Count() == 0) { wv = new WindowView { TabName = "Room - " + r.RoomName, Content = (UserControl) new RoomEditor { DataContext = r } }; MainViewModel.MainViewModelStatic.OpenWindows.Add(wv); } else { wv = existingWindows.First(); } } if (wv != null) { MainViewModel.MainViewModelStatic.SelectedTab = MainViewModel.MainViewModelStatic.OpenWindows.IndexOf(wv); } }
private void mainTree_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (mainTree.SelectedItem == null) { return; } WindowView wv = null; if (mainTree.SelectedItem.GetType() == typeof(Zone)) { Zone z = mainTree.SelectedItem as Zone; var existingWindows = (from a in MainViewModel.MainViewModelStatic.OpenWindows let b = a.Content as ZoneEditor where b != null && b.DataContext == z select a); if (existingWindows.Count() == 0) { wv = new WindowView { TabName = "Zone - " + z.ZoneName, Content = (UserControl) new ZoneEditor { DataContext = z } }; MainViewModel.MainViewModelStatic.OpenWindows.Add(wv); } else { wv = existingWindows.First(); } } if (mainTree.SelectedItem.GetType() == typeof(InteractableGroup)) { InteractableGroup g = mainTree.SelectedItem as InteractableGroup; var existingWindows = (from a in MainViewModel.MainViewModelStatic.OpenWindows let b = a.Content as InteractableGroupViewer where b != null && b.DataContext == g select a); if (existingWindows.Count() == 0) { wv = new WindowView { TabName = "Interactable Group - " + g.Name, Content = (UserControl) new InteractableGroupViewer { DataContext = g } }; MainViewModel.MainViewModelStatic.OpenWindows.Add(wv); } else { wv = existingWindows.First(); } } if (mainTree.SelectedItem.GetType() == typeof(Variable)) { Variable g = mainTree.SelectedItem as Variable; var existingWindows = (from a in MainViewModel.MainViewModelStatic.OpenWindows let b = a.Content as VariableEditor where b != null && b.DataContext == g select a); if (existingWindows.Count() == 0) { wv = new WindowView { TabName = "Variable - " + g.Name, Content = (UserControl) new VariableEditor { DataContext = g } }; MainViewModel.MainViewModelStatic.OpenWindows.Add(wv); } else { wv = existingWindows.First(); } } if (mainTree.SelectedItem.GetType() == typeof(VarArray)) { VarArray g = mainTree.SelectedItem as VarArray; var existingWindows = (from a in MainViewModel.MainViewModelStatic.OpenWindows let b = a.Content as ArrayEditor where b != null && b.DataContext == g select a); if (existingWindows.Count() == 0) { wv = new WindowView { TabName = "Array - " + g.Name, Content = (UserControl) new ArrayEditor { DataContext = g } }; MainViewModel.MainViewModelStatic.OpenWindows.Add(wv); } else { wv = existingWindows.First(); } } if (mainTree.SelectedItem.GetType() == typeof(ItemClass)) { ItemClass g = mainTree.SelectedItem as ItemClass; var existingWindows = (from a in MainViewModel.MainViewModelStatic.OpenWindows let b = a.Content as ItemClassEditor where b != null && b.DataContext == g select a); if (existingWindows.Count() == 0) { wv = new WindowView { TabName = "Item Class - " + g.Name, Content = (UserControl) new ItemClassEditor { DataContext = g } }; MainViewModel.MainViewModelStatic.OpenWindows.Add(wv); } else { wv = existingWindows.First(); } } if (mainTree.SelectedItem.GetType() == typeof(Item)) { Item g = mainTree.SelectedItem as Item; var existingWindows = (from a in MainViewModel.MainViewModelStatic.OpenWindows let b = a.Content as ItemEditor where b != null && b.DataContext == g select a); if (existingWindows.Count() == 0) { wv = new WindowView { TabName = "Item - " + g.ItemName, Content = (UserControl) new ItemEditor { DataContext = g } }; MainViewModel.MainViewModelStatic.OpenWindows.Add(wv); } else { wv = existingWindows.First(); } } if (mainTree.SelectedItem.GetType() == typeof(Conversation)) { Conversation g = mainTree.SelectedItem as Conversation; var existingWindows = (from a in MainViewModel.MainViewModelStatic.OpenWindows let b = a.Content as ConversationEditor where b != null && b.DataContext == g select a); if (existingWindows.Count() == 0) { wv = new WindowView { TabName = "Conversation - " + g.Name, Content = (UserControl) new ConversationEditor { DataContext = g } }; MainViewModel.MainViewModelStatic.OpenWindows.Add(wv); } else { wv = existingWindows.First(); } } if (mainTree.SelectedItem.GetType() == typeof(CommonEvent)) { CommonEvent g = mainTree.SelectedItem as CommonEvent; var existingWindows = (from a in MainViewModel.MainViewModelStatic.OpenWindows let b = a.Content as CommonEventEditor where b != null && b.DataContext == g select a); if (existingWindows.Count() == 0) { wv = new WindowView { TabName = "Common Event - " + g.Name, Content = (UserControl) new CommonEventEditor { DataContext = g } }; MainViewModel.MainViewModelStatic.OpenWindows.Add(wv); } else { wv = existingWindows.First(); } } if (mainTree.SelectedItem.GetType() == typeof(StatusEffect)) { StatusEffect g = mainTree.SelectedItem as StatusEffect; var existingWindows = (from a in MainViewModel.MainViewModelStatic.OpenWindows let b = a.Content as StatusEffectEditor where b != null && b.DataContext == g select a); if (existingWindows.Count() == 0) { wv = new WindowView { TabName = "Status Effect - " + g.Name, Content = (UserControl) new StatusEffectEditor { DataContext = g } }; MainViewModel.MainViewModelStatic.OpenWindows.Add(wv); } else { wv = existingWindows.First(); } } if (wv != null) { MainViewModel.MainViewModelStatic.SelectedTab = MainViewModel.MainViewModelStatic.OpenWindows.IndexOf(wv); } }
private static void OpenWindow() { WindowView window = GetWindow <WindowView>(); window.titleContent = new GUIContent("Code Diagram"); }