Example #1
0
        public Window1()
        {
            InitializeComponent();
            savedProject = new ProjectData();

            //Programmaticaly add UserControls to mainwindow.
            //Did this because couldn't find a way to access the usercontrol from within the xaml.
            UserControlPrizeLevels ucpl = new UserControlPrizeLevels();
            pl = ucpl;
            this.UserControls.Children.Add(ucpl);

            GameSetupUC gsuc = new GameSetupUC();
            gs = gsuc;
            this.UserControls.Children.Add(gsuc);

            divUC = new DivisionPanelUC();
            this.UserControls.Children.Add(divUC);
            divUC.prizes = pl.plsObject;

            //Listener stuff between divisions and Prize Levels
            pl.addListener(divUC);
            gs.addListener(divUC);

            //Listeners for GameSetup so they can see player picks for validation
            gs.addListener(pl);
            gs.addListener(divUC);
            gs.addListener(this);

            this.Loaded += new RoutedEventHandler(MainWindow_Loaded);

            Screen screen = System.Windows.Forms.Screen.FromHandle(new System.Windows.Interop.WindowInteropHelper(this).Handle);
            this.MaxHeight = screen.WorkingArea.Height;
            this.Height = this.MaxHeight - 50;
        }
        /// <summary>
        /// Construct the main window
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
            _savedProjectData = new ProjectData();

            //Programmaticaly add UserControls to mainwindow.
            //Did this because couldn't find a way to access the usercontrol from within the xaml.

            // Prize Levels Column
            _userControlPrizeLevels = new UserControlPrizeLevels();
            this.UserControls.Children.Add(_userControlPrizeLevels);

            // Game Setup Column
            _gameSetupUserControl = new GameSetupUC();
            this.UserControls.Children.Add(_gameSetupUserControl);

            // Divisions Column
            _divisionPanelUserControl = new DivisionPanelUC();
            this.UserControls.Children.Add(_divisionPanelUserControl);

            // Prize levels logic
            MainWindowModel.Instance.PrizeLevelsModel = new PrizeLevels.PrizeLevels();
            _divisionPanelUserControl.prizes = MainWindowModel.Instance.PrizeLevelsModel;
            _userControlPrizeLevels.AddDefaultPrizeLevels();

            // Game setup logic
            MainWindowModel.Instance.GameSetupModel = new GameSetupModel();
            _gameSetupUserControl.DataBind();

            // Divisions logic
            MainWindowModel.Instance.DivisionsModel = new DivisionsModel();

            //Listener stuff between divisions and Prize Levels
            _userControlPrizeLevels.AddListener(_divisionPanelUserControl);

            //Listeners for GameSetup so they can see player picks for validation
            _gameSetupUserControl.AddListener(_userControlPrizeLevels);
            _gameSetupUserControl.AddListener(_divisionPanelUserControl);
            _gameSetupUserControl.AddListener(this);

            this.Loaded += new RoutedEventHandler(MainWindow_Loaded);

            Screen screen = System.Windows.Forms.Screen.FromHandle(new System.Windows.Interop.WindowInteropHelper(this).Handle);
            this.MaxHeight = screen.WorkingArea.Height;
            this.Height = this.MaxHeight - 50;
        }