private void sync_SyncComplete(object sender, SyncCompleteEventArgs e) { var caption = PNStrings.PROG_NAME; var plugin = sender as ISyncPlugin; if (plugin != null) { caption = plugin.Name; } switch (e.Result) { case SyncResult.None: PNMessageBox.Show(PNLang.Instance.GetMessageText("sync_complete", "Synchronization completed successfully"), caption, MessageBoxButton.OK, MessageBoxImage.Information); break; case SyncResult.Reload: PNMessageBox.Show(PNLang.Instance.GetMessageText("sync_complete_reload", "Synchronization completed successfully. The program has to be restarted for applying all changes."), caption, MessageBoxButton.OK, MessageBoxImage.Information); PNData.UpdateTablesAfterSync(); PNStatic.FormMain.ApplyAction(MainDialogAction.Restart, null); break; case SyncResult.AbortVersion: PNMessageBox.Show(PNLang.Instance.GetMessageText("diff_versions", "Current version of database is different from previously synchronized version. Synchronization cannot be performed."), caption, MessageBoxButton.OK, MessageBoxImage.Exclamation); break; case SyncResult.Error: var sb = new StringBuilder(PNLang.Instance.GetMessageText("sync_error_1", "An error occurred during synchronization.")); sb.Append(" ("); sb.Append(caption); sb.Append(")"); sb.AppendLine(); sb.Append(PNLang.Instance.GetMessageText("sync_error_2", "Please, refer to log file of appropriate plugin.")); var baloon = new Baloon(BaloonMode.Error) { BaloonText = sb.ToString() }; PNStatic.FormMain.ntfPN.ShowCustomBalloon(baloon, PopupAnimation.Slide, 10000); break; } }
/// <summary> /// Method to be called when the sync ended successfully /// </summary> /// <param name="sender">The sender of the updates</param> /// <param name="e">Event with data about the sync completion</param> public void OnSyncCompleted(object sender, SyncCompleteEventArgs e) { // Toast.MakeText(this, "Sync finished successfully", ToastLength.Long).Show(); }