예제 #1
0
        public async Task <String> StreamsData()
        {
            Table table = new Table();
            Row   row   = new Row(false, true);

            row.AddColumn(new TextColumn(0, "StreamName", true));
            row.AddColumn(new TextColumn(1, "Type"));
            row.AddColumn(new TextColumn(2, ""));
            row.AddColumn(new TextColumn(3, ""));
            row.AddColumn(new TextColumn(4, ""));
            table.AddRow(row);
            foreach (var stream in _context.StreamModels)
            {
                Row newrow = new Row();
                newrow.AddColumn(new TextColumn(0, stream.StreamName));
                newrow.AddColumn(new TextColumn(1, stream.Type.ToString()));
                newrow.AddColumn(new StreamEditColumn(2, "Edit", stream));
                if (stream.Type == StreamProviderTypes.Twitch)
                {
                    newrow.AddColumn(new LinkColumn(3, "Authorisieren", $"/Stream/TwitchOAuth/{stream.ID}"));
                }
                else
                {
                    newrow.AddColumn(new TextColumn(3, ""));
                }
                newrow.AddColumn(new StreamDeleteColumn(4, "Delete", stream));

                table.AddRow(newrow);
            }
            return(table.getJson());
        }
예제 #2
0
        public async Task <String> SubscriptionsData()
        {
            ChatUserModel usermodel = await _userManager.GetUserAsync(this.User);

            List <StreamSubscription> streamsubs = _context.StreamSubscriptions.Include(ss => ss.User).Include(ss => ss.Stream).Where(ss => ss.User == usermodel).ToList();
            Table table = new Table();
            Row   row   = new Row(false, true);

            row.AddColumn(new TextColumn(0, "StreamName", true));
            row.AddColumn(new TextColumn(1, "Sub Status"));
            table.AddRow(row);
            //TODO Second Request for Streams not yet added

            foreach (var streamsub in streamsubs)
            {
                Row newrow = new Row();
                newrow.AddColumn(new TextColumn(0, streamsub.Stream.StreamName));
                if (streamsub.Subscribed == SubscriptionState.Subscribed)
                {
                    newrow.AddColumn(new StreamSubColumn(1, true, streamsub.ID));
                }
                else
                {
                    newrow.AddColumn(new StreamSubColumn(1, false, streamsub.ID));
                }
                table.AddRow(newrow);
            }
            return(table.getJson());
        }
예제 #3
0
        public Container CreateEpisodeMenuContainer()
        {
            ///////Container
            var container = new Container();

            container.SetTexture(TextureManager.CreateTexture2DBySingleColor(new Color(143, 166, 225)));
            container.SetSize(new Vector2(250, 200));
            container.SetFrame(Color.Black);


            var firstRow = new Row();

            firstRow.SetTexture(TextureManager.CreateTexture2D("Textures/coral"));

            var secondRow = new Row();

            secondRow.SetTexture(TextureManager.CreateTexture2DByRandomColor());

            container.AddRow(firstRow, 80);
            container.AddRow(secondRow, 20);
            container.PrepareRows();
            container.SetDragable(true);

            var column1 = new Column();

            column1.SetTexture(TextureManager.CreateTexture2DByRandomColor());

            var column2 = new Column();

            column2.SetTexture(TextureManager.CreateTexture2DByRandomColor());


            //secondRow.PrepareColumns(floatTo:"left");

            //cr2c1.SetPadding(new Vector2(10));

            secondRow.AddColumn(column1, 20);
            secondRow.AddColumn(column2, 80);
            secondRow.PrepareColumns(isCentralized: true, floatTo: "left");

            lastTriangle = Triangle.PlayButton(Color.Green);
            column1.AddImage(lastTriangle.Texture);


            column2.SetFont("Episode 1", Color.White);

            column2.Font.SetLayerDepth(0.55f);

            return(container);
        }
예제 #4
0
        public void GenerateLayout()
        {
            // ===== Generate empty document =====
            // Create one full-width column composed of n-rows
            Column outerColumn = flyweightFactory.CreateColumn(20);

            doc.Columns.Add(outerColumn);

            // For row 5, give it 2 columns, one with 3 rows and another with 2 rows
            Row rowWithColumns = outerColumn.Rows[4];

            rowWithColumns.AddColumn(flyweightFactory.CreateColumn(3));
            rowWithColumns.AddColumn(flyweightFactory.CreateColumn(2));
        }
예제 #5
0
        public ScrollBar SetScrollBar()
        {
            //column = new Column();

            Column[] columns = new Column[125];


            for (int i = 0; i < columns.Length; i++)
            {
                var container = new Container();

                var row = new Row();
                row.SetTexture();
                container.AddRow(row, 70);

                var row2 = new Row();
                row2.SetTexture();
                container.AddRow(row2, 30);

                var row2Column1 = new Column();
                row2Column1.SetTexture(Color.Black);
                row2.AddColumn(row2Column1, 30);
                row2Column1.AddImage(Triangle.PlayButton(Color.Yellow).Texture);

                var row2Column2 = new Column();
                row2Column2.SetTexture();
                row2Column2.SetFont("Level : " + i);
                row2.AddColumn(row2Column2, 70);

                container.PrepareRows();
                row2Column1.SetPadding(Offset.CreatePadding(OffsetValueType.Ratio, 10, 10, 10, 10));

                var column1 = new Column();
                column1.AddChild(container);

                columns[i] = column1;

                column1.SetFrame(Color.Yellow);
            }


            var scrollBar = new ScrollBar(rowsCountToShow: 3, rowPadding: Offset.CreatePadding(OffsetValueType.Ratio, 5, 5, 5, 5), columns: columns);

            scrollBar.SetActive(true);

            return(scrollBar);
        }
        public async Task <string> Data()
        {
            Table table  = new Table();
            Row   Header = new Row(false, true);

            Header.AddColumn(new TextColumn(0, "Command", true));
            Header.AddColumn(new TextColumn(1, "Text", false));
            Header.AddColumn(new TextColumn(2, "Mode", false));
            Header.AddColumn(new TextColumn(3, "AutoInterval", false));
            Header.AddColumn(new TextColumn(4, "Stream", true));
            Header.AddColumn(new TextColumn(5, ""));
            Header.AddColumn(new TextColumn(6, ""));
            table.AddRow(Header);
            foreach (var command in _context.StreamCommand.Include(sc => sc.stream))
            {
                Row commandrow = new Row();
                commandrow.AddColumn(new TextColumn(0, command.name));
                commandrow.AddColumn(new TextColumn(1, command.response));
                commandrow.AddColumn(new TextColumn(2, command.Mode.ToString()));
                commandrow.AddColumn(new TextColumn(3, command.AutoInverval.ToString()));
                commandrow.AddColumn(new TextColumn(4, command.stream.StreamName));
                commandrow.AddColumn(new ObjectDeleteColumn(5, "Löschen", command.DeleteLink(), command.DeleteText()));
                commandrow.AddColumn(new StreamCommandEditColumn(6, "Edit", command.ID));

                table.AddRow(commandrow);
            }

            return(table.getJson());
        }
예제 #7
0
        public void Row_AddColumn_NewColumnExists()
        {
            var row = new Row();

            row.AddColumn("Foo", 10);

            Assert.IsTrue(row.Columns.Any(c => c == "Foo"));
            Assert.AreEqual(10, row.Get("Foo"));
        }
예제 #8
0
        public async Task <string> QuotesData()
        {
            Table table  = new Table();
            Row   Header = new Row(false, true);

            Header.AddColumn(new TextColumn(0, "Streamer", true));
            Header.AddColumn(new TextColumn(1, "Erstellt", false));
            Header.AddColumn(new TextColumn(2, "Quote", false));
            Header.AddColumn(new TextColumn(3, "ID", false));
            table.AddRow(Header);
            foreach (var quote in _context.Quotes)
            {
                Row quoterow = new Row();
                quoterow.AddColumn(new TextColumn(0, quote.Streamer));
                quoterow.AddColumn(new TextColumn(1, quote.Created.ToString("dd MMMM yyyy")));
                quoterow.AddColumn(new TextColumn(2, quote.Text));
                quoterow.AddColumn(new TextColumn(3, quote.Id.ToString()));
                table.AddRow(quoterow);
            }

            return(table.getJson());
        }
예제 #9
0
        public void Row_Fluent_BuildAndTransform()
        {
            var row = new Row();

            row.AddColumn("Name", "John").AddColumn("Age", 25).AddColumn("IsDead", false).Transform(r =>
            {
                r["Age"]    = 60;
                r["IsDead"] = true;

                return(r);
            }).RenameColumn("Name", "FirstName");

            Assert.AreEqual(60, row["Age"]);
            Assert.AreEqual(true, row["IsDead"]);
            Assert.AreEqual("John", row["FirstName"]);
        }
예제 #10
0
        public EpisodeCard()
        {
            var sizeX1 = Global.ViewportWidth * 90 / 100;

            var sizeX2 = Global.ViewportWidth * 10 / 100;

            var scale = new Vector2(150 * Global.Scale.X, 150 * Global.Scale.Y / Global.ViewportHeight);

            SetSize(new Vector2(Global.ViewportWidth, Global.ViewportHeight));

            SetTexture(TextureManager.CreateTexture2DBySingleColor(Color.SeaShell));

            var leftSideContainer = new Container();

            //leftSideContainer.SetTexture(TextureManager.CreateTexture2DBySingleColor(Color.SlateBlue));
            leftSideContainer.SetSize(new Vector2(sizeX1, Global.ViewportHeight));

            var row1 = new Row();

            row1.MakeFrameVisible(true);
            //  row1.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            row1.SetFrame(Color.Tan);

            var column1 = new Column();

            column1.SetTexture(TextureManager.CreateTexture2DBySingleColor(Color.Red, 1, 1));

            var column2 = new Column();

            column2.SetTexture(TextureManager.CreateTexture2DBySingleColor(Color.Green, 1, 1));

            var column3 = new Column();

            column3.SetTexture(TextureManager.CreateTexture2DBySingleColor(Color.Blue, 1, 1));

            row1.AddColumn(column1, 25);
            row1.AddColumn(column2, 25);
            row1.AddColumn(column3, 25);


            leftSideContainer.AddRow(row1, 33);


            var row2 = new Row();

            row2.MakeFrameVisible(true);
            row2.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            row2.SetFrame(Color.Tan);

            leftSideContainer.AddRow(row2, 33);

            var row3 = new Row();

            row3.MakeFrameVisible(true);
            row3.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            row3.SetFrame(Color.Tan);

            leftSideContainer.AddRow(row3, 33);

            leftSideContainer.PrepareRows(true);


            //var rightSideContainer = new Container();
            //rightSideContainer.SetTexture(TextureManager.CreateTexture2DBySingleColor(Color.Tan));
            //rightSideContainer.SetPosition(new Vector2(leftSideContainer.Position.X + leftSideContainer.Size.X, leftSideContainer.Position.Y));
            //rightSideContainer.SetSize(new Vector2(sizeX2, Global.ViewportHeight));



            //container.SetSize(new Vector2(200, 150));
            ////container.SetColor(Color.MonoGameOrange);
            //container.SetTexture(TextureManager.CreateTexture2DByRandomColor(1,1));
            //container.SetMargin(new Vector2(10, 10));

            leftSideContainer.SetVisible(false);
            AddChild(leftSideContainer);
            //       AddChild(rightSideContainer);

            //rightSideContainer.SetVisible(false);

            //var scrollBarRow = new Row();
            //scrollBarRow.SetFrame(Color.Black,2f);
            //scrollBarRow.MakeFrameVisible(true);

            //var columnX = new Column();
            //columnX.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            //scrollBarRow.AddColumn(columnX,80);

            ////rightSideContainer.AddChild(scrollBar);
            //rightSideContainer.SetName("rightSideContainer");
            //rightSideContainer.AddRow(scrollBarRow, 1, 33);
            //rightSideContainer.PrepareRows(true);

            var scrollBar = new ScrollBar(3, 3);

            scrollBar.LoadContent(TextureManager.CreateTexture2DBySingleColor(Color.Tan));
            scrollBar.SetPosition(new Vector2(leftSideContainer.Position.X + leftSideContainer.Size.X, leftSideContainer.Position.Y));
            scrollBar.SetSize(new Vector2(sizeX2, Global.ViewportHeight));
            scrollBar.SetFrame(Color.Red, 2f);
            scrollBar.SetName("ScrollBar");
            scrollBar.PrepareRows(true);
            AddChild(scrollBar);
        }
예제 #11
0
        /// <summary>
        /// Add a row to the AvtiveWorksheet
        /// </summary>
        /// <param name="row"></param>
        /// <param name="card"></param>
        private static void AddRow(Row row, XContainer card)
        {
            Debug.Assert(row != null, "row = null");
            Debug.Assert(card != null, "card = null");

            foreach (var e in card.Elements().Select(a => a))
            {
                row.AddColumn().Value = e.Value;
            }
        }
예제 #12
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            InputManager.IsActive = true;

            var scrollBarColumns = new Column[16];

            for (int i = 0; i < scrollBarColumns.Length; i++)
            {
                scrollBarColumns[i] = new Column();


                //scrollBarColumns[i].SetFrame(Color.Black);

                //scrollBarColumns[i].SetTexture(TextureManager.CreateTexture2DByRandomColor());
            }

            scrollBar = new ScrollBar(3, 3, 2.5f, null, scrollBarColumns);
            //scrollBar.LoadContent(TextureManager.CreateTexture2DBySingleColor(Color.Tan));
            //scrollBar.SetFrame(Color.Yellow,2f);
            //scrollBar.PrepareRows(true);

            scrollBar.SetFrame(makeFrameVisible: false);
            scrollBar.RefreshRectangle();

            var firstScrollBarRow       = scrollBar.Rows.FirstOrDefault();
            var firstScrollBarRowColumn = firstScrollBarRow.Columns.FirstOrDefault();

            var c = new Column();

            c.SetTexture(TextureManager.CreateTexture2DByRandomColor());

            c.SetSize(new Vector2(50, 50));
            //c.IncreaseLayerDepth();
            c.SetFont("Hewllow", Color.Yellow);


            firstScrollBarRowColumn.AddChild(c);



            container = new Container();
            container.SetDragable();
            container.SetTexture(TextureManager.CreateTexture2DBySingleColor(Color.Beige));
            container.SetSize(new Vector2(300, 200));


            var row = new Row();

            row.SetTexture(TextureManager.CreateTexture2DBySingleColor(new Color(36, 220, 151)));
            container.AddRow(row, 100);
            var r1c1 = new Column();

            r1c1.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            row.AddColumn(r1c1, 30);

            var r1c2 = new Column();

            r1c2.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            row.AddColumn(r1c2, 30);

            var r1c3 = new Column();

            r1c3.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            row.AddColumn(r1c3, 30);



            var row2 = new Row();

            row2.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            container.AddRow(row2, 100);

            var row3 = new Row();

            row3.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            container.AddRow(row3, 100);

            var row4 = new Row();

            row4.SetTexture(TextureManager.CreateTexture2DByRandomColor());
            container.AddRow(row4, 100);

            container.PrepareRows();

            row.PrepareColumns(true, "right");


            cnt = CreateEpisodeMenuContainer();

            var x = 100;

            TextColumn = new Column();
            TextColumn.SetPosition(new Vector2(250, 250));
            TextColumn.SetSize(new Vector2(250, 200));
            TextColumn.SetFrame(Color.BlanchedAlmond);
            TextColumn.SetDragable(true);
            TextColumn.SetFont("Buttton1001", Color.Blue);

            TextColumn.AddChild(cnt);



            ////////------------

            //Button b = new Button("Play with me",new Vector2(400,150));
            //cr2c1.AddChild(b);
            //b.SetPosition(new Vector2(300, 150));
            //b.SetSize(cr2c1.Size - new Vector2(-20 - 20));


            //cnt.ShowSimpleShadow(true);

            //var pulsateEvent = cnt.GetEvent<PulsateEffect>();
            //pulsateEvent.SetWhenToInvoke(() => { return true; });

            //foreach (var children in cnt.Child)
            //{
            //    var pulsateEvent2 = (children as Sprite).GetEvent<PulsateEffect>();
            //    pulsateEvent2.SetWhenToInvoke(() => { return true; });
            //}



            rt2D = new RenderTarget2D(Global.GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth, GraphicsDevice.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.None);


            //rt2D = lastTriangle.Texture as RenderTarget2D; //Fonk(()=>lastTriangle.Draw(), 400, 400);

            //Stream stream = File.Create("rt2D.png");
            //rt2D.SaveAsPng(stream, rt2D.Width, rt2D.Height);
            //stream.Dispose();
        }