Ejemplo n.º 1
0
        private void OnClick_IntitateTrade(object sender, RoutedEventArgs e)
        {
            TradeScreen tradeScreen = new TradeScreen();

            tradeScreen.DataContext = _gameSession;
            tradeScreen.ShowDialog();
        }
Ejemplo n.º 2
0
        private void OnClick_DisplayTradeScreen(object sender, RoutedEventArgs e)
        {
            TradeScreen tradeScreen = new TradeScreen();

            tradeScreen.Owner       = this;
            tradeScreen.DataContext = _gameSession; //passing the gamession by reference, therefore all changes done in tradescreen will be done in mainwindow as well.
            tradeScreen.ShowDialog();               //makes the screen modal. Can't continue until window is closed.
        }
Ejemplo n.º 3
0
        private void OnClick_DisplayTradeScreen(object sender, RoutedEventArgs e)
        {
            TradeScreen tradeScreen = new TradeScreen();

            tradeScreen.Owner       = this;
            tradeScreen.DataContext = _gameSession;
            tradeScreen.ShowDialog();
        }
Ejemplo n.º 4
0
        private void OnClick_DisplayTradeScreen(object sender, RoutedEventArgs e)
        {
            TradeScreen tradeScreen = new TradeScreen();

            tradeScreen.Owner       = this;
            tradeScreen.DataContext = _gameSession;
            tradeScreen.ShowDialog();   // Show() - creates not modal window where you can still interact and click buttons on main window | ShowDialog() - creates modal window where focus is in a new window and main window interaction is no more possible.
        }
Ejemplo n.º 5
0
 private void OnClick_DisplayTradeScreen(object sender, RoutedEventArgs e)
 {
     if (_gameSession.CurrentTrader != null)
     {
         var tradeScreen = new TradeScreen
         {
             Owner       = this,
             DataContext = _gameSession
         };
         tradeScreen.ShowDialog();
     }
 }
Ejemplo n.º 6
0
        private void OnClick_DisplayTradeScreen(object sender, RoutedEventArgs e)
        {
            TradeScreen tradeScreen = new TradeScreen(); //instantiates a new TradeScreen window

            tradeScreen.Owner = this;                    //allows us to center the trade screen on the main window
            //Doesn't actually pass the _gameSession object, passes a reference to the object. The actual object
            //only exists in one place and any other place that uses it points to that same place in memory.
            //Any changes we make to _gameSession in TradeScreen happen to this one _gameSession object.
            tradeScreen.DataContext = _gameSession;
            //Could use Show() but it displays it in a nonmodal way (user would still be able to click on buttons
            //on MainWindow. ShowDialog() means that TradeScreen is modal - locks everything else in UI out so user
            //can't click on MainWindow.
            tradeScreen.ShowDialog();
        }
Ejemplo n.º 7
0
        private void OnClick_DisplayTradeScreen(object sender, RoutedEventArgs e)
        {
            if (_gameSession.CurrentTrader != null)
            {
                //opens tradescreen window, sets the owner of the tradescreen to the main window and the datacontext to our gamesession
                //we have set the tradescreen to have a game session variable and use that as the datacontext in tradescreen.xaml.cs
                TradeScreen tradeScreen = new TradeScreen();
                tradeScreen.Owner       = this;
                tradeScreen.DataContext = _gameSession;

                //tradeScreen.Show would show the window but still click on the mainwindow. ShowDialog is modal, locks the main window until closed
                tradeScreen.ShowDialog();
            }
        }