Exemplo n.º 1
0
        public SyncForm()
        {
            InitializeComponent();

            if (string.IsNullOrEmpty(textPeer1Machine.Text))
            {
                textPeer1Machine.Text = Environment.MachineName;
            }

            if (string.IsNullOrEmpty(textPeer2Machine.Text))
            {
                textPeer2Machine.Text = Environment.MachineName;
            }

            if (string.IsNullOrEmpty(textPeer3Machine.Text))
            {
                textPeer3Machine.Text = Environment.MachineName;
            }

            _progressForm = null;
        }
Exemplo n.º 2
0
        //
        // Synchronize Call
        //
        private void buttonSynchronize_Click(object sender, EventArgs e)
        {
            try
            {

                //
                // 1. Create instance of the sync components (peer, agent, peer)
                // This demo illustrates direct connection to server database. In this scenario,
                // all sync components reside in the sample process.
                //
                DbSyncProvider localProvider = new DbSyncProvider();
                DbSyncProvider remoteProvider = new DbSyncProvider();

                localProvider = SetupSyncProvider(GetFromPeerConnectionString(), localProvider);
                localProvider.SyncProviderPosition = SyncProviderPosition.Local;

                remoteProvider = SetupSyncProvider(GetToPeerConnectionString(), remoteProvider);
                remoteProvider.SyncProviderPosition = SyncProviderPosition.Remote;

                SyncOrchestrator syncOrchestrator = new SyncOrchestrator();
                // syncdirection: local->remote
                syncOrchestrator.LocalProvider = localProvider;
                syncOrchestrator.RemoteProvider = remoteProvider;
                syncOrchestrator.Direction = SyncDirectionOrder.Upload;
                syncOrchestrator.SessionProgress += new EventHandler<SyncStagedProgressEventArgs>(ProgressChanged);

                _progressForm = new ProgressForm();
                _progressForm.Show();
                SyncOperationStatistics syncStats = syncOrchestrator.Synchronize();

                _progressForm.ShowStatistics(syncStats);
                // Update the UI
                _progressForm.EnableClose();
                _progressForm = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                if (_progressForm != null)
                {
                    _progressForm.EnableClose();
                    _progressForm = null;
                }
            }
        }
Exemplo n.º 3
0
        private void buttonCleanupOrderMetadata_Click(object sender, EventArgs e)
        {
            try
            {
                DbSyncProvider provider = new DbSyncProvider();

                provider = SetupSyncProvider(GetConnectionString(), provider);

                if (provider.CleanupMetadata() == false)
                {
                    MessageBox.Show("Metadata cleanup failed.  Please retry");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                if (_progressForm != null)
                {
                    _progressForm.EnableClose();
                    _progressForm = null;
                }
            }
        }