private void JeopardyCardDoubleClick(object sender, MouseButtonEventArgs e) { var card = e.Source as JeopardyCard; var cardArgs = new ClickCard() { CardName = card.Name }; eventAggregator.GetEvent <PubSubEvent <ClickCard> >().Publish(cardArgs); }
/// <summary> /// Handles opening up a clue window from the card that was clicked on /// </summary> /// <param name="cardArgs"></param> private void CardClick(ClickCard cardArgs) { // Get the card that was clicked //var card = e.Source as JeopardyCard; var card = FindName(cardArgs.CardName) as JeopardyCard; // Create the new window to show over the grid ClueWindowBase window; if (IsPresenter) { window = new PresenterClueWindow() { Name = $"Clue{cardArgs.CardName}" } } ; else { window = new ClueWindow() { Name = $"Clue{cardArgs.CardName}" } }; //window.DataContext = kb; // Hook up the event that will close the window when it's double clicked window.MouseDoubleClick += (s, args) => { var clueWindow = s as ClueWindowBase; eventAggregator.GetEvent <PubSubEvent <ClickClue> >().Publish(new ClickClue { ClueName = clueWindow.Name }); }; // Set the width of the overlay window to the actual window window.Width = ActualWidth; window.Height = ActualHeight; // Place the overlay window directly over the actual window Window parentWindow = Window.GetWindow(this); Point point = card.TransformToAncestor(parentWindow).Transform(new Point(0, 0)); window.SetValue(Canvas.LeftProperty, point.X + (card.ActualWidth / 2)); window.SetValue(Canvas.TopProperty, point.Y + (card.ActualHeight / 2)); // Set the text on the overlay window window.ClueText = card.ClueText; window.ClueValue = (int)card.ClueValue; window.ClueAnswer = card.ClueAnswer; //window.TimerLength = // TODO: Add a dependency property? regular property? should be set from the main presenter window somehow? // Add the overlay window to the main window GameCanvas.Children.Add(window); kb.IsLocked = true; kb.SuspendNotifications(false); // Remove the original card so it can't be clicked on again MainGrid.Children.Remove(card); }
public void ResetThis(ClickCard resetobj) { resetobj.transform.SetParent(deactivatedHolder); resetobj.gameObject.name = string.Empty; }