public async void UpdatePageContent(string selectedModule) { module = await QUTBrainGearDB.GetModule(selectedModule).ConfigureAwait(false); RaisePropertyChanged(() => ModuleSkills); RaisePropertyChanged(() => ModuleVideo); module.moduleComments = new ObservableCollection <Comment>(await QUTBrainGearDB.GetModuleComments(ModuleId).ConfigureAwait(false)); RaisePropertyChanged(() => ModuleComments); RaisePropertyChanged(() => ListHeight); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public ModulePageViewModel(IMyNavigationService navigationService) { this.navigationService = navigationService; AddCommentsCommand = new Command(() => { var newComment = new Comment(ModuleId, AddComment); QUTBrainGearDB.InsertOrUpdateComments(newComment); module.moduleComments.Add(newComment); AddComment = null; RaisePropertyChanged(() => ModuleComments); RaisePropertyChanged(() => AddComment); RaisePropertyChanged(() => ListHeight); }); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); CurrentPlatform.Init(); MobileService = new MobileServiceClient( "https://qutbraingearapp.azure-mobile.net/", "dqTWRsEygjexEvHVQYjzrneKfvTKBU73" ); // new code to initialize the SQLite store string path = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), localDbFilename); if (!File.Exists(path)) { File.Create(path).Dispose(); } var store = new MobileServiceSQLiteStore(path); store.DefineTable <Module>(); store.DefineTable <QA>(); store.DefineTable <Comment>(); store.DefineTable <Skills>(); // Uses the default conflict handler, which fails on conflict MobileService.SyncContext.InitializeAsync(store, new MobileServiceSyncHandler()).Wait(); QUTBrainGearDB.MobileService = MobileService; QUTBrainGearDB.ModuleTable = MobileService.GetSyncTable <Module> (); QUTBrainGearDB.QATable = MobileService.GetSyncTable <QA> (); QUTBrainGearDB.CommentTable = MobileService.GetSyncTable <Comment> (); QUTBrainGearDB.SkillsTable = MobileService.GetSyncTable <Skills> (); QUTBrainGearDB.SyncAsync(); LoadApplication(new App()); }
public async void RecentVideos() { this.recentVideos = await QUTBrainGearDB.GetAllModules().ConfigureAwait(false); RaisePropertyChanged(() => recentVideos); }
public async void SkillList() { this.skillList = await QUTBrainGearDB.GetAllSkills().ConfigureAwait(false); RaisePropertyChanged(() => skillList); }
public async void QAList() { this.qaList = await QUTBrainGearDB.GetAllQA().ConfigureAwait(false); RaisePropertyChanged(() => qaList); }
protected override void OnStart() { QUTBrainGearDB.SyncAsync(); }
public async void GetData() { this.moduleList = await QUTBrainGearDB.GetAllModules(); ready = true; }