Пример #1
0
        void replHelper_Completed(object sender, SqlCeReplicationHelper.SyncArgs ca)
        {
            if (!btnSync.Dispatcher.CheckAccess())
            {
                btnSync.Dispatcher.Invoke(
                    System.Windows.Threading.DispatcherPriority.Normal,
                    new Action(
                        delegate
                {
                    PrepareUi();
                    btnSync.IsEnabled = true;
                }
                        ));
            }
            else
            {
                PrepareUi();
                btnSync.IsEnabled = true;
            }

            if (ca.Exception() != null)
            {
                if (!txtStatus.Dispatcher.CheckAccess())
                {
                    txtStatus.Dispatcher.Invoke(
                        System.Windows.Threading.DispatcherPriority.Normal,
                        new Action(
                            delegate
                    {
                        txtStatus.Text += Helpers.RepositoryHelper.CreateEngineHelper(DatabaseType.SQLCE35).FormatError(ca.Exception()) + Environment.NewLine;
                    }
                            ));
                }
                else
                {
                    txtStatus.Text += Helpers.RepositoryHelper.CreateEngineHelper(DatabaseType.SQLCE35).FormatError(ca.Exception()) + Environment.NewLine;
                }
            }
            else
            {
                IsNew = false;
            }
            if (!txtStatus.Dispatcher.CheckAccess())
            {
                txtStatus.Dispatcher.Invoke(
                    System.Windows.Threading.DispatcherPriority.Normal,
                    new Action(
                        delegate
                {
                    txtStatus.Text += ca.Message() + Environment.NewLine;
                }
                        ));
            }
            else
            {
                txtStatus.Text += ca.Message() + Environment.NewLine;
            }
            _replHelper.Dispose();
        }
Пример #2
0
 void replHelper_Progress(object sender, SqlCeReplicationHelper.SyncArgs ca)
 {
     if (!txtStatus.Dispatcher.CheckAccess())
     {
         txtStatus.Dispatcher.Invoke(
             System.Windows.Threading.DispatcherPriority.Normal,
             new Action(
                 delegate
         {
             txtStatus.Text += ca.Message() + Environment.NewLine;
         }
                 ));
     }
     else
     {
         txtStatus.Text += ca.Message() + Environment.NewLine;
     }
 }