コード例 #1
0
        /// <summary>
        /// Creates a column model for a player
        /// </summary>
        /// <param name="fields">The visible columns</param>
        public static ColumnModel CreateColumnModel(PlayerFields fields)
        {
            ImageColumn  visibleColumn                  = CreateImageColumn(string.Empty, 20, VillageGridExRes.Player_VisibleTooltip);
            TextColumn   playerNameColumn               = CreateTextColumn(VillageGridExRes.Name, 85, VillageGridExRes.Player_NameTooltip);
            TextColumn   playerTribeColumn              = CreateTextColumn(VillageGridExRes.Tribe, 60, VillageGridExRes.Player_TribeTooltip);
            NumberColumn playerPointsColumn             = CreateNumberColumn(VillageGridExRes.Points, 72, VillageGridExRes.Player_PointsTooltip);
            NumberColumn playerVillagesColumn           = CreateNumberColumn(VillageGridExRes.Villages, 60, VillageGridExRes.Player_VillagesTooltip);
            TextColumn   playerVillagesDifferenceColumn = CreateTextColumn(VillageGridExRes.Difference, 60, VillageGridExRes.Player_VillagesDiffTooltip);
            TextColumn   playerTribeDifferenceColumn    = CreateTextColumn(VillageGridExRes.TribeOld, 65, VillageGridExRes.Player_TribeOldTooltip);
            NumberColumn playerPointsDifferenceColumn   = CreateNumberColumn(VillageGridExRes.Difference, 55, VillageGridExRes.Player_PointsDiffTooltip);

            playerNameColumn.Visible               = (fields & PlayerFields.Name) != 0;
            playerPointsColumn.Visible             = (fields & PlayerFields.Points) != 0;
            playerPointsDifferenceColumn.Visible   = (fields & PlayerFields.PointsDifference) != 0;
            playerTribeColumn.Visible              = (fields & PlayerFields.Tribe) != 0;
            playerTribeDifferenceColumn.Visible    = (fields & PlayerFields.TribeDifference) != 0;
            playerVillagesColumn.Visible           = (fields & PlayerFields.Villages) != 0;
            playerVillagesDifferenceColumn.Visible = (fields & PlayerFields.VillagesDifference) != 0;

            return(new ColumnModel(new Column[] {
                visibleColumn,
                playerNameColumn,
                playerTribeDifferenceColumn,
                playerTribeColumn,
                playerPointsColumn,
                playerPointsDifferenceColumn,
                playerVillagesColumn,
                playerVillagesDifferenceColumn
            }));
        }
コード例 #2
0
        /// <summary>
        /// Creates a column model for a report
        /// </summary>
        /// <param name="fields">The visible columns</param>
        public static ColumnModel CreateColumnModel(ReportFields fields)
        {
            ImageColumn    reportTypeImageColumn   = CreateImageColumn(string.Empty, 20, "");
            ImageColumn    reportStatusImageColumn = CreateImageColumn(string.Empty, 20, "");
            TextColumn     reportVillageColumn     = CreateTextColumn("Village", 50);
            TextColumn     reportPlayerColumn      = CreateTextColumn("Player", 100);
            DateTimeColumn reportDateColumn        = CreateDateTimeColumn("Date", 70);
            ImageColumn    reportFlagImageColumn   = CreateImageColumn(string.Empty, 20, "");

            reportTypeImageColumn.Visible   = (fields & ReportFields.Type) != 0;
            reportStatusImageColumn.Visible = (fields & ReportFields.Status) != 0;
            reportVillageColumn.Visible     = (fields & ReportFields.Village) != 0;
            reportPlayerColumn.Visible      = (fields & ReportFields.Player) != 0;
            reportDateColumn.Visible        = (fields & ReportFields.Date) != 0;
            reportFlagImageColumn.Visible   = (fields & ReportFields.Flag) != 0;

            return(new ColumnModel(new Column[] {
                reportTypeImageColumn,
                reportStatusImageColumn,
                reportVillageColumn,
                reportPlayerColumn,
                reportDateColumn,
                reportFlagImageColumn
            }));
        }
コード例 #3
0
ファイル: Demo.cs プロジェクト: zeroyou/XPTable
        private void DoTooltip()
        {
            Table table = this.table;                   // The Table control on a form - already initialised

            table.SelectionStyle = SelectionStyle.Grid;
            table.BeginUpdate();
            table.EnableWordWrap = true;                // If false, then Cell.WordWrap is ignored

            table.GridLines = GridLines.Rows;

            TextColumn col1 = new TextColumn("col A", 100);
            TextColumn col2 = new TextColumn("col B", 100);
            TextColumn col3 = new TextColumn("col C", 100);

            table.ColumnModel = new ColumnModel(new Column[] { col1, col2, col3 });

            TableModel model = new TableModel();

            AddRow(model, "Short 1a", "This is long text that will just be truncated (and will be shown by default in a tooltip)", "Short 1c");
            AddRow(model, "TIP: Look!", "More long text More long text More long text More long text More long text ", "");
            AddRow(model, "Short 3", "CANCEL: This is a long cell value but a tooltip is not shown!", "TIP: Short 3c");
            AddRow(model, "", "", "");

            this.table.TableModel = model;

            this.table.EndUpdate();
        }
コード例 #4
0
        static void Main(string[] args)
        {
            var outline  = new Outline();
            var text     = new TextColumn("Content");
            var complete = new TextColumn("Complete");

            outline.AddColumn(text);
            outline.AddColumn(complete);
            var n1 = outline.InsertRow(outline.RootRow, 0, new Dictionary <Column, object> {
                { text, "this is a row" }
            });
            var n1_1 = outline.InsertRow(n1, 0, new Dictionary <Column, object> {
                { text, "this is a row too" }
            });
            var n1_2 = outline.InsertRow(n1, 1, new Dictionary <Column, object> {
                { text, "something" }
            });
            var n1_2_1 = outline.InsertRow(n1_2, 0, new Dictionary <Column, object> {
                { text, "this is a cool row" }
            });
            var n2 = outline.InsertRow(outline.RootRow, 1, new Dictionary <Column, object> {
                { text, "this is the bottom row" }
            });

            foreach (var row in outline.RowsWithIndent())
            {
                System.Console.WriteLine($"{new String('\t', row.indentLevel)}{row.row[text]}");
            }
        }
コード例 #5
0
ファイル: Demo.cs プロジェクト: zeroyou/XPTable
        private void DoFiltering()
        {
            Table table = this.table;       // The Table control on a form - already initialised

            table.Clear();
            table.BeginUpdate();
            table.EnableWordWrap = true;    // If false, then Cell.WordWrap is ignored
            table.EnableFilters  = true;

            NumberColumn col0 = new NumberColumn("#", 20);
            NumberColumn col1 = new NumberColumn("Height", 50);
            TextColumn   col2 = new TextColumn("Name", 80);

            col2.Filterable = true;
            TextColumn     col3 = new TextColumn("Surname", 80);
            DateTimeColumn col4 = new DateTimeColumn("Birthday", 120);
            TextColumn     col5 = new TextColumn("Comments", 100);

            table.ColumnModel = new ColumnModel(new Column[] { col0, col1, col2, col3, col4, col5 });

            TableModel model = new TableModel();

            AddRow(model, 1, 1.52, "Mark", "Hobbs", "23/1/1978", "likes apples");
            AddRow(model, 2, 1.76, "Dave", "Duke", "2/5/1977", "keeps fish");
            AddRow(model, 3, 1.64, "Holly", "Prench", "14/8/1979", "singer");
            AddRow(model, 4, 1.53, "Mark", "Hobbs", "23/1/1984", "plays football");
            AddRow(model, 5, 1.64, "Dave", "Hobbs", "19/1/1980", "vegetarian");

            this.table.TableModel = model;

            this.table.EndUpdate();
        }
コード例 #6
0
        private void DoSimple()
        {
            Table table = this.table;       // The Table control on a form - already initialised

            table.BeginUpdate();

            TableModel model = new TableModel();

            Row row;

            TextColumn col1 = new TextColumn("col A", 100);
            TextColumn col2 = new TextColumn("col B", 100);
            TextColumn col3 = new TextColumn("col C", 100);

            table.ColumnModel = new ColumnModel(new Column[] { col1, col2, col3 });

            row = new Row();
            row.Cells.Add(new Cell("Some text"));
            row.Cells.Add(new Cell("More text"));
            row.Cells.Add(new Cell());
            model.Rows.Add(row);

            row = new Row();
            row.Cells.Add(new Cell("Some text"));
            row.Cells.Add(new Cell("More text"));
            row.Cells.Add(new Cell(null));
            model.Rows.Add(row);

            this.table.TableModel = model;

            this.table.EndUpdate();
        }
コード例 #7
0
        private void ShowGridWindow(Action <Window> resize, Queue <Action <DataGrid> > actions)
        {
            DataGrid CreateDataGrid()
            {
                DataGrid   dataGrid = new DataGrid();
                TextColumn idColumn = new TextColumn()
                {
                    FieldName = "Id", Width = 50
                };
                TextColumn textColumn = new TextColumn()
                {
                    FieldName = "Text", Width = 100
                };

                dataGrid.Columns.Add(idColumn);
                dataGrid.Columns.Add(textColumn);
                dataGrid.ItemsSource = DataSources.GetSimpleDataSource(1000);
                return(dataGrid);
            }

            Window.Finished = false;
            Dispatcher.UIThread.Post(() => Window.DoActions(CreateDataGrid, resize, actions));
            while (!Window.Finished)
            {
                Thread.Sleep(100);
            }

            if (Window.Exception != null)
            {
                throw Window.Exception;
            }
        }
コード例 #8
0
        public void TestTextColumn()
        {
            string[]     lines   = GetFakeProcessListText1();
            TextColumn[] columns = TextColumn.TryParseHeader(lines[0]);
            Assert.True(columns != null && columns.Length == 8);
            Assert.Equal(columns[0].Name, "USER");
            Assert.Equal(columns[1].Name, "PID");
            Assert.Equal(columns[2].Name, "PPID");
            Assert.Equal(columns[3].Name, "VSIZE");
            Assert.Equal(columns[4].Name, "RSS");
            Assert.Equal(columns[5].Name, "WCHAN");
            Assert.Equal(columns[6].Name, "PC");
            Assert.Equal(columns[7].Name, "NAME");

            Assert.Equal(columns[0].ExtractCell(lines[1]), "root");
            Assert.Equal(columns[1].ExtractCell(lines[1]), "1");
            Assert.Equal(columns[2].ExtractCell(lines[1]), "0");
            Assert.Equal(columns[3].ExtractCell(lines[1]), "640");
            Assert.Equal(columns[4].ExtractCell(lines[1]), "496");
            Assert.Equal(columns[5].ExtractCell(lines[1]), "c00bd520");
            Assert.Equal(columns[6].ExtractCell(lines[1]), "00019fb8 S");
            Assert.Equal(columns[7].ExtractCell(lines[1]), "/init");

            Assert.Equal(columns[0].ExtractCell(lines[2]), "root");
            Assert.Equal(columns[1].ExtractCell(lines[2]), "2");
            Assert.Equal(columns[2].ExtractCell(lines[2]), "0");
            Assert.Equal(columns[3].ExtractCell(lines[2]), "0");
            Assert.Equal(columns[4].ExtractCell(lines[2]), "0");
            Assert.Equal(columns[5].ExtractCell(lines[2]), "c00335a0");
            Assert.Equal(columns[6].ExtractCell(lines[2]), "00000000 S");
            Assert.Equal(columns[7].ExtractCell(lines[2]), "fake_name");

            Assert.Equal(columns[0].ExtractCell(lines[3]), "root");
            Assert.Equal(columns[1].ExtractCell(lines[3]), "3");
            Assert.Equal(columns[2].ExtractCell(lines[3]), "2");
            Assert.Equal(columns[3].ExtractCell(lines[3]), "0");
            Assert.Equal(columns[4].ExtractCell(lines[3]), "0");
            Assert.Equal(columns[5].ExtractCell(lines[3]), "c001e39c");
            Assert.Equal(columns[6].ExtractCell(lines[3]), "00000000 S");
            Assert.Equal(columns[7].ExtractCell(lines[3]), "fake_name");

            Assert.Equal(columns[0].ExtractCell(lines[4]), "u0_a56");
            Assert.Equal(columns[1].ExtractCell(lines[4]), "1165");
            Assert.Equal(columns[2].ExtractCell(lines[4]), "50");
            Assert.Equal(columns[3].ExtractCell(lines[4]), "211416");
            Assert.Equal(columns[4].ExtractCell(lines[4]), "16040");
            Assert.Equal(columns[5].ExtractCell(lines[4]), "ffffffff");
            Assert.Equal(columns[6].ExtractCell(lines[4]), "b6f46798 S");
            Assert.Equal(columns[7].ExtractCell(lines[4]), "com.example.hellojni");

            Assert.Equal(columns[0].ExtractCell(lines[5]), "root");
            Assert.Equal(columns[1].ExtractCell(lines[5]), "1181");
            Assert.Equal(columns[2].ExtractCell(lines[5]), "59");
            Assert.Equal(columns[3].ExtractCell(lines[5]), "1236");
            Assert.Equal(columns[4].ExtractCell(lines[5]), "460");
            Assert.Equal(columns[5].ExtractCell(lines[5]), "00000000");
            Assert.Equal(columns[6].ExtractCell(lines[5]), "b6f11158 R");
            Assert.Equal(columns[7].ExtractCell(lines[5]), "ps");
        }
コード例 #9
0
        public void TestTextColumn()
        {
            string[]     lines   = GetFakeProcessListText1();
            TextColumn[] columns = TextColumn.TryParseHeader(lines[0]);
            Assert.True(columns != null && columns.Length == 8);
            Assert.Equal("USER", columns[0].Name);
            Assert.Equal("PID", columns[1].Name);
            Assert.Equal("PPID", columns[2].Name);
            Assert.Equal("VSIZE", columns[3].Name);
            Assert.Equal("RSS", columns[4].Name);
            Assert.Equal("WCHAN", columns[5].Name);
            Assert.Equal("PC", columns[6].Name);
            Assert.Equal("NAME", columns[7].Name);

            Assert.Equal("root", columns[0].ExtractCell(lines[1]));
            Assert.Equal("1", columns[1].ExtractCell(lines[1]));
            Assert.Equal("0", columns[2].ExtractCell(lines[1]));
            Assert.Equal("640", columns[3].ExtractCell(lines[1]));
            Assert.Equal("496", columns[4].ExtractCell(lines[1]));
            Assert.Equal("c00bd520", columns[5].ExtractCell(lines[1]));
            Assert.Equal("00019fb8 S", columns[6].ExtractCell(lines[1]));
            Assert.Equal("/init", columns[7].ExtractCell(lines[1]));

            Assert.Equal("root", columns[0].ExtractCell(lines[2]));
            Assert.Equal("2", columns[1].ExtractCell(lines[2]));
            Assert.Equal("0", columns[2].ExtractCell(lines[2]));
            Assert.Equal("0", columns[3].ExtractCell(lines[2]));
            Assert.Equal("0", columns[4].ExtractCell(lines[2]));
            Assert.Equal("c00335a0", columns[5].ExtractCell(lines[2]));
            Assert.Equal("00000000 S", columns[6].ExtractCell(lines[2]));
            Assert.Equal("fake_name", columns[7].ExtractCell(lines[2]));

            Assert.Equal("root", columns[0].ExtractCell(lines[3]));
            Assert.Equal("3", columns[1].ExtractCell(lines[3]));
            Assert.Equal("2", columns[2].ExtractCell(lines[3]));
            Assert.Equal("0", columns[3].ExtractCell(lines[3]));
            Assert.Equal("0", columns[4].ExtractCell(lines[3]));
            Assert.Equal("c001e39c", columns[5].ExtractCell(lines[3]));
            Assert.Equal("00000000 S", columns[6].ExtractCell(lines[3]));
            Assert.Equal("fake_name", columns[7].ExtractCell(lines[3]));

            Assert.Equal("u0_a56", columns[0].ExtractCell(lines[4]));
            Assert.Equal("1165", columns[1].ExtractCell(lines[4]));
            Assert.Equal("50", columns[2].ExtractCell(lines[4]));
            Assert.Equal("211416", columns[3].ExtractCell(lines[4]));
            Assert.Equal("16040", columns[4].ExtractCell(lines[4]));
            Assert.Equal("ffffffff", columns[5].ExtractCell(lines[4]));
            Assert.Equal("b6f46798 S", columns[6].ExtractCell(lines[4]));
            Assert.Equal("com.example.hellojni", columns[7].ExtractCell(lines[4]));

            Assert.Equal("root", columns[0].ExtractCell(lines[5]));
            Assert.Equal("1181", columns[1].ExtractCell(lines[5]));
            Assert.Equal("59", columns[2].ExtractCell(lines[5]));
            Assert.Equal("1236", columns[3].ExtractCell(lines[5]));
            Assert.Equal("460", columns[4].ExtractCell(lines[5]));
            Assert.Equal("00000000", columns[5].ExtractCell(lines[5]));
            Assert.Equal("b6f11158 R", columns[6].ExtractCell(lines[5]));
            Assert.Equal("ps", columns[7].ExtractCell(lines[5]));
        }
コード例 #10
0
        private void InitTables()
        {
            ColumnModel columnModel = new ColumnModel();

            //VillageId
            TextColumn villId = new TextColumn
            {
                Editable    = false,
                Text        = "Id",
                ToolTipText = "Village Id",
                Width       = 40
            };

            columnModel.Columns.Add(villId);
            //Village name
            TextColumn vill = new TextColumn
            {
                Editable    = false,
                Text        = "Village",
                ToolTipText = "Village name",
                Width       = 120
            };

            columnModel.Columns.Add(vill);

            //Alert type
            ComboBoxColumn alertType = new ComboBoxColumn
            {
                Text        = "Alert Type",
                ToolTipText = "On what type of attack should I alert you?",
                Width       = 80
            };

            ComboBoxCellEditor typeEditor = new ComboBoxCellEditor
            {
                DropDownStyle = DropDownStyle.DropDownList
            };

            typeEditor.Items.AddRange(new string[] { "Disabled", "FullAttack", "AnyAttack" });
            alertType.Editor = typeEditor;

            columnModel.Columns.Add(alertType);

            // Alert only if hero is present in the attack, for spies art users
            CheckBoxColumn onHero = new CheckBoxColumn
            {
                Text        = "AlertOnHero",
                Width       = 85,
                ToolTipText = "Only alert if hero is present in attack. For spies art users. Otherwise ignored"
            };

            columnModel.Columns.Add(onHero);

            // set the Table's ColumModel and TableModel
            table1.ColumnModel        = columnModel;
            XpTableGlobal.ColumnModel = columnModel;

            table1.TableModel = tableModelMain;
        }
コード例 #11
0
    public Example_49()
    {
        PDF pdf = new PDF(new BufferedStream(
                              new FileStream("Example_49.pdf", FileMode.Create)),
                          Compliance.PDF_UA);

        Font f1 = new Font(pdf, new FileStream(
                               "fonts/Droid/DroidSerif-Regular.ttf", FileMode.Open, FileAccess.Read));

        Font f2 = new Font(pdf, new FileStream(
                               "fonts/Droid/DroidSerif-Italic.ttf", FileMode.Open, FileAccess.Read));

        Page page = new Page(pdf, Letter.PORTRAIT);

        f1.SetSize(14f);
        f2.SetSize(16f);

        Paragraph paragraph1 = new Paragraph()
                               .Add(new TextLine(f1, "Hello"))
                               .Add(new TextLine(f1, "W").SetColor(Color.black).SetTrailingSpace(false))
                               .Add(new TextLine(f1, "o").SetColor(Color.red).SetTrailingSpace(false))
                               .Add(new TextLine(f1, "r").SetColor(Color.green).SetTrailingSpace(false))
                               .Add(new TextLine(f1, "l").SetColor(Color.blue).SetTrailingSpace(false))
                               .Add(new TextLine(f1, "d").SetColor(Color.black))
                               .Add(new TextLine(f1, "$").SetTrailingSpace(false)
                                    .SetVerticalOffset(f1.GetAscent() - f2.GetAscent()))
                               .Add(new TextLine(f2, "29.95").SetColor(Color.blue))
                               .SetAlignment(Align.RIGHT);

        Paragraph paragraph2 = new Paragraph()
                               .Add(new TextLine(f1, "Hello"))
                               .Add(new TextLine(f1, "World"))
                               .Add(new TextLine(f1, "$"))
                               .Add(new TextLine(f2, "29.95").SetColor(Color.blue))
                               .SetAlignment(Align.RIGHT);

        TextColumn column = new TextColumn();

        column.AddParagraph(paragraph1);
        column.AddParagraph(paragraph2);
        column.SetLocation(70f, 150f);
        column.SetWidth(500f);
        column.DrawOn(page);


        List <Paragraph> paragraphs = new List <Paragraph>();

        paragraphs.Add(paragraph1);
        paragraphs.Add(paragraph2);

        Text text = new Text(paragraphs);

        text.SetLocation(70f, 200f);
        text.SetWidth(500f);
        text.DrawOn(page);

        pdf.Close();
    }
コード例 #12
0
 public PostFilter()
 {
     Id          = new IntegerColumn("Id");
     AuthorId    = new IntegerColumn("AuthorId");
     Title       = new TextColumn("Title");
     Status      = new IntegerColumn("StatusId");
     CreatedOn   = new DateColumn("CreateDate");
     PublishedOn = new DateColumn("PublishDate");
 }
コード例 #13
0
        private void AutoColumns(Type type)
        {
            if (type == null || type == typeof(string) || type.IsValueType)
            {
                return;
            }
            Type iType = type.GetInterface(typeof(IParent).FullName);

            if (iType == null)
            {
                throw new ArgumentException("Data type error, interface not implemented: IParentId.");
            }

            Columns.Clear();
            var iTree   = false;
            var iColumn = TextColumn != null && type.Property(TextColumn) != null;

            foreach (var property in type.PropertiesValue())
            {
                var visible = property.IShow();
                DataGridViewColumn column;
                if (!iTree && ((!iColumn && visible) || (iColumn && TextColumn.Equals(property.Name, StringComparison.OrdinalIgnoreCase))))
                {
                    iTree  = true;
                    column = new TreeGridColumn();
                }
                else
                {
                    Type dbType = property.PropertyType;
                    if (dbType.IsGenericType)
                    {
                        dbType = Nullable.GetUnderlyingType(dbType);
                    }
                    if (dbType == typeof(Image) || dbType == typeof(Bitmap))
                    {
                        column = new DataGridViewImageColumn();
                    }
                    else if (property.ICheckBox())
                    {
                        column = new TDataGridViewCheckBoxColumn();
                    }
                    else if (property.IButton(out IButtonAttribute button))
                    {
                        column = new TDataGridViewButtonColumn(button);
                    }
                    else
                    {
                        column = new DataGridViewTextBoxColumn();
                    }
                }
                column.Visible    = visible;
                column.HeaderText = property.Text();
                column.Name       = property.Name;
                Columns.Add(column);
            }
        }
コード例 #14
0
        /// <summary>
        /// Initializes XPTable (listPackages) model.
        /// </summary>
        private void InitializeXPTable()
        {
            // == Packages XPTable == //
            this.tablePackages.SelectionStyle = SelectionStyle.Grid;
            this.tablePackages.GridLines      = GridLines.None;
            this.tablePackages.EnableWordWrap = true;

            ImageColumn col1 = new ImageColumn(String.Empty, 32)
            {
                Editable = false, Resizable = false
            };
            TextColumn col2 = new TextColumn()
            {
                Editable = false, Resizable = false
            };

            this.tablePackages.ColumnModel = new ColumnModel(new Column[] { col1, col2 });
            this.tablePackages.TableModel  = new TableModel();

            // == Changes XPTable == //
            this.tableChanges.SelectionStyle = SelectionStyle.Grid;
            this.tableChanges.GridLines      = GridLines.None;
            this.tableChanges.EnableWordWrap = true;

            ImageColumn col3 = new ImageColumn(String.Empty, 32)
            {
                Editable = false, Resizable = false
            };
            TextColumn col4 = new TextColumn()
            {
                Editable = false, Resizable = false
            };

            this.tableChanges.ColumnModel = new ColumnModel(new Column[] { col3, col4 });
            this.tableChanges.TableModel  = new TableModel();

            // == Queue XPTable == //
            this.tableQueue.SelectionStyle = SelectionStyle.Grid;
            this.tableQueue.GridLines      = GridLines.Rows;
            this.tableQueue.EnableWordWrap = true;

            TextColumn col5 = new TextColumn()
            {
                Editable = false, Resizable = false
            };
            ProgressBarColumn col6 = new ProgressBarColumn()
            {
                Editable = false, Resizable = false
            };

            this.tableQueue.ColumnModel = new ColumnModel(new Column[] { col5, col6 });
            this.tableQueue.TableModel  = new TableModel()
            {
                RowHeight = 20
            };
        }
コード例 #15
0
        ITableConfiguration <TModel> ITableConfiguration <TModel> .AddColumn <TColumn>(
            Expression <Func <TModel, TColumn> > columnDefinition,
            Action <IFormatableColumnConfiguration <TModel, TColumn> > columnConfig)
        {
            var config = new TextColumn <TModel, TColumn>(columnDefinition);

            columnConfig.ExecuteIfNotNull(config);
            _columns.Add(config);
            return(this);
        }
コード例 #16
0
        public void CustomColumnWidth()
        {
            //ExStart
            //ExFor:TextColumnCollection.LineBetween
            //ExFor:TextColumnCollection.EvenlySpaced
            //ExFor:TextColumnCollection.Item
            //ExFor:TextColumn
            //ExFor:TextColumn.Width
            //ExFor:TextColumn.SpaceAfter
            //ExSummary:Shows how to set widths of columns.
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            TextColumnCollection columns = builder.PageSetup.TextColumns;

            // Show vertical line between columns
            columns.LineBetween = true;
            // Indicate we want to create column with different widths
            columns.EvenlySpaced = false;
            // Create two columns, note they will be created with zero widths, need to set them
            columns.SetCount(2);

            // Set the first column to be narrow
            TextColumn column = columns[0];

            column.Width      = 100;
            column.SpaceAfter = 20;

            // Set the second column to take the rest of the space available on the page
            column = columns[1];
            PageSetup pageSetup    = builder.PageSetup;
            double    contentWidth = pageSetup.PageWidth - pageSetup.LeftMargin - pageSetup.RightMargin;

            column.Width = contentWidth - column.Width - column.SpaceAfter;

            builder.Writeln("Narrow column 1.");
            builder.InsertBreak(BreakType.ColumnBreak);
            builder.Writeln("Wide column 2.");

            doc.Save(ArtifactsDir + "PageSetup.CustomColumnWidth.docx");
            //ExEnd

            doc       = new Document(ArtifactsDir + "PageSetup.CustomColumnWidth.docx");
            pageSetup = doc.FirstSection.PageSetup;

            Assert.True(pageSetup.TextColumns.LineBetween);
            Assert.False(pageSetup.TextColumns.EvenlySpaced);
            Assert.AreEqual(2, pageSetup.TextColumns.Count);
            Assert.AreEqual(100.0d, pageSetup.TextColumns[0].Width);
            Assert.AreEqual(20.0d, pageSetup.TextColumns[0].SpaceAfter);
            Assert.AreEqual(470.3d, pageSetup.TextColumns[1].Width);
            Assert.AreEqual(0.0d, pageSetup.TextColumns[1].SpaceAfter);
        }
コード例 #17
0
        private void Initialize_table()
        {
            this.table1.BeginUpdate();
            NumberColumn column0 = new NumberColumn("#", 20);
            TextColumn   column1 = new TextColumn("File Name", 100);

            column0.Alignment = ColumnAlignment.Center;
            column1.Alignment = ColumnAlignment.Center;
            this.columnModel1.Columns.AddRange(new Column[] { column0, column1 });

            this.table1.EndUpdate();
        }
コード例 #18
0
        /// <summary>
        /// Creates a text column
        /// </summary>
        private static TextColumn CreateTextColumn(string header, int width, string toolTipText = null)
        {
            var col = new TextColumn(header, width)
            {
                Editable = false
            };

            if (!string.IsNullOrWhiteSpace(toolTipText))
            {
                col.ToolTipText = toolTipText;
            }
            return(col);
        }
コード例 #19
0
        public void CustomColumnWidth()
        {
            //ExStart
            //ExFor:TextColumnCollection.EvenlySpaced
            //ExFor:TextColumnCollection.Item
            //ExFor:TextColumn
            //ExFor:TextColumn.Width
            //ExFor:TextColumn.SpaceAfter
            //ExSummary:Shows how to create unevenly spaced columns.
            Document        doc       = new Document();
            DocumentBuilder builder   = new DocumentBuilder(doc);
            PageSetup       pageSetup = builder.PageSetup;

            TextColumnCollection columns = pageSetup.TextColumns;

            columns.EvenlySpaced = false;
            columns.SetCount(2);

            // Determine the amount of room that we have available for arranging columns.
            double contentWidth = pageSetup.PageWidth - pageSetup.LeftMargin - pageSetup.RightMargin;

            Assert.AreEqual(470.30d, contentWidth, 0.01d);

            // Set the first column to be narrow.
            TextColumn column = columns[0];

            column.Width      = 100;
            column.SpaceAfter = 20;

            // Set the second column to take the rest of the space available within the margins of the page.
            column       = columns[1];
            column.Width = contentWidth - column.Width - column.SpaceAfter;

            builder.Writeln("Narrow column 1.");
            builder.InsertBreak(BreakType.ColumnBreak);
            builder.Writeln("Wide column 2.");

            doc.Save(ArtifactsDir + "PageSetup.CustomColumnWidth.docx");
            //ExEnd

            doc       = new Document(ArtifactsDir + "PageSetup.CustomColumnWidth.docx");
            pageSetup = doc.FirstSection.PageSetup;

            Assert.False(pageSetup.TextColumns.EvenlySpaced);
            Assert.AreEqual(2, pageSetup.TextColumns.Count);
            Assert.AreEqual(100.0d, pageSetup.TextColumns[0].Width);
            Assert.AreEqual(20.0d, pageSetup.TextColumns[0].SpaceAfter);
            Assert.AreEqual(470.3d, pageSetup.TextColumns[1].Width);
            Assert.AreEqual(0.0d, pageSetup.TextColumns[1].SpaceAfter);
        }
コード例 #20
0
        protected virtual ColumnModel ColumnInitialize()
        {
            TextColumn col1 = new TextColumn(Translator.Instance.T("名称"), 100);
            TextColumn col2 = new TextColumn(Translator.Instance.T("地址(URL)"), 100);

            ColumnModel r = new ColumnModel(new Column[] { col1, col2 });

            foreach (Column col in r.Columns)
            {
                col.Resizable = true;
                col.Editable  = true;
            }
            return(r);
        }
コード例 #21
0
        private void DoControl()
        {
            Table table = this.table;                                                           // The Table control on a form - already initialised

            table.SelectionStyle = SelectionStyle.Grid;
            table.BeginUpdate();
            table.EnableWordWrap = true;                                                // If false, then Cell.WordWrap is ignored
            table.GridLines      = GridLines.None;

            TextColumn col1 = new TextColumn("From", 200);

            ControlColumn col2 = new ControlColumn(30);

            col2.Alignment = ColumnAlignment.Right;
            SpinnerFactory fact = new SpinnerFactory();

            //fact.ClickEventHandler = new EventHandler(circle_Click);
            col2.ControlFactory = fact;
            col2.ControlSize    = new Size(25, 25);
            col2.Alignment      = ColumnAlignment.Center;

            ControlColumn col3 = new ControlColumn(100);

            col3.Alignment      = ColumnAlignment.Right;
            col3.ControlFactory = new TextBoxFactory();

            table.ColumnModel = new ColumnModel(new Column[] { col1, col2, col3 });

            TableModel model = new TableModel();

            model.RowHeight = 25;       // Change the height of all rows so the control can be seen
            Row row;

            row = new Row();
            row.Cells.Add(new Cell("Text"));
            row.Cells.Add(new Cell(Color.Red));     // The .Data property is picked up as the colour in the SpinnerFactory
            row.Cells.Add(new Cell("Apples"));      // The .Text property is picked up in the text in the TextboxFactory
            model.Rows.Add(row);

            row = new Row();
            row.Cells.Add(new Cell("More"));
            row.Cells.Add(new Cell());
            row.Cells.Add(new Cell("Pears"));

            model.Rows.Add(row);

            this.table.TableModel = model;
            //this.table.CellClick += new XPTable.Events.CellMouseEventHandler(table_CellClick);
            this.table.EndUpdate();
        }
コード例 #22
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            table1.BeginUpdate();
            ImageColumn imageColumn1 = new ImageColumn("#", 16);    //声明一个新列

            TextColumn textColumn1 = new TextColumn("Server", 150); //声明一个新列

            textColumn1.Editable = false;
            textColumn1.Visible  = false;

            TextColumn textColumn2 = new TextColumn("Name", 100);

            textColumn2.Editable = false;

            TextColumn textServerIP = new TextColumn("IP", 100);

            textServerIP.Editable = false;
            //textServerIP.Visible = false;

            TextColumn textVersion = new TextColumn("Version", 30);

            textVersion.Alignment = ColumnAlignment.Center;

            ProgressBarColumn Cpu    = new ProgressBarColumn("CPU", 60);
            ProgressBarColumn disk_C = new ProgressBarColumn("C:", 60);
            ProgressBarColumn disk_D = new ProgressBarColumn("D:", 60);
            ProgressBarColumn disk_E = new ProgressBarColumn("E:", 60);
            ProgressBarColumn disk_F = new ProgressBarColumn("F:", 60);
            ProgressBarColumn disk_G = new ProgressBarColumn("G:", 60);

            TextColumn textStatus = new TextColumn("Status", 48);

            table1.ColumnModel = new ColumnModel(new Column[] { imageColumn1, textColumn1, textColumn2, textServerIP, Cpu, disk_C, disk_D, disk_E, disk_F, disk_G, textVersion, textStatus });//把声明的列添加到列中
            //table1.HeaderRenderer = new GradientHeaderRenderer();//设置样式
            table1.FullRowSelect = true;
            table1.EndUpdate();

            //===================================
            //Row row;
            //Cell cell;
            //row = new Row();
            //row.Cells.Add(new Cell("Offline", (Image)Properties.Resources.offline));
            //row.Cells.Add(new Cell("strCell2"));
            //model.Rows.Add(row);
            //table1.TableModel = model;
            //===================================
        }
コード例 #23
0
        private void InitializeTable()
        {
            ImageColumn iconColumn = new ImageColumn("Information", 25);

            iconColumn.DrawText = true;
            TextColumn timestampColumn = new TextColumn("Timestamp", 75);
            TextColumn textColumn      = new TextColumn("Text", 100);

            textColumn.Width = table.Width;

            table.ColumnModel          = new ColumnModel(new Column[] { iconColumn, timestampColumn, textColumn });
            table.TableModel           = new TableModel();
            table.TableModel.RowHeight = 21;
            table.SizeChanged         += new EventHandler(table_SizeChanged);
        }
コード例 #24
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            table1.BeginUpdate();

            TextColumn        textServerIP = new TextColumn("IP", 100);
            ProgressBarColumn Cpu          = new ProgressBarColumn("CPU", 60);
            ProgressBarColumn disk_C       = new ProgressBarColumn("C:", 60);
            ProgressBarColumn disk_D       = new ProgressBarColumn("D:", 60);

            table1.ColumnModel   = new ColumnModel(new Column[] { textServerIP, Cpu, disk_C, disk_D });//把声明的列添加到列中
            table1.FullRowSelect = true;
            table1.EndUpdate();
        }
コード例 #25
0
        /// <summary>
        /// Creates a column model for a village
        /// </summary>
        /// <param name="fields">The visible columns</param>
        public static ColumnModel CreateColumnModel(VillageFields fields)
        {
            ImageColumn  visibleColumn                 = CreateImageColumn(string.Empty, 20, VillageGridExRes.VisibleTooltip);
            ImageColumn  villageImageColumn            = CreateImageColumn(string.Empty, 20, VillageGridExRes.TypeTooltip);
            TextColumn   villageCoordColumn            = CreateTextColumn(VillageGridExRes.Location, 50, VillageGridExRes.LocationTooltip);
            TextColumn   villageNameColumn             = CreateTextColumn(VillageGridExRes.Name, 114, VillageGridExRes.NameTooltip);
            NumberColumn villagePointsColumn           = CreateNumberColumn(VillageGridExRes.Points, 55, VillageGridExRes.PointsTooltip);
            NumberColumn villagePointsDifferenceColumn = CreateNumberColumn(VillageGridExRes.Difference, 45, VillageGridExRes.PointsDifferenceTooltip);

            TextColumn   villagePlayerColumn             = CreateTextColumn(VillageGridExRes.Player, 85, VillageGridExRes.PlayerNameTooltip);
            TextColumn   villagePlayerDifferenceColumn   = CreateTextColumn(VillageGridExRes.PlayerOld, 85, VillageGridExRes.PlayerDifferenceTooltip);
            NumberColumn villagePlayerPoints             = CreateNumberColumn(VillageGridExRes.Points, 65, VillageGridExRes.PlayerPointsTooltip);
            NumberColumn villagePlayerPointsDifference   = CreateNumberColumn(VillageGridExRes.Difference, 55, VillageGridExRes.PlayerPointsDiffTooltip);
            NumberColumn villageVillagesColumn           = CreateNumberColumn(VillageGridExRes.Villages, 60, VillageGridExRes.VillagesTooltip);
            TextColumn   villageVillagesDifferenceColumn = CreateTextColumn(VillageGridExRes.Difference, 45, VillageGridExRes.VillagesDiffTooltip);
            TextColumn   villageTribeColumn     = CreateTextColumn(VillageGridExRes.Tribe, 50, VillageGridExRes.TribeTagTooltip);
            NumberColumn villageTribeRankColumn = CreateNumberColumn(VillageGridExRes.Rank, 50, VillageGridExRes.TribeRankTooltip);

            villageImageColumn.Visible              = (fields & VillageFields.Type) != 0;
            villageNameColumn.Visible               = (fields & VillageFields.Name) != 0;
            villagePlayerColumn.Visible             = (fields & VillageFields.Player) != 0;
            villagePlayerDifferenceColumn.Visible   = (fields & VillageFields.PlayerDifference) != 0;
            villagePlayerPoints.Visible             = (fields & VillageFields.PlayerPoints) != 0;
            villagePlayerPointsDifference.Visible   = (fields & VillageFields.PlayerPointsDifference) != 0;
            villagePointsColumn.Visible             = (fields & VillageFields.Points) != 0;
            villagePointsDifferenceColumn.Visible   = (fields & VillageFields.PointsDifference) != 0;
            villageTribeColumn.Visible              = (fields & VillageFields.Tribe) != 0;
            villageTribeRankColumn.Visible          = (fields & VillageFields.TribeRank) != 0;
            villageVillagesColumn.Visible           = (fields & VillageFields.PlayerVillages) != 0;
            villageVillagesDifferenceColumn.Visible = (fields & VillageFields.PlayerVillagesDifference) != 0;

            return(new ColumnModel(new Column[] {
                visibleColumn,
                villageImageColumn,
                villageCoordColumn,
                villageNameColumn,
                villagePointsColumn,
                villagePointsDifferenceColumn,
                villagePlayerDifferenceColumn,
                villagePlayerColumn,
                villagePlayerPoints,
                villagePlayerPointsDifference,
                villageVillagesColumn,
                villageVillagesDifferenceColumn,
                villageTribeColumn,
                villageTribeRankColumn
            }));
        }
コード例 #26
0
        protected virtual ColumnModel ColumnInitialize()
        {
            TextColumn col1 = new TextColumn(Translator.Instance.T("模块"));
            TextColumn col2 = new TextColumn(Translator.Instance.T("许可证版本"));
            TextColumn col3 = new TextColumn(Translator.Instance.T("授权用户"));
            TextColumn col4 = new TextColumn(Translator.Instance.T("备注"));

            ColumnModel r = new ColumnModel(new Column[] { col1, col2, col3, col4 });

            foreach (Column col in r.Columns)
            {
                col.Resizable = true;
                col.Editable  = false;
            }
            return(r);
        }
コード例 #27
0
        private static string Handle(TextColumn column)
        {
            if (column.Operator == TextColumn.Operators.None)
            {
                return(string.Empty);
            }

            if (column.Operator == TextColumn.Operators.In)
            {
                return(string.Format(" AND {0} IN({1})", column.Name, string.Join(",", column.Range.Select(o => string.Format("'{0}'", o)))));
            }
            else
            {
                return(string.Format(" AND {0} {1} '{2}'", column.Name, GetOperator(column.Operator), column.Value));
            }
        }
コード例 #28
0
ファイル: LogViewer.cs プロジェクト: unixcrh/Motion
        protected virtual ColumnModel ColumnInitialize()
        {
            ImageColumn col1 = new ImageColumn(Translator.Instance.T("日志类型"), 100);

            col1.DrawText = true;

            TextColumn col2 = new TextColumn(Translator.Instance.T("时间"), 100);
            TextColumn col3 = new TextColumn(Translator.Instance.T("内容"), 100);

            ColumnModel r = new ColumnModel(new Column[] { col1, col2, col3 });

            foreach (Column col in r.Columns)
            {
                col.Resizable = true;
                col.Editable  = false;
            }
            return(r);
        }
コード例 #29
0
        /// <summary>
        /// 初始化表格
        /// </summary>
        private void InitTable()
        {
            this.tableFiles.ColumnModel     = this.columnModel;
            this.tableFiles.TableModel      = this.tableModel;
            this.tableFiles.CellMouseDown  += TableFiles_CellMouseDown;
            this.tableFiles.CellMouseEnter += TableFiles_CellMouseEnter;
            this.tableFiles.CellMouseLeave += TableFiles_CellMouseLeave;
            ImageColumn fileNameColumn = new ImageColumn("文件名", 240)
            {
                DrawText = true
            };
            TextColumn fileSizeColumn = new TextColumn("文件大小", 90)
            {
                Editable = false
            };
            NumberColumn pageStartColumn = new NumberColumn("起始页", 60)
            {
                Editable          = true,
                Minimum           = 1,
                Maximum           = 2000,
                ShowUpDownButtons = true
            };
            NumberColumn pageEndColumn = new NumberColumn("结束页", 60)
            {
                Editable          = true,
                Minimum           = 1,
                Maximum           = 2000,
                ShowUpDownButtons = true
            };
            ProgressBarColumn progressColumn = new ProgressBarColumn("状态", 100);
            ImageColumn       deleteColumn   = new ImageColumn("移除", 35)
            {
                DrawText = false
            };
            TextColumn filePathColumn = new TextColumn("文件路径", null, 0, false);

            this.columnModel.Columns.AddRange(new Column[] { fileNameColumn,
                                                             fileSizeColumn,
                                                             pageStartColumn,
                                                             pageEndColumn,
                                                             progressColumn,
                                                             deleteColumn, filePathColumn });
        }
コード例 #30
0
        public void ColumnsCustomWidth()
        {
            //ExStart
            //ExFor:TextColumnCollection.LineBetween
            //ExFor:TextColumnCollection.EvenlySpaced
            //ExFor:TextColumnCollection.Item
            //ExFor:TextColumn
            //ExFor:TextColumn.Width
            //ExFor:TextColumn.SpaceAfter
            //ExSummary:Creates multiple columns of different widths in a section using DocumentBuilder.
            DocumentBuilder builder = new DocumentBuilder();

            TextColumnCollection columns = builder.PageSetup.TextColumns;

            // Show vertical line between columns.
            columns.LineBetween = true;
            // Indicate we want to create column with different widths.
            columns.EvenlySpaced = false;
            // Create two columns, note they will be created with zero widths, need to set them.
            columns.SetCount(2);

            // Set the first column to be narrow.
            TextColumn c1 = columns[0];

            c1.Width      = 100;
            c1.SpaceAfter = 20;

            // Set the second column to take the rest of the space available on the page.
            TextColumn c2 = columns[1];

            Aspose.Words.PageSetup ps = builder.PageSetup;
            double contentWidth       = ps.PageWidth - ps.LeftMargin - ps.RightMargin;

            c2.Width = contentWidth - c1.Width - c1.SpaceAfter;

            builder.Writeln("Narrow column 1.");
            builder.InsertBreak(BreakType.ColumnBreak);
            builder.Writeln("Wide column 2.");

            builder.Document.Save(MyDir + "PageSetup.ColumnsCustomWidth Out.doc");
            //ExEnd
        }
コード例 #31
0
ファイル: GridTableHelper.cs プロジェクト: sybrix/EdFi-App
        private static List<Column> GenerateDoubleRowHeader(IEnumerable<MetadataColumnGroup> metadataColumnGroups)
        {
            var header = new List<Column>();

            int groupIndex = 0;
            int groupCount = metadataColumnGroups.Count();
            foreach (var group in metadataColumnGroups)
            {
                var topHeaderGroup = new Column();

                //Special handling for Entity Information group.
                if (group.GroupType == GroupType.EntityInformation)
                {
                    topHeaderGroup = new Column { U = -1, IsVisibleByDefault = true, IsFixedColumn = group.IsFixedColumnGroup };
                    //Note: Hardcoded left image for the JQuery grid component.
                    topHeaderGroup.Children.Add(new ImageColumn
                    {
                        U = -1,
                        Src = "LeftGrayCorner.png",
                        IsVisibleByDefault = true,
                        IsFixedColumn = group.IsFixedColumnGroup
                    });
                }

                if (group.GroupType == GroupType.MetricData)
                    topHeaderGroup = new TextColumn
                    {
                        U = -1,
                        DisplayName = group.Title,
                        IsVisibleByDefault = group.IsVisibleByDefault,
                        IsFixedColumn = group.IsFixedColumnGroup
                    };

                foreach (var column in group.Columns)
                    topHeaderGroup.Children.Add(GenerateColumn(column, group.IsFixedColumnGroup));

                header.Add(topHeaderGroup);

                //If we are between columns but not in the last one or this is not the only one. then we add a spacer.
                //Note: this can be removed when we change the way the JQueryGrid renders this data.
                if (groupIndex < groupCount - 1)
                    header.Add(HeaderSpacer(group.IsFixedColumnGroup));

                groupIndex++;
            }

            return header;
        }
コード例 #32
0
        public ActionResult Get(EdFiDashboardContext context)
        {
            var learningStandards = service.Get(new LearningStandardRequest()
            {
                StudentUSI = context.StudentUSI.GetValueOrDefault(),
                SchoolId = context.SchoolId.GetValueOrDefault(),
                MetricVariantId = context.MetricVariantId.GetValueOrDefault()
            });


            var model = new GridTable { MetricVariantId = context.MetricVariantId.GetValueOrDefault() };
            if (learningStandards == null || learningStandards.Count == 0)
            {
                return View(model);
            }

            /*Preparing headers*/
            #region Headers
            model.Columns = new List<Column>{
				new Column { IsVisibleByDefault = true, IsFixedColumn = true,
                Children= new List<Column>{
						new ImageColumn{ Src = "LeftGrayCorner.png", IsVisibleByDefault=true, IsFixedColumn = true},
                        new TextColumn{ DisplayName = StudentExpectationsColumnHeading, IsVisibleByDefault=true, IsFixedColumn = true},
                    }
                },
				new TextColumn{DisplayName="Spacer",  IsVisibleByDefault=true, IsFixedColumn = true,
                    Children= new List<Column>{
                        new TextColumn{IsVisibleByDefault=true, IsFixedColumn = true},
                    }
				}
			};

            //For the Dynamic Columns (this is the Header which is empty "no text")
            var parentColumn = new TextColumn { DisplayName = BenchmarkAssessmentsColumnHeading, IsVisibleByDefault = true };
            foreach (var learningStandardAssessment in learningStandards[0].Assessments)
                parentColumn.Children.Add(new TextColumn { DisplayName = learningStandardAssessment.DateAdministration.ToString("MMMM d, yyyy"), Tooltip = learningStandardAssessment.AssessmentTitle, IsVisibleByDefault = true });

            model.Columns.Add(parentColumn);
            #endregion

            #region Rows
            foreach (var learningStandard in learningStandards)
            {
                var row = new List<object>();
                //First cells (Spacer,Expectation,Spacer)
                row.Add(new CellItem<double> { DV = "", V = 0 });
                row.Add(new ObjectiveTextCellItem<string> { O = learningStandard.LearningStandard + " " + learningStandard.Description, V = learningStandard.LearningStandard });
                //Spacer
                row.Add(new SpacerCellItem<double> { DV = "", V = 0 });

                foreach (var learningStandardAssessment in learningStandard.Assessments)
                {
                    var cell = new ObjectiveCellItem<int> { DV = "", V = -1 };
                    if (learningStandardAssessment.Administered)
                    {
                        cell.V = ChangeValueForSorting(learningStandardAssessment.MetricStateTypeId);
                        cell.ST = (learningStandardAssessment.MetricStateTypeId != null)
                                    ? learningStandardAssessment.MetricStateTypeId.Value
                                    : (int)MetricStateType.None;
                        cell.DV = learningStandardAssessment.Value;

                    }
                    row.Add(cell);
                }
                model.Rows.Add(row);
            }
            #endregion

            return View(model);
        }
コード例 #33
0
ファイル: Form1.cs プロジェクト: lorneroy/CSharpClass
        private void button1_Click(object sender, EventArgs e)
        {
            //Let's create a row of data using 3 TextColumn objects
            TextColumn ID = new TextColumn("1");
            TextColumn FirstName = new TextColumn("Bob");
            TextColumn LastName = new TextColumn("Smith");
            TextColumn[] arrRow1 = { ID, FirstName, LastName };

            //This is an alternate way of creating a row!
            TextColumn[] arrRow2 = { new TextColumn("1"), new TextColumn("Sue"), new TextColumn("Jones") };

            Console.WriteLine("Contents of the Row 1: {0},{1},{2}", arrRow1[0].ToString(), arrRow1[1].ToString(), arrRow1[2].ToString());
            Console.WriteLine("Contents of the Row 2: {0},{1},{2}", arrRow1[0].ToString(), arrRow1[1].ToString(), arrRow1[2].ToString());
            //Note that the ToString method of an array is not overloaded to reflect its contents

            //Now let see if the column objects are consider equal?
            if (arrRow1[0] == arrRow2[0])
            {
                Console.WriteLine("The are Equal");
            }
            else
            {
                Console.WriteLine("The are Different!");
            }
        }
コード例 #34
0
        public ActionResult Get(EdFiDashboardContext context)
        {
            var learningObjectives = service.Get(new LearningObjectiveRequest()
                                        {
                                            StudentUSI = context.StudentUSI.GetValueOrDefault(),
                                            SchoolId = context.SchoolId.GetValueOrDefault(),
                                            MetricVariantId = context.MetricVariantId.GetValueOrDefault()
                                        });


            var model = new GridTable { MetricVariantId = context.MetricVariantId.GetValueOrDefault() };

            if (learningObjectives == null || learningObjectives.AssessmentTitles.Count == 0)
            {
                return View(model);
            }

            var orderedAssessmentTitles = GetOrderedAssessmentTitles(learningObjectives.AssessmentTitles);

            #region Headers
            model.Columns = new List<Column>{
                new Column { IsVisibleByDefault = true, IsFixedColumn = true,
                Children= new List<Column>{
                        new ImageColumn{ Src = "LeftGrayCorner.png", IsVisibleByDefault=true, IsFixedColumn = true },
                        new TextColumn{ DisplayName = learningObjectives.InventoryName, IsVisibleByDefault=true, IsFixedColumn = true},
                    }
                },
                new TextColumn{DisplayName="Spacer",  IsVisibleByDefault=true, IsFixedColumn = true,
                    Children= new List<Column>{
                        new TextColumn{ IsVisibleByDefault=true, IsFixedColumn = true},
                    }
                }
            };

            //For the Dynamic Columns (this is the Header which is empty "no text")
            var parentColumn = new TextColumn { DisplayName = "Reading Assessments", IsVisibleByDefault = true };
            foreach (var learningObjectiveTitle in orderedAssessmentTitles)
            {
                parentColumn.Children.Add(new TextColumn { DisplayName = learningObjectiveTitle, IsVisibleByDefault = true });
            }

            model.Columns.Add(parentColumn);

            #endregion

            #region Rows

            var orderedLearningObjectives = learningObjectives.LearningObjectiveSkills.OrderBy(los => los.SectionName).ThenBy(los => los.SkillName);

            foreach (var learningObjectiveSection in orderedLearningObjectives)
            {
                var row = new List<object>();

                //Learning Objective section cell
                row.Add(new CellItem<double> { DV = "", V = 0 });
                row.Add(new ObjectiveTextCellItem<string> { O = string.Format("{0}: {1}", learningObjectiveSection.SectionName, learningObjectiveSection.SkillName), V = string.Format("{0}: {1}", learningObjectiveSection.SectionName, learningObjectiveSection.SkillName) });

                //Spacer
                row.Add(new SpacerCellItem<double> { DV = "", V = 0 });

                foreach (var learningObjectiveAssessmentTitle in orderedAssessmentTitles)
                {
                    var cell = new ObjectiveCellItem<int> { DV = "", V = -1 };

                    if (learningObjectiveSection.SkillValues.Any(skill => skill.Title == learningObjectiveAssessmentTitle))
                    {
                        var learningObjectiveSkill = learningObjectiveSection.SkillValues.Where(skill => skill.Title == learningObjectiveAssessmentTitle).First();

                        cell.V = ChangeValueForSorting(learningObjectiveSkill.MetricStateTypeId);
                        cell.ST = (learningObjectiveSkill.MetricStateTypeId != null) ? learningObjectiveSkill.MetricStateTypeId.Value : (int)MetricStateType.None;
                        cell.DV = learningObjectiveSkill.Value;
                    }

                    row.Add(cell);
                }

                model.Rows.Add(row);
            }
            #endregion

            return View(model);
        }