Esempio n. 1
0
        private void DificultadesTarget(object sender, RoutedEventArgs e)
        {
            const int      PORCENTAJEDEDIFICULTADBAJA  = 10;
            const int      PORCENTAJEDEDIFICULTADMEDIA = 25;
            const int      PORCENTAJEDEDIFICULTADALTA  = 50;
            int            numeroDeBotonesPosibles     = 0;
            VentanaDeJuego miVentanaDeJuego            = new VentanaDeJuego();
            Inicio         ventanaDeInicioDeJuego      = new Inicio();

            numeroDeBotonesPosibles = miVentanaDeJuego.NUMERODEFILASYCOLUMNAS * miVentanaDeJuego.NUMERODEFILASYCOLUMNAS;
            RadioButton mibotonescogido = (RadioButton)e.OriginalSource;

            switch (mibotonescogido.Name.ToString())
            {
            case "rbFacil":
                //Cantidad de botones que pueden haber , de ahi sacamos el 10% el cual hara de tope para  la cantidad de minas que puede haber.

                miVentanaDeJuego.numeroDeminasMaximas = (numeroDeBotonesPosibles * PORCENTAJEDEDIFICULTADBAJA) / 100;
                miVentanaDeJuego.CreaGrid();
                miVentanaDeJuego.LLenaBotones();
                this.Close();    //Cierra la ventana actual de Inicio una vez selecionada la dificultad
                miVentanaDeJuego.ShowDialog();

                break;

            case "rbMedio":
                miVentanaDeJuego.numeroDeminasMaximas = (numeroDeBotonesPosibles * PORCENTAJEDEDIFICULTADMEDIA) / 100;
                miVentanaDeJuego.CreaGrid();
                miVentanaDeJuego.LLenaBotones();
                this.Close();
                miVentanaDeJuego.ShowDialog();

                break;

            case "rbDificil":
                miVentanaDeJuego.numeroDeminasMaximas = (numeroDeBotonesPosibles * PORCENTAJEDEDIFICULTADALTA) / 100;
                miVentanaDeJuego.CreaGrid();
                miVentanaDeJuego.LLenaBotones();
                this.Close();
                miVentanaDeJuego.ShowDialog();

                break;
            }
        }
Esempio n. 2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.VentanaPrincipal = ((BuscaMinas.VentanaDeJuego)(target));
                return;

            case 2:
                this.GridMaster = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.gridTablero = ((System.Windows.Controls.Grid)(target));
                return;

            case 4:

            #line 15 "..\..\VentanaDeJuego.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.SalirPrograma);

            #line default
            #line hidden
                return;

            case 5:
                this.btnMenuInstrucciones = ((System.Windows.Controls.MenuItem)(target));

            #line 16 "..\..\VentanaDeJuego.xaml"
                this.btnMenuInstrucciones.Click += new System.Windows.RoutedEventHandler(this.btnMenuInstrucciones_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.rbtFacil = ((System.Windows.Controls.MenuItem)(target));

            #line 18 "..\..\VentanaDeJuego.xaml"
                this.rbtFacil.Click += new System.Windows.RoutedEventHandler(this.ButtonDificultades);

            #line default
            #line hidden
                return;

            case 7:
                this.rbNormal = ((System.Windows.Controls.MenuItem)(target));

            #line 19 "..\..\VentanaDeJuego.xaml"
                this.rbNormal.Click += new System.Windows.RoutedEventHandler(this.ButtonDificultades);

            #line default
            #line hidden
                return;

            case 8:
                this.rbDificil = ((System.Windows.Controls.MenuItem)(target));

            #line 20 "..\..\VentanaDeJuego.xaml"
                this.rbDificil.Click += new System.Windows.RoutedEventHandler(this.ButtonDificultades);

            #line default
            #line hidden
                return;

            case 9:
                this.lbNumerodeBotonesSinMinas = ((System.Windows.Controls.Label)(target));
                return;

            case 10:
                this.lbNumerodeBotonesConMinas = ((System.Windows.Controls.Label)(target));
                return;
            }
            this._contentLoaded = true;
        }