コード例 #1
0
        private void TiempoCumplido()
        {
            bloque.TiempoCumplido();

            //Si se cumplio el bloque completo (propiedades ProductivoCumplido y DescansoCumplido = true) y modo auto = true, se reinicia el temporizador
            if (bloque.ProductivoCumplido && bloque.DescansoCumplido)
            {
                bloque.ResetBloque();

                if (ModoAutomatico)
                {
                    temporizador.Minutos = bloque.MinutosProductivos;

                    if (bloque.MinutosProductivos > 60)
                    {
                        TemporizadorGrafico.Hora = (int)Math.Floor((decimal)(bloque.MinutosProductivos / 60));
                    }
                    TemporizadorGrafico.Minuto = bloque.MinutosProductivos % 60;

                    temporizador.Segundos = 0;
                    temporizador.Minutos  = bloque.MinutosProductivos;
                    temporizador.Horas    = 0;

                    temporizador.Start();
                    this.Dispatcher.Invoke(TemporizadorGrafico.StartTemporizador);

                    bloque.EstadoBloque = (int)Clases.Estado.Productivo;
                    this.Dispatcher.Invoke(ActualizarLabelEstado);
                }
            }
            else if (bloque.ProductivoCumplido) //Si solo esta cumplido TiempoProductivo se inicia temporizador con TiempoDescanso
            {
                temporizador.Minutos = bloque.MinutosDescanso;

                if (bloque.MinutosDescanso > 60)
                {
                    TemporizadorGrafico.Hora = (int)Math.Floor((decimal)(bloque.MinutosDescanso / 60));
                }
                TemporizadorGrafico.Minuto = bloque.MinutosDescanso % 60;

                temporizador.Segundos = 0;
                temporizador.Minutos  = bloque.MinutosDescanso;
                temporizador.Horas    = 0;

                temporizador.Start();
                this.Dispatcher.Invoke(TemporizadorGrafico.StartTemporizador);

                bloque.EstadoBloque = (int)Clases.Estado.Descanso;
                this.Dispatcher.Invoke(ActualizarLabelEstado);
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: NeXuZZ-SCM/RelojSimple
        public Form1()
        {
            InitializeComponent();
            Temporizador.Start();


            #region leer Ciudad
            string      cadenaConexion = "http://api.openweathermap.org/data/2.5/weather?q=Provincia%20de%20Buenos%20Aires,AR&mode=xml&appid=84145534d9102d50c07556d4e63b704d&lang=es&units=metric";
            XmlDocument documentoXML   = new XmlDocument();
            documentoXML.Load(cadenaConexion);

            string ciudad = documentoXML.DocumentElement.SelectSingleNode("city").Attributes["name"].Value;
            lbl_ciudad.Text = ciudad;
            string temperatura = documentoXML.DocumentElement.SelectSingleNode("temperature").Attributes["value"].Value;
            lbl_temp.Text = temperatura + " ºC";
            string humedad = documentoXML.DocumentElement.SelectSingleNode("humidity").Attributes["value"].Value;
            lbl_humedad.Text = humedad + "%";
            string presion = documentoXML.DocumentElement.SelectSingleNode("pressure").Attributes["value"].Value;
            lbl_presion.Text = presion;
            string presionUnidad = documentoXML.DocumentElement.SelectSingleNode("pressure").Attributes["unit"].Value;
            lbl_uPr.Text = presionUnidad;

            string cielo = documentoXML.DocumentElement.SelectSingleNode("weather").Attributes["value"].Value;
            lbl_cielo.Text = cielo;

            #endregion
        }
コード例 #3
0
 private void frmPrincipal_MouseMove(object sender, MouseEventArgs e)
 {
     if (Temporizador.Enabled == false)
     {
         Temporizador.Start();
     }
 }
コード例 #4
0
 public void ActivarTemporizadorAutoSave()
 {
     if (!cerrando)
     {
         guardado = false;
         temporizadorAutoSave.StopAndAbort();
         temporizadorAutoSave.Start();
     }
 }
コード例 #5
0
 private void frmMonitor2_Load(object sender, EventArgs e)
 {
     cargarEntrada();
     OrderIdPendiente    = 0;
     frmDetalle.TopLevel = false;
     flowPanelFinalizado.Controls.Add(frmDetalle);
     Temporizador.Start();
     timerCambios.Start();
     timerVisibilidadporCategorias.Start();
 }
コード例 #6
0
    public void Disparar(Entidad entidad)
    {
        if (disparoprefab == null)
        {
            Debug.LogError("No contiene un proyectil valido.");
            return;
        }
        if (IsActivo())
        {
            Proyectil p = (Proyectil)disparoprefab.Create(entidad.transform.parent, transform.position, entidad);
            p.Disparar(transform.forward);
            eventodisparo.Invoke();

            temporizador.Start();
        }
    }
コード例 #7
0
ファイル: Form1.cs プロジェクト: NeXuZZ-SCM/RelojSimple
 private void button2_Click(object sender, EventArgs e)
 {
     Temporizador.Start();
 }
コード例 #8
0
ファイル: frmForm1.cs プロジェクト: carbajalmarcos/ulp2017
 private void Form1_Load(object sender, EventArgs e)
 {
     Temporizador.Interval = 5000;
     Temporizador.Start();
     lblEstado.Text = "ABIERTO";
 }
コード例 #9
0
        /// <summary>
        /// Tratamento do evento clicar no botão, a função vai desencadear o fucionamento do jogo consoante o modo de jogo (Modo Normal ou Inverso).
        /// Faz o tratamento do botão esquerdo assim como do botão direito.
        /// </summary>
        /// <param name="sender">Botão</param>
        /// <param name="e">Foi premido rato esquerdo ou direito</param>
        public void OnButtonClicked(object sender, MouseEventArgs e)
        {
            // Se o Jogador se encontra a jogar no Modo normal, os botões funcionam desta maneira...
            if (Program.M_Options.ModoJogo == GameMode.Normal)
            {
                // Botão esquerdo, abre espaço
                if (e.Button == MouseButtons.Left)
                {
                    Temporizador.Start();
                    //// Obter Botão premido e guardar
                    var botaoAtual = (sender as Button);

                    // Obtém as Coordenadas do Tile
                    GetCoordinates(botaoAtual, out int x, out int y);

                    Tile currentTile = GetTile(new System.Drawing.Point(x, y));

                    if (currentTile.TemMina == true)
                    {
                        //	Jogo perdido
                        Temporizador.Stop();

                        V_MineSweeperGame.ChangeButtonBackGround(botaoAtual, Resources.bomb);
                        Reveal();
                        BombaFimJogo();

                        // O jogo acaba
                        V_MineSweeperGame_AskToResetBoard();
                    }
                    else if (currentTile.Vazio == false && currentTile.Aberto == false)
                    {
                        ButtonChangeBackground(botaoAtual, currentTile);

                        currentTile.Aberto = true;
                        if (M_Options.SoundOnOrOFF == true)
                        {
                            Thread soundThread = new Thread(Sound.PlayOpenTile)
                            {
                                IsBackground = true
                            };
                            soundThread.Start();
                        }

                        // Se a condição for verdadeira a condição acaba
                        if (TestarFim(currentTile) == true)
                        {
                            GanhouJogo();
                        }
                        //soundThread.Abort();
                    }
                    // O jogo tem que abrir todos os vazios adjacentes.
                    // Primeira Questão: Como pedir os botões adjacentes ao view?
                    else if (currentTile.Vazio == true && currentTile.Aberto == false)
                    {
                        Flood_Fill(currentTile, V_MineSweeperGame.GetButton(currentTile.Ponto));
                    }
                }

                // Botão direito, coloca flag
                else if (e.Button == MouseButtons.Right)
                {
                    Button botaoAtual = sender as Button;
                    GetCoordinates(botaoAtual, out int x, out int y);

                    // Obtém as Coordenadas do Tile
                    Tile currentTile = GetTile(new System.Drawing.Point(x, y));

                    if (currentTile.Aberto != true)
                    {
                        if (M_Options.SoundOnOrOFF == true)
                        {
                            Thread soundThread = new Thread(Sound.PlayPutFlag)
                            {
                                IsBackground = true
                            };
                            soundThread.Start();
                        }

                        if (currentTile.Flagged == true)
                        {
                            V_MineSweeperGame.ChangeButtonBackGround(botaoAtual, Resources.unopened);
                            currentTile.Flagged = false;
                            M_Grelha.NumFlags--;
                            V_MineSweeperGame.AtualizaNumeroMinasDisponiveis(M_Grelha.NumMinasTotal - M_Grelha.NumFlags);
                        }
                        else if (currentTile.Flagged == false)
                        {
                            V_MineSweeperGame.ChangeButtonBackGround(botaoAtual, Resources.flag1);
                            currentTile.Flagged = true;
                            M_Grelha.NumFlags++;
                            V_MineSweeperGame.AtualizaNumeroMinasDisponiveis(M_Grelha.NumMinasTotal - M_Grelha.NumFlags);
                        }
                        //soundThread.Abort();
                    }
                    else
                    {
                        return;
                    }
                }
            }

            // O jogo funciona em modo inverso, o jogador tem que detetar o posicionamento das minas
            else if (Program.M_Options.ModoJogo == GameMode.Inverso)
            {
                if (e.Button == MouseButtons.Left)
                {
                    Temporizador.Start();

                    Button botaoAtual = sender as Button;
                    GetCoordinates(botaoAtual, out int x, out int y);

                    // Obtém as Coordenadas do Tile
                    Tile currentTile = GetTile(new System.Drawing.Point(x, y));

                    if (currentTile.Aberto != true)
                    {
                        if (M_Options.SoundOnOrOFF == true)
                        {
                            Thread soundThread = new Thread(Sound.PlayPutFlag)
                            {
                                IsBackground = true
                            };
                            soundThread.Start();
                        }

                        if (currentTile.Flagged == true)
                        {
                            V_MineSweeperGame.ChangeButtonBackGround(botaoAtual, Resources.unopened);
                            currentTile.Flagged = false;
                            M_Grelha.NumFlags--;
                            V_MineSweeperGame.AtualizaNumeroMinasDisponiveis(M_Grelha.NumMinasTotal - M_Grelha.NumFlags);
                        }
                        else if (currentTile.Flagged == false)
                        {
                            if (Program.M_Grelha.NumMinasTotal == M_Grelha.NumFlags)
                            {
                                return;
                            }
                            V_MineSweeperGame.ChangeButtonBackGround(botaoAtual, Resources.flag1);
                            currentTile.Flagged = true;
                            M_Grelha.NumFlags++;
                            V_MineSweeperGame.AtualizaNumeroMinasDisponiveis(M_Grelha.NumMinasTotal - M_Grelha.NumFlags);
                        }
                        //soundThread.Abort();
                    }

                    if (TestarFimModoInverso(currentTile) == true)
                    {
                        GanhouJogo();
                    }
                    else
                    {
                        return;
                    }
                }
                else if (e.Button == MouseButtons.Right)
                {
                    return;
                }
            }
        }
コード例 #10
0
 private void Splash_Load(object sender, EventArgs e)
 {
     Temporizador.Start();
 }