private void LoadActiveGangWidget(List <Character> gangMembers) { if (gangMembers != null && PopupService.IsOpen("ActiveCharacterWidgetView") == false) { Character gangLeader = gangMembers.FirstOrDefault(m => m.IsGangLeader); System.Windows.Style style = Helper.GetCustomWindowStyle(); double minwidth = 80; style.Setters.Add(new Setter(Window.MinWidthProperty, minwidth)); var desktopWorkingArea = System.Windows.SystemParameters.WorkArea; double left = desktopWorkingArea.Right - 500; double top = desktopWorkingArea.Bottom - 80 * gangLeader.OptionGroups.Count; object savedPos = PopupService.GetPosition("ActiveCharacterWidgetView", gangLeader.Name); if (savedPos != null) { double[] posArray = (double[])savedPos; left = posArray[0]; top = posArray[1]; } style.Setters.Add(new Setter(Window.LeftProperty, left)); style.Setters.Add(new Setter(Window.TopProperty, top)); ActiveCharacterWidgetViewModel viewModel = this.Container.Resolve <ActiveCharacterWidgetViewModel>(); PopupService.ShowDialog("ActiveCharacterWidgetView", viewModel, "", false, null, new SolidColorBrush(Colors.Transparent), style, WindowStartupLocation.Manual); this.eventAggregator.GetEvent <ActivateGangEvent>().Publish(gangMembers); Helper.GlobalVariables_CurrentActiveWindowName = Constants.ACTIVE_CHARACTER_WIDGET; } }
private void LoadActiveCharacterWidget(Tuple <Character, string, string> tuple) { Character character = tuple.Item1; string optionGroupName = tuple.Item2; string optionName = tuple.Item3; if (character != null && PopupService.IsOpen("ActiveCharacterWidgetView") == false) { System.Windows.Style style = Helper.GetCustomWindowStyle(); double minwidth = 80; style.Setters.Add(new Setter(Window.MinWidthProperty, minwidth)); var desktopWorkingArea = System.Windows.SystemParameters.WorkArea; double left = desktopWorkingArea.Right - 500; double top = desktopWorkingArea.Bottom - 80 * character.OptionGroups.Count; object savedPos = PopupService.GetPosition("ActiveCharacterWidgetView", character.Name); if (savedPos != null) { double[] posArray = (double[])savedPos; left = posArray[0]; top = posArray[1]; } style.Setters.Add(new Setter(Window.LeftProperty, left)); style.Setters.Add(new Setter(Window.TopProperty, top)); ActiveCharacterWidgetViewModel viewModel = this.Container.Resolve <ActiveCharacterWidgetViewModel>(); PopupService.ShowDialog("ActiveCharacterWidgetView", viewModel, "", false, null, new SolidColorBrush(Colors.Transparent), style, WindowStartupLocation.Manual); this.eventAggregator.GetEvent <ActivateCharacterEvent>().Publish(tuple); Helper.GlobalVariables_CurrentActiveWindowName = Constants.ACTIVE_CHARACTER_WIDGET; } else if (character == null && PopupService.IsOpen("ActiveCharacterWidgetView")) { this.CloseActiveCharacterWidget(null); } }
public HeroVirtualTabletopMainViewModelImpl(IEventAggregator eventAggregator, CrowdMemberExplorerViewModel crowdMemberExplorerViewModel, RosterExplorerViewModel rosterExplorerViewModel, CharacterEditorViewModel characterEditorViewModel, IdentityEditorViewModel identityEditorViewModel, AbilityEditorViewModel abilityEditorViewModel, MovementEditorViewModel movementEditorViewModel, ActiveCharacterWidgetViewModel activeCharacterWidgetViewModel, AttackConfigurationWidgetViewModel attackConfigurationWidgetViewModel, PopupService popupService, IconInteractionUtility iconInteractionUtility, DesktopContextMenu desktopContextMenu, Camera camera) { this.eventAggregator = eventAggregator; this.CrowdMemberExplorerViewModel = crowdMemberExplorerViewModel; this.RosterExplorerViewModel = rosterExplorerViewModel; this.CharacterEditorViewModel = characterEditorViewModel; this.IdentityEditorViewModel = identityEditorViewModel; this.AbilityEditorViewModel = abilityEditorViewModel; this.MovementEditorViewModel = movementEditorViewModel; this.ActiveCharacterWidgetViewModel = activeCharacterWidgetViewModel; this.AttackConfigurationWidgetViewModel = attackConfigurationWidgetViewModel; this.iconInteractionUtility = iconInteractionUtility; this.camera = camera; this.popupService = popupService; this.desktopContextMenu = desktopContextMenu; RegisterPopups(); gameInitializeTimer = new System.Threading.Timer(gameInitializeTimer_Callback, null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite); LaunchGame(); this.eventAggregator.Subscribe(this); //this.eventAggregator.GetEvent<AddToRosterEvent>().Subscribe((IEnumerable<CrowdMemberModel> models) => { this.IsRosterExplorerExpanded = true; }); //this.eventAggregator.GetEvent<EditCharacterEvent>().Subscribe((Tuple<ICrowdMemberModel, IEnumerable<ICrowdMemberModel>> tuple) => { this.IsCharacterEditorExpanded = true; }); //this.eventAggregator.GetEvent<EditIdentityEvent>().Subscribe((Tuple<Identity, Character> tuple) => { this.IsIdentityEditorExpanded = true; }); //this.eventAggregator.GetEvent<EditAbilityEvent>().Subscribe((Tuple<AnimatedAbility, Character> tuple) => { this.IsAbilityEditorExpanded = true; }); //this.eventAggregator.GetEvent<EditMovementEvent>().Subscribe((CharacterMovement cm) => { this.IsMovementEditorExpanded = true; }); //this.eventAggregator.GetEvent<CreateCrowdFromModelsEvent>().Subscribe((CrowdModel crowd) => { this.IsCrowdFromModelsExpanded = true; }); //this.eventAggregator.GetEvent<AttackInitiatedEvent>().Subscribe((Tuple<Character, Attack> tuple) => { this.IsRosterExplorerExpanded = true; }); }