Exemplo n.º 1
0
        private void   更新并初始化数据UToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                Synchronize syncSub = new Synchronize();

                // Disable the current form
                this.Enabled = false;

                syncSub.Show(this);

                syncSub.ReinitializeSubscriptionWithUpload();
            }
            catch (Exception ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex,
                                                                  ExceptionMessageBoxButtons.OK);
                emb.Show(this);
            }
            finally
            {
                loadLastAgentSessionSummary();
                // Enable the current form
                this.Enabled = true;
            }
        }
Exemplo n.º 2
0
        private void 只上传数据ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                Synchronize syncSub = new Synchronize();

                // Disable the current form
                this.Enabled = false;

                syncSub.Show(this);

                syncSub.SynchronizeSubscriptionUploadOnly();
                syncWhenConnectedStatus.Visible = false;
            }
            catch (Exception ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex,
                                                                  ExceptionMessageBoxButtons.OK);
                emb.Show(this);
            }
            finally
            {
                // Enable the current form
                this.Enabled = true;
            }
        }
Exemplo n.º 3
0
        private void syncTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            Synchronize syncSub;

            // Start a background synchronization if an Internet connection is
            // available and data is not being edited.
            if (GetConnectionState() == ConnectedState.Connected)
            {
                syncWhenConnectedIcon.Image = Properties.Resources.connected;

                // Instantiate the replication code without the Form.
                syncSub = new Synchronize();


                syncWhenConnectedText.Text
                    = Properties.Resources.StatusSyncStarting;

                syncWhenConnectedIcon.Image = Properties.Resources.synchronizing;

                try
                {
                    syncSub.Status += new SyncWhenConnectedStatus(syncSub_Status);
                    syncSub.SynchronizeSubscriptionFull();


                    syncWhenConnectedText.Text
                        = Properties.Resources.StatusSyncComplete;
                }
                catch
                {
                    syncWhenConnectedText.Text
                        = Properties.Resources.StatusSyncFailed;
                }
                finally
                {
                    syncWhenConnectedIcon.Image = Properties.Resources.connected;
                    loadLastAgentSessionSummary();
                    // Reload data from database
                }
            }
            else
            {
                syncWhenConnectedIcon.Image = Properties.Resources.disconnected;
                notifyIcon.Text             = "网络连接断开";
            }
        }
Exemplo n.º 4
0
        private void 重新初始化数据RToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                Synchronize syncSub = new Synchronize();

                // Disable the current form
                this.Enabled = false;

                syncSub.Show(this);

                syncSub.ReinitializeSubscription();

            }
            catch (Exception ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex,
                    ExceptionMessageBoxButtons.OK);
                emb.Show(this);
            }
            finally
            {
                loadLastAgentSessionSummary();
                // Enable the current form
                this.Enabled = true;
            }
        }
Exemplo n.º 5
0
        private void 只上传数据ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                Synchronize syncSub = new Synchronize();

                // Disable the current form
                this.Enabled = false;

                syncSub.Show(this);

                syncSub.SynchronizeSubscriptionUploadOnly();
                syncWhenConnectedStatus.Visible = false;

            }
            catch (Exception ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex,
                    ExceptionMessageBoxButtons.OK);
                emb.Show(this);
            }
            finally
            {
                // Enable the current form
                this.Enabled = true;
            }
        }
Exemplo n.º 6
0
        private void syncTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            Synchronize syncSub;

            // Start a background synchronization if an Internet connection is
            // available and data is not being edited.
            if (GetConnectionState() == ConnectedState.Connected)
            {
                syncWhenConnectedIcon.Image = Properties.Resources.connected;

                // Instantiate the replication code without the Form.
                syncSub = new Synchronize();

                syncWhenConnectedText.Text
                   = Properties.Resources.StatusSyncStarting;

                syncWhenConnectedIcon.Image = Properties.Resources.synchronizing;

                try
                {
                    syncSub.Status += new SyncWhenConnectedStatus(syncSub_Status);
                    syncSub.SynchronizeSubscriptionFull();

                    syncWhenConnectedText.Text
                        = Properties.Resources.StatusSyncComplete;
                }
                catch
                {
                    syncWhenConnectedText.Text
                        = Properties.Resources.StatusSyncFailed;
                }
                finally
                {
                    syncWhenConnectedIcon.Image = Properties.Resources.connected;
                    loadLastAgentSessionSummary();
                    // Reload data from database
                }
            }
            else
            {
                syncWhenConnectedIcon.Image = Properties.Resources.disconnected;
                notifyIcon.Text = "网络连接断开";
            }
        }
Exemplo n.º 7
0
        private void showSyncDialog()
        {
            try
            {
                Synchronize syncSub = new Synchronize();

                // Disable the current form
                this.Enabled = false;

                syncSub.Show(this);

                // Check that the subscription exists.
                syncSub.CheckSubscription();

                // Disable upload only if Web synchronization is enabled.
                if (syncSub.UseWebSynchronization)
                {
                    mnuSynchronizeOnlyUploadData.Enabled = false;
                }

            }
            catch (SqlException ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(
                    Properties.Resources.ExceptionVerifySqlServerRunning,
                    Properties.Resources.ExceptionSqlServerError,
                    ExceptionMessageBoxButtons.OK);
                emb.InnerException = ex;
                emb.Show(this);

                // Shutdown the application because we can't continue.
                Application.Exit();
            }
            catch (ApplicationException ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex,
                    ExceptionMessageBoxButtons.OK);
                emb.Show(this);

                // Shutdown the application because we can't continue.
                Application.Exit();
            }
            catch (Exception ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex,
                    ExceptionMessageBoxButtons.OK);
                emb.Show(this);

                // Shutdown the application because we can't continue.
                Application.Exit();
            }
            catch
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(@"CATASTROPHIC FAILURE!",
                    @"CLOSING APPLICATION");
                emb.Show(this);

                // Shutdown the application because we can't continue.
                Application.Exit();
            }
            finally
            {
                // Enable the current form
                this.Enabled = true;
            }
        }
Exemplo n.º 8
0
        private void showSyncDialog()
        {
            try
            {
                Synchronize syncSub = new Synchronize();

                // Disable the current form
                this.Enabled = false;

                syncSub.Show(this);

                // Check that the subscription exists.
                syncSub.CheckSubscription();

                // Disable upload only if Web synchronization is enabled.
                if (syncSub.UseWebSynchronization)
                {
                    mnuSynchronizeOnlyUploadData.Enabled = false;
                }
            }
            catch (SqlException ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(
                    Properties.Resources.ExceptionVerifySqlServerRunning,
                    Properties.Resources.ExceptionSqlServerError,
                    ExceptionMessageBoxButtons.OK);
                emb.InnerException = ex;
                emb.Show(this);

                // Shutdown the application because we can't continue.
                Application.Exit();
            }
            catch (ApplicationException ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex,
                                                                  ExceptionMessageBoxButtons.OK);
                emb.Show(this);

                // Shutdown the application because we can't continue.
                Application.Exit();
            }
            catch (Exception ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex,
                                                                  ExceptionMessageBoxButtons.OK);
                emb.Show(this);

                // Shutdown the application because we can't continue.
                Application.Exit();
            }
            catch
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(@"CATASTROPHIC FAILURE!",
                                                                  @"CLOSING APPLICATION");
                emb.Show(this);

                // Shutdown the application because we can't continue.
                Application.Exit();
            }
            finally
            {
                // Enable the current form
                this.Enabled = true;
            }
        }