Ejemplo n.º 1
0
        protected override NWidget CreateExampleContent()
        {
            m_TableView = new NTableGridView();

            // create a dummy data source with many columns to demonstrate horizontal scrolling
            NMemoryDataTable dataTable = new NMemoryDataTable(new NFieldInfo[] {
                // person info
                new NFieldInfo("Name-0", typeof(String)),
                new NFieldInfo("Gender-1", typeof(ENGender)),
                new NFieldInfo("Birthday-2", typeof(DateTime)),
                new NFieldInfo("Phone-3", typeof(String)),
                new NFieldInfo("Email-4", typeof(String)),
                // address info
                new NFieldInfo("Country-5", typeof(ENCountry)),
                new NFieldInfo("City-6", typeof(String)),
                new NFieldInfo("Address-7", typeof(String)),
                // product info
                new NFieldInfo("Product Name-8", typeof(String)),
                new NFieldInfo("Product Price-9", typeof(Double)),
                new NFieldInfo("Product Quantity-10", typeof(Int32)),
            });

            for (int i = 0; i < 1000; i++)
            {
                NDummyDataSource.NPersonInfo  personInfo  = NDummyDataSource.RandomPersonInfo();
                NDummyDataSource.NAddressInfo addressInfo = NDummyDataSource.RandomAddressInfo();
                NDummyDataSource.NProductInfo productInfo = NDummyDataSource.RandomProductInfo();

                dataTable.AddRow(
                    // person info
                    personInfo.Name,
                    personInfo.Gender,
                    personInfo.Birthday,
                    personInfo.Phone,
                    personInfo.Email,
                    // address
                    addressInfo.Country,
                    addressInfo.City,
                    addressInfo.Address,
                    // product
                    productInfo.Name,
                    productInfo.Price,
                    NDummyDataSource.RandomInt32(1, 100)
                    );
            }

            m_TableView.Grid.DataSource = new NDataSource(dataTable);
            return(m_TableView);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a fictional data source that represents received e-mails.
        /// </summary>
        /// <returns></returns>
        private NDataSource CreateMailDataSource()
        {
            // create a a dummy data table that represents a simple organization.
            NMemoryDataTable dataTable = new NMemoryDataTable(new NFieldInfo[] {
                new NFieldInfo("From", typeof(String)),
                new NFieldInfo("Subject", typeof(String)),
                new NFieldInfo("Received", typeof(DateTime)),
                new NFieldInfo("Size", typeof(String)),
            });

            string[] subjects = new string[]
            {
                "VIVACOM BILL",
                "SharePoint Users",
                "USB Sticks",
                "Garden Conference",
                ".NET Core and .NET Native",
                "Hackers Attack",
                "Week in Review",
                "Big Data Analytics",
                "Encryption Compromise",
                "Grid Issues",
                "DSC SOT BILL",
                "Data Security Bulletin",
                "How Cybercriminals use Facebook",
                "Empowering Users Success",
                "Boost your Income",
                "The AMISH way to motivate",
                "Daily news",
            };

            Random rnd = new Random();

            for (int i = 0; i < 600; i++)
            {
                string   name     = NDummyDataSource.RandomPersonInfo().Name;
                string   subject  = subjects[rnd.Next(subjects.Length)];
                DateTime received = m_Now - new TimeSpan(rnd.Next(60), rnd.Next(24), rnd.Next(60), 0);
                string   size     = (10 + rnd.Next(100)).ToString() + " KB";

                dataTable.AddRow(name, subject, received, size);
            }

            return(new NDataSource(dataTable));
        }