private void Worker_OnPersistenceCompleted(object sender, RunWorkerCompletedEventArgs evtArgs) { TStatusUpdate tsu = TStatusUpdate.tsuNone; if (evtArgs.Cancelled) { tsu = TStatusUpdate.tsuCancelled; } else if (null != evtArgs.Error) { tsu = TStatusUpdate.tsuError; } else if (null != evtArgs.Result) { tsu = (TStatusUpdate)evtArgs.Result; } TStatusUpdate[] args = new TStatusUpdate[1] { tsu }; m_storeManager.Unlock(); if (Application.Current.Dispatcher.CheckAccess()) { OnCharacterListUpdate(args); } else { Application.Current.Dispatcher.Invoke(m_onCharacterListUpdateD, args); } }
private void btnMerge_Click(object sender, RoutedEventArgs e) { TStatusUpdate tsu = TStatusUpdate.tsuNone; System.Diagnostics.Debug.Assert(null != m_mergeGameCallback); System.Diagnostics.Debug.Assert(null != m_mergeTemplateCallback); if (-1 != lbGames.SelectedIndex) { if (lbGames.Items[lbGames.SelectedIndex] is CCBGame) { CCBGame game = (CCBGame)lbGames.Items[lbGames.SelectedIndex]; if (null != game) { tsu = m_mergeGameCallback(game); } } if (lbGames.Items[lbGames.SelectedIndex] is CCBGameTemplate) { CCBGameTemplate template = (CCBGameTemplate)lbGames.Items[lbGames.SelectedIndex]; if (null != template) { tsu = m_mergeTemplateCallback(template); } } if (TStatusUpdate.tsuFileLoaded == tsu) { tStatus.Content = ""; } else { tStatus.Content = "Could not load item."; } } else { tStatus.Content = "Wrong item in list."; } }
private TStatusUpdate MergeGameCallback(CCBGame game) { int cAdded; TStatusUpdate tsu = TStatusUpdate.tsuCancelled; if (m_games.HasGame(game.Name)) { if (!ConfirmGameMerge(game.Name)) { tsu = TStatusUpdate.tsuFileNothingLoaded; } } if (0 < (cAdded = m_games.MergeGame(game))) { tbLastError.Text = string.Format("Added {0} characters", cAdded); tsu = TStatusUpdate.tsuFileLoaded; } if (TStatusUpdate.tsuFileLoaded == tsu) { this.PopulateCharacterList(); } return(tsu); }