async Task ExecuteLoadItemsCommand() { // standard pattern to protect asynchronous functions if (IsBusy) { return; } // if the work has started - no further attempts of the work can occur IsBusy = true; try { // look up necessary data and populate Notes.Clear(); var notes = await PluralSightDataStore.GetNotesAsync(); foreach (var note in notes) { Notes.Add(note); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
async Task ExeculeLoadNotesCommand() { if (IsBusy) { return; } IsBusy = true; try { Notes.Clear(); var notes = await PluralSightDataStore.GetNotesAsync(); foreach (var note in notes) { Notes.Add(note); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }