コード例 #1
0
        // When the page is constructed, the client receives all pre-existing groups
        // from the database. These groups are loaded into a temporary list which are
        // then read into the ObservableCollection. This intermediary step was made
        // necessary due to the fact that ObservableCollections cannot be assigned to Lists.
        private async void LoadGroups()
        {
            _loadedGroups = await GroupDBService.LoadGroups();

            foreach (var group in _loadedGroups)
            {
                this.LoadedGroups.Add(group);
            }
        }
コード例 #2
0
        // Using the assigned code, a new database is created in the Azure Cosmos DB with the appropriate collections.
        private async void InitializeDB()
        {
            await GroupDBService.CreateDatabase(SubjectCode);

            await GroupDBService.CreateDocumentCollection(SubjectCode, "Messages");

            await GroupDBService.CreateDocumentCollection(SubjectCode, "Flashcards");

            await GroupDBService.CreateDocumentCollection(SubjectCode, "Lease");

            await GroupDBService.CreateDocumentCollection(SubjectCode, "FlashLease");
        }
コード例 #3
0
        private async void CreateGroup()
        {
            // The user must both assign a name and a code or the group will not be created and published to the database.
            if (SubjectCode == null || SubjectName == null)
            {
                return;
            }

            Group group = new Group()
            {
                GroupOwner       = MainPageViewModel.CurrentGoogleUsername,
                GroupSubjectCode = SubjectCode,
                GroupSubjectName = SubjectName
            };

            Console.WriteLine(group.ToString());

            await GroupDBService.UploadGroup(group);

            InitializeDB();

            await _navigationService.NavigateAsync("GroupSelectionPage");
        }