Exemplo n.º 1
0
        public Window1()
        {
            InitializeComponent();
            KeyEvent ke = new KeyEvent(this);

            this.KeyDown  += new KeyEventHandler(OnButtonKeyDown);
            tower          = new TowerConroller();
            blockContainer = new BlockContainer();

            SpawnNewBlock();
            SpawnNewEnemyBlock();
            StartBlocksMovement();
            try
            {
                SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
                builder.DataSource     = "towerblocks.database.windows.net";
                builder.UserID         = "towerblocks";
                builder.Password       = "******";
                builder.InitialCatalog = "test";
                connection             = new SqlConnection(builder.ConnectionString);

                Console.WriteLine("\nQuery data example:");
                Console.WriteLine("=========================================\n");

                connection.Open();

                try
                {
                    using (var command = connection.CreateCommand())
                    {
                        command.CommandText = "CREATE TABLE blocks (id INTEGER PRIMARY KEY , x INTEGER, username VARCHAR(50));";
                        command.ExecuteNonQuery();
                        Console.WriteLine("Finished creating table");
                    }
                }catch (SqlException e)
                {
                }
                System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
                timer.Tick    += ReadEnemyData;
                timer.Interval = new TimeSpan(0, 0, 0, 1, 0);
                timer.Start();
                Console.WriteLine(connection.State);
            }
            catch (SqlException e)
            {
                Console.WriteLine(e.ToString());
            }
            Console.ReadLine();
            Proxy proxy = new DatabaseProxy();

            EnemyXCoordinate = proxy.getDatabaseResponse(connection, 1);

            //BlockUi = new BlockUi();
        }
        public Window1()
        {
            InitializeComponent();
            KeyEvent ke = new KeyEvent(this);

            this.KeyDown  += new KeyEventHandler(OnButtonKeyDown);
            tower          = new TowerConroller();
            blockContainer = new BlockContainer();

            SpawnNewBlock();

            StartBlocksMovement();
            //BlockUi = new BlockUi();
        }
Exemplo n.º 3
0
        public Window1()
        {
            InitializeComponent();
            b = new Block();
            KeyEvent ke = new KeyEvent(this);

            this.KeyDown  += new KeyEventHandler(OnButtonKeyDown);
            tower          = new TowerConroller();
            blockContainer = new BlockContainer();
            v = new Caretaker();
            health.Content     = Settings.healths;
            scoreLabel.Content = Settings.totalPoints;

            SpawnNewBlock();

            AbstractExpression query  = new Select("*", new From("users"));
            Context            ctx    = new Context();
            List <string>      result = query.Interpret(ctx);

            Console.WriteLine(result[0]);
            //SpawnNewEnemyBlock();
            StartBlocksMovement();
            //try
            //{

            //    SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
            //    builder.DataSource = "towerblocks.database.windows.net";
            //    builder.UserID = "towerblocks";
            //    builder.Password = "******";
            //    builder.InitialCatalog = "test";
            //    connection = new SqlConnection(builder.ConnectionString);

            //    Console.WriteLine("\nQuery data example:");
            //    Console.WriteLine("=========================================\n");

            //    connection.Open();

            //    try
            //    {
            //        using (var command = connection.CreateCommand())
            //        {
            //            command.CommandText = "CREATE TABLE blocks (id INTEGER PRIMARY KEY , x INTEGER, username VARCHAR(50));";
            //            command.ExecuteNonQuery();
            //            Console.WriteLine("Finished creating table");
            //        }
            //    }catch(SqlException e)
            //    {

            //    }
            //    System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
            //    timer.Tick += ReadEnemyData;
            //    timer.Interval = new TimeSpan(0, 0, 0, 1, 0);
            //    timer.Start();
            //    Console.WriteLine(connection.State);

            //}
            //catch (SqlException e)
            //{
            //    Console.WriteLine(e.ToString());
            //}
            Console.ReadLine();

            //BlockUi = new BlockUi();
        }