示例#1
0
        private async void NewMethod(Connection connection, ConnectionToAPI connectionToAPI, TextField inputLabel)
        {
            connection.InsertData(inputLabel.Text, await connectionToAPI.GetWord(inputLabel.Text));
            var messageBox = Dialog.CreateMessageBox("Adding information", "Topic added secuesfully");

            messageBox.ShowModal(_host);
        }
示例#2
0
        public AdminWindow(Game1 game1, Connection connection, ConnectionToAPI connectionToAPI)
        {
            this.game1           = game1;
            MyraEnvironment.Game = game1;
            this.connection      = connection;
            this.connectionToAPI = connectionToAPI;
            var grid = new Grid
            {
                RowSpacing    = 8,
                ColumnSpacing = 8,
                ShowGridLines = true
            };

            grid.ColumnsProportions.Add(new Grid.Proportion(Grid.ProportionType.Auto));
            grid.ColumnsProportions.Add(new Grid.Proportion(Grid.ProportionType.Auto));
            grid.ColumnsProportions.Add(new Grid.Proportion(Grid.ProportionType.Auto));
            grid.RowsProportions.Add(new Grid.Proportion(Grid.ProportionType.Auto));
            grid.RowsProportions.Add(new Grid.Proportion(Grid.ProportionType.Auto));
            grid.RowsProportions.Add(new Grid.Proportion(Grid.ProportionType.Auto));
            grid.RowsProportions.Add(new Grid.Proportion(Grid.ProportionType.Auto));

            var addBtn = new Button
            {
                Text       = "Add",
                Width      = 150,
                GridColumn = 1,
                GridRow    = 1
            };

            grid.Widgets.Add(addBtn);
            var inputLabel = new TextField
            {
                GridColumn = 1,
                GridRow    = 0,
                Width      = 150
            };

            grid.Widgets.Add(inputLabel);
            _host = new Desktop();
            _host.Widgets.Add(grid);

            addBtn.MouseDown += (s, a) =>
            {
                NewMethod(connection, connectionToAPI, inputLabel);
            };

            var backButton = new Button
            {
                Text       = "Back",
                GridColumn = 1,
                GridRow    = 2
            };

            grid.Widgets.Add(backButton);

            backButton.MouseDown += (s, a) =>
            {
                desireState = State.Welcome;
            };
        }
示例#3
0
 public Game1(Connection connection, ConnectionToAPI connectionToAPI)
 {
     this.connection       = connection;
     graphics              = new GraphicsDeviceManager(this);
     this.connectionToAPI  = connectionToAPI;
     Content.RootDirectory = "Content";
     IsMouseVisible        = true;
 }
示例#4
0
        private static void Main()
        {
            Connection connection = new Connection();

            connection.Connect();
            ConnectionToAPI connectionToAPI = new ConnectionToAPI();

            using (var game = new Game1(connection, connectionToAPI))
                game.Run();
        }