Esempio n. 1
0
        static void Main1(string[] args)
        {
            Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

            IConsole console = new DotNetConsole();

            Grid grid = ElementFactory.CreateGrid(i => i
                                                  .Target(console)
                                                  .Size(1, 4)
                                                  );

            grid.Add(0, 0, new Text("Publish channel:"));
            grid.Add(0, 1, new Button("Debug"));
            grid.Add(0, 2, new Button("Keyuser"));
            grid.Add(0, 3, new Button("Release"));

            foreach (var element in grid.EnumerateElements())
            {
                if (element != null)
                {
                    element.OnEnterPressed += ButtonClick;
                }
            }

            while (true)
            {
                grid.Render();
                grid.HandleInput();
            }
        }
Esempio n. 2
0
        public void ThrowsExceptionWhenAttemptingToUpdateElementThatDoesNotExist()
        {
            var coll = GetTestEdificeCollection();
            var grid = ElementFactory.CreateGrid(new GridCreationParameters());

            Assert.Throws <Exception>(() => coll.UpdateElement(grid));
        }
Esempio n. 3
0
        public void CanCreateAGrid()
        {
            var grid = ElementFactory.CreateGrid(new GridCreationParameters()
            {
                Name = "A10",
            });
            var grid1 = ElementFactory.Collection.FindElementById(grid.Id);

            Assert.NotNull(grid1);
        }
Esempio n. 4
0
        static void Main2(string[] args)
        {
            IConsole console = new DotNetConsole();

            Grid grid = ElementFactory.CreateGrid(i => i
                                                  .Target(console)
                                                  .Size(4, 4)
                                                  );

            grid.Add(0, 0, ElementFactory.CreateText(i => i
                                                     .Text("0,0")
                                                     .Colors(Color.DarkYellow, Color.DarkBlue)
                                                     ));


            grid.Add(0, 1, new Button("0,1"));
            grid.Add(2, 0, new Button("2,0"));
            grid.Add(1, 1, new Button("1,1"));
            grid.Add(1, 2, new Button("1,2"));
            grid.Add(2, 1, new Button("2,1"));

            grid.Add(2, 2, ElementFactory.CreateButton(i => i
                                                       .Text("2.2")
                                                       .Colors(Color.DarkRed, Color.Blue)
                                                       .Highlight(Color.Green, Color.Magenta)
                                                       ));

            grid.Add(1, 0, new Text("Text asdf"));

            Grid subGrid = ElementFactory.CreateGrid(i => i
                                                     .Target(console)
                                                     .Size(1, 4)
                                                     .Text("Deploy application")
                                                     .Colors(Color.Red, Color.Black)
                                                     .Highlight(Color.Black, Color.Red)
                                                     );

            subGrid.Add(0, 0, new Button("Debug"));
            subGrid.Add(0, 1, new Button("Keyuser"));
            subGrid.Add(0, 2, ElementFactory.CreateButton(i => i
                                                          .Text("Release")
                                                          .Pressed((sender, param) => { System.Diagnostics.Debug.WriteLine("Release button pressed. Param: " + (int)param); }, 12)
                                                          ));

            grid.Add(0, 2, subGrid);

            while (true)
            {
                grid.Render();
                grid.HandleInput();
            }
        }
Esempio n. 5
0
        private Grid(GridCreationParameters parameters)
        {
            var grid = EdificeObjectManager.FindElement() as EdificeCore.Grid;

            if (grid == null)
            {
                grid = ElementFactory.CreateGrid(parameters);
            }
            else
            {
                grid.Name  = parameters.Name;
                grid.Plane = parameters.Plane;
                grid.Start = parameters.Start;
                grid.End   = parameters.End;
            }

            InternalElement = grid;

            EdificeObjectManager.RegisterTraceableObjectForId(new TraceableId(grid.Id), grid);
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");

            Grid grid = ElementFactory.CreateGrid(i => i
                                                  .Target(new DotNetConsole())
                                                  .Size(2, 2)
                                                  );

            grid.Add(0, 0, new Button("0, 0"));
            grid.Add(1, 0, new Button("1, 0"));
            grid.Add(0, 1, ElementFactory.CreateButton(i => i
                                                       .Text("<-span->")
                                                       .ColumnSpan(2)
                                                       ));

            while (true)
            {
                grid.Render();
                grid.HandleInput();
            }
        }