コード例 #1
0
        public async Task UpdateChats()
        {
            StorageFolder appStorageFolder = IORecipes.GetAppStorageFolder();
            await IORecipes.DeleteFileInFolder(appStorageFolder, dataFileName);

            string      itemsAsXML = IORecipes.SerializeToString(this.Items);
            StorageFile dataFile   = await IORecipes.CreateFileInFolder(appStorageFolder, dataFileName);

            await IORecipes.WriteStringToFile(dataFile, itemsAsXML);
        }
コード例 #2
0
        }// end RemoveToDoItem(ToDoItemModel toDoItemToRemove)

        public async Task UpdateToDoItems()
        {
            StorageFolder appFolder = IORecipes.GetAppStorageFolder();
            await IORecipes.DeleteFileInFolder(appFolder, DATA_FILE_NAME);

            string      itemsAsXml = IORecipes.SerializeToString(this.Items);
            StorageFile dataFile   = await IORecipes.CreateFileInFolder(appFolder, DATA_FILE_NAME);

            await IORecipes.WriteStringToFile(dataFile, itemsAsXml);
        }//end UpdateToDoItems()
コード例 #3
0
        public async void refreshfav()
        {
            int num;

            string[] separators = { "(", " " };
            string[] ph_num     = new string[2];
            bool     contactavailable;

            this.Favcontacts = new ObservableCollection <Favourites>();
            //favDataSource = new List<AlphaKeyGroup<AddressBook>>();
            foreach (Contact c in PhoneContacts)
            {
                foreach (ContactPhoneNumber ph in c.PhoneNumbers)
                {
                    ph_num = ph.ToString().Split(separators, StringSplitOptions.RemoveEmptyEntries);

                    if (ph_num[0].Length >= 10)
                    {
                        num       = ph_num[0].Length - 10;
                        ph_num[0] = ph_num[0].Substring(num);


                        contactavailable = await ConnectToWindowsAzure(ph_num[0]);

                        if (contactavailable)
                        {
                            Favourites fav = new Favourites()
                            {
                                Name            = c.DisplayName,
                                Favouritenumber = ph_num[0]
                            };
                            this.Favcontacts.Add(fav);
                            //favSource.Add(new AddressBook(c.DisplayName, ph_num[0]));
                        }
                    }
                }
            }
            //favDataSource = AlphaKeyGroup<AddressBook>.CreateGroups(favSource,
            //       System.Threading.Thread.CurrentThread.CurrentUICulture,
            //       (AddressBook s) => { return s.Name; }, true);
            StorageFolder appStorageFolder = IORecipes.GetAppStorageFolder();
            await IORecipes.DeleteFileInFolder(appStorageFolder, FavContactFileName);

            string      itemsAsXML = IORecipes.SerializeToString(this.Favcontacts);
            StorageFile dataFile   = await IORecipes.CreateFileInFolder(appStorageFolder, FavContactFileName);

            await IORecipes.WriteStringToFile(dataFile, itemsAsXML);
        }