コード例 #1
0
        void SyncClicked(System.Object sender, System.EventArgs e)
        {
            SadDataBuild sadData = new SadDataBuild();

            sadData.SetSadDataBuildEmployees();
        }
コード例 #2
0
        protected override void OnAppearing()
        {
            base.OnAppearing();


            //listView.ItemsSource = getEmployees();

            var sList = new PersonList()
            {
                new EmployeeItem()
                {
                    FirstName = "Emily", LastName = "Sampson", Title = "Bounty Hunter", MarketNm = "West", PhoneNbr = "555-555-5555", Email = "*****@*****.**"
                },
                new EmployeeItem()
                {
                    FirstName = "Rex", LastName = "Shin", Title = "Runner", MarketNm = "Interloper", PhoneNbr = "555-123-4567"
                },
                new EmployeeItem()
                {
                    FirstName = "Zach", LastName = "Smith", Title = "Guard", MarketNm = "Security", PhoneNbr = "555-645-7809", Email = "*****@*****.**"
                }
            };

            sList.Heading = "S";


            var dList = new PersonList()
            {
                new EmployeeItem()
                {
                    FirstName = "Jane", LastName = "Doe", Title = "Crusader", MarketNm = "Operations", PhoneNbr = "555-000-9999", Email = "*****@*****.**"
                }
            };

            dList.Heading = "D";

            var jList = new PersonList()
            {
                new EmployeeItem()
                {
                    FirstName = "Shoeless", LastName = "Jackson", Title = "Public Relations", MarketNm = "Marketing", PhoneNbr = "555-111-9876", Email = "*****@*****.**"
                }
            };

            jList.Heading = "J";

            var list = new List <PersonList>()
            {
                dList,
                jList,
                sList
            };



            string messageContent = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "contactList.json");
            // read file into a string and deserialize JSON to a type
            string dewrp = File.ReadAllText(messageContent);
            List <EmployeeItem> empList = new List <EmployeeItem>();// JsonConvert.DeserializeObject<List<EmployeeItem>>(File.ReadAllText(messageContent));

            // deserialize JSON directly from a file
            using (StreamReader file = File.OpenText(messageContent))
            {
                JsonSerializer serializer = new JsonSerializer();
                empList = (List <EmployeeItem>)serializer.Deserialize(file, typeof(List <EmployeeItem>));
            }


            SadDataBuild sadData = new SadDataBuild();


            //ListOfPeople = list;
            listView.ItemsSource = sadData.GetEmployeeContactList(empList);
            //listView.ItemsSource = await App.Database.GetItemsAsync();
        }