Exemple #1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.controlKillsCounter = ((ShootingRange.classes.Interface.KillsCounter)(target));
                return;

            case 2:
                this.lblKillsCount = ((System.Windows.Controls.Label)(target));
                return;
            }
            this._contentLoaded = true;
        }
        public InterfaceElements(Grid grGame, StatsGrid grStats,
                                 ChoiceDialog dlgDefeat, ChoiceDialog dlgVictory)
        {
            InterfaceElements.grStats    = grStats;
            InterfaceElements.dlgDefeat  = dlgDefeat;
            InterfaceElements.dlgVictory = dlgVictory;

            bulletsCounter = new BulletsCounter()
            {
                Foreground = interfaceForeground
            };

            timer = new Timer(START_REM_TIME)
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Bottom,
                Margin     = new Thickness(25, 0, 25, 15),
                Foreground = interfaceForeground
            };

            killsCounter = new KillsCounter()
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Top,
                Margin     = new Thickness(25, 25, 25, 0),
                Foreground = interfaceForeground
            };

            InterfaceElContainer container = new InterfaceElContainer(bulletsCounter)
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Bottom
            };

            Grid.SetZIndex(container, 2);
            grGame.Children.Add(container);

            container = new InterfaceElContainer(killsCounter, timer)
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Bottom,
                Height = 200
            };
            Grid.SetZIndex(container, 2);
            grGame.Children.Add(container);
        }