private void context_LoadCompleted(object sender, Microsoft.Synchronization.ClientServices.IsolatedStorage.LoadCompletedEventArgs e) { if (_syncAfterLoad) { RefreshAsync(syncEvent); _syncAfterLoad = false; } else if (syncEvent != null) { syncEvent(this, new SyncEventArgs()); } }
/// <summary> /// Called when the context is don laoding /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void ModelLoadCompleted(object sender, LoadCompletedEventArgs e) { // This callback is not guaranteed to occur on the UI thread, so dispatch on the // UI thread. Dispatcher.BeginInvoke(() => { if (e.Exception == null) { Bind(); } else { MessageBox.Show("Loading the context failed: " + e.Exception.ToString()); } }); }
/// <summary> /// Handles the context LoadCompleted event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ContextLoadCompleted(object sender, LoadCompletedEventArgs e) { if (e.Exception == null) { loaded = true; // Notify that all of the collections changed OnPropertyChanged("Tags"); OnPropertyChanged("Statuses"); OnPropertyChanged("Priorities"); OnPropertyChanged("User"); OnPropertyChanged("UserTags"); OnPropertyChanged("Lists"); var loadCompleted = LoadCompleted; if (loadCompleted != null) { loadCompleted(this, e); } } else if (e.Exception is ArgumentException) { context.ClearCache(); context.LoadAsync(); } }