Exemplo n.º 1
0
        public void testGetter()
        {
            DataProvider dataProvider = new DataProvider();
            SampleDataGroup dataSource = new SampleDataGroup("1","test","subtest","none","desc");

            dataProvider.setGroup(dataSource);

            Assert.AreEqual(dataSource, dataProvider.getGroup(0));
        }
Exemplo n.º 2
0
        public void testPersistence()
        {
            DataProvider dataProvider = new DataProvider();
            SampleDataGroup dataSource = new SampleDataGroup("1", "test", "subtest", "none", "desc");

            DataProvider dataProvider2 = new DataProvider();
            SampleDataGroup dataSource2 = new SampleDataGroup("2", "test2", "subtest2", "none2", "desc2");

            dataProvider.setGroup(dataSource);
            dataProvider2.setGroup(dataSource2);

            Assert.AreEqual(8, dataProvider2.getCount());
        }
Exemplo n.º 3
0
        public static void readXmlNode(XDocument oDoc)
        {
            XElement[] Elements = oDoc.Descendants("Titles").ToArray();
            string uid ,title, subtitle, imagepath, description;
            foreach (XElement xe in Elements)
            {
                // TODO: add check to see if uid is actualy unique
                uid = xe.Element("uid").Value.ToString();
                if (SampleDataSource.GetGroup(uid) != null) continue;
                title = xe.Element("title").Value.ToString();
                subtitle = xe.Element("subtitle").Value.ToString();
                imagepath = xe.Element("image").Value.ToString();
                description = xe.Element("description").Value.ToString();
                var group = new SampleDataGroup(uid, title, subtitle, imagepath, description);
                //this.setGroup(group);
                
                SampleDataSource.setGroup(group);
            }

        }
Exemplo n.º 4
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="navigationParameter">The parameter value passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
        /// </param>
        /// <param name="pageState">A dictionary of state preserved by this page during an earlier
        /// session.  This will be null the first time a page is visited.</param>
        protected override async void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            // TODO: Add dynamic data here
            DataProvider dataProvider = new DataProvider();

            String ITEM_CONTENT = String.Format("Item Content: {0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}",
                       "Curabitur class aliquam vestibulum nam curae maecenas sed integer cras phasellus suspendisse quisque donec dis praesent accumsan bibendum pellentesque condimentum adipiscing etiam consequat vivamus dictumst aliquam duis convallis scelerisque est parturient ullamcorper aliquet fusce suspendisse nunc hac eleifend amet blandit facilisi condimentum commodo scelerisque faucibus aenean ullamcorper ante mauris dignissim consectetuer nullam lorem vestibulum habitant conubia elementum pellentesque morbi facilisis arcu sollicitudin diam cubilia aptent vestibulum auctor eget dapibus pellentesque inceptos leo egestas interdum nulla consectetuer suspendisse adipiscing pellentesque proin lobortis sollicitudin augue elit mus congue fermentum parturient fringilla euismod feugiat");
            var group = new SampleDataGroup("Awesome group",
                    "Group Title: 1",
                    "Group Subtitle: 1",
                    "Assets/DarkGray.png",
                    "Group Description: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus tempor scelerisque lorem in vehicula. Aliquam tincidunt, lacus ut sagittis tristique, turpis massa volutpat augue, eu rutrum ligula ante a ante");
            group.Items.Add(new SampleDataItem("Group-1-Item-1",
                    "Item Title: 1",
                    "Item Subtitle: 1",
                    "Assets/LightGray.png",
                    "Item Description: Pellentesque porta, mauris quis interdum vehicula, urna sapien ultrices velit, nec venenatis dui odio in augue. Cras posuere, enim a cursus convallis, neque turpis malesuada erat, ut adipiscing neque tortor ac erat.",
                    ITEM_CONTENT,
                    group));
            group.Items.Add(new SampleDataItem("Group-1-Item-2",
                    "Item Title: 2",
                    "Item Subtitle: 2",
                    "Assets/DarkGray.png",
                    "Item Description: Pellentesque porta, mauris quis interdum vehicula, urna sapien ultrices velit, nec venenatis dui odio in augue. Cras posuere, enim a cursus convallis, neque turpis malesuada erat, ut adipiscing neque tortor ac erat.",
                    ITEM_CONTENT,
                    group));

            dataProvider.setGroup(group);
            //httpRequest to fetch all data
            //httpRequest("titles");
            dataProvider.httpRequest("titles&tutorials");
            
            var sampleDataGroups = SampleDataSource.GetGroups((String)navigationParameter);
            
            this.DefaultViewModel["Items"] = sampleDataGroups;
        }
Exemplo n.º 5
0
 /*
  * 
  * 
  */
 public void setGroup(SampleDataGroup oSource)
 {
     _aDataSource.Add(oSource);
 }
 public static void setGroup(SampleDataGroup group)
 {
     if (_sampleDataSource == null)
         _sampleDataSource = new SampleDataSource();
     _sampleDataSource.AllGroups.Add(group);
 }
        public SampleDataSource()
        {
            // this should load local data, cause it's executed once
            DataProvider.readData();
            // TODO: delete this at the end.
            String ITEM_CONTENT = String.Format("Item Content: {0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}",
                        "Curabitur class aliquam vestibulum nam curae maecenas sed integer cras phasellus suspendisse quisque donec dis praesent accumsan bibendum pellentesque condimentum adipiscing etiam consequat vivamus dictumst aliquam duis convallis scelerisque est parturient ullamcorper aliquet fusce suspendisse nunc hac eleifend amet blandit facilisi condimentum commodo scelerisque faucibus aenean ullamcorper ante mauris dignissim consectetuer nullam lorem vestibulum habitant conubia elementum pellentesque morbi facilisis arcu sollicitudin diam cubilia aptent vestibulum auctor eget dapibus pellentesque inceptos leo egestas interdum nulla consectetuer suspendisse adipiscing pellentesque proin lobortis sollicitudin augue elit mus congue fermentum parturient fringilla euismod feugiat");

            DataProvider dataProvider = new DataProvider();
            var group = new SampleDataGroup("Group-1",
                    "Group Title: 1",
                    "Group Subtitle: 1",
                    "Assets/DarkGray.png",
                    "smaller to see where it is");
            group.Items.Add(new SampleDataItem("Group-1-Item-1",
                    "Item Title: 1",
                    "Item Subtitle: 1",
                    "Assets/LightGray.png",
                    "Item Description: Pellentesque porta, mauris quis interdum vehicula, urna sapien ultrices velit, nec venenatis dui odio in augue. Cras posuere, enim a cursus convallis, neque turpis malesuada erat, ut adipiscing neque tortor ac erat.",
                    ITEM_CONTENT,
                    group));
            group.Items.Add(new SampleDataItem("Group-1-Item-2",
                    "Item Title: 2",
                    "Item Subtitle: 2",
                    "Assets/DarkGray.png",
                    "Item Description: Pellentesque porta, mauris quis interdum vehicula, urna sapien ultrices velit, nec venenatis dui odio in augue. Cras posuere, enim a cursus convallis, neque turpis malesuada erat, ut adipiscing neque tortor ac erat.",
                    ITEM_CONTENT,
                    group));

            dataProvider.setGroup(group);
            //var group1 = dataProvider.getGroup(1);
            //

            //  dataProvider.getData();
            int iCount = dataProvider.getCount();
            if (iCount > 0)
            {
                for (int i = 0; i < iCount; i++)
                {
                    group = dataProvider.getGroup(i);

                    this.AllGroups.Add(group);
                }
            }
        }
 public SampleDataItem(String uniqueId, String title, String subtitle, String imagePath, String description, String content, SampleDataGroup group)
     : base(uniqueId, title, subtitle, imagePath, description)
 {
     this._content = content;
     this._group = group;
 }