예제 #1
0
파일: Main.cs 프로젝트: jpheary/Argix08
 //Interface
 public Main()
 {
     //Constructor
     try {
         InitializeComponent();
         this.mSyncAgent = new TsortCacheSyncAgent(new Sync.DriverScanService(Settings.Default.WebServiceURL));
         this.mSyncAgent.Client.SyncDirection    = Microsoft.Synchronization.Data.SyncDirection.DownloadOnly;
         this.mSyncAgent.Client.CreationOption   = Microsoft.Synchronization.Data.TableCreationOption.DropExistingOrCreateNewTable;
         this.mSyncAgent.Store.SyncDirection     = Microsoft.Synchronization.Data.SyncDirection.DownloadOnly;
         this.mSyncAgent.Store.CreationOption    = Microsoft.Synchronization.Data.TableCreationOption.DropExistingOrCreateNewTable;
         this.mSyncAgent.ScanData.SyncDirection  = Microsoft.Synchronization.Data.SyncDirection.UploadOnly;
         this.mSyncAgent.ScanData.CreationOption = Microsoft.Synchronization.Data.TableCreationOption.DropExistingOrCreateNewTable;
     }
     catch (Exception ex) { App.ReportError(ex); }
 }
예제 #2
0
파일: Program.cs 프로젝트: jpheary/Argix08
 static void Main()
 {
     //Validate the database exists
     //If the local database doesn't exist, the app requires initilization
     try {
         using (SqlCeConnection conn = new SqlCeConnection(Settings.Default.LocalConnectionString)) {
             if (!System.IO.File.Exists(conn.Database))
             {
                 DialogResult result = MessageBox.Show("The application requires a first time sync to continue.  Would you like to Sync Now?", "Fist Time Run", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                 if (result == DialogResult.OK)
                 {
                     try {
                         Cursor.Current = Cursors.WaitCursor;
                         Cursor.Show();
                         TsortCacheSyncAgent syncAgent = new TsortCacheSyncAgent(new Sync.DriverScanService(Settings.Default.WebServiceURL));
                         syncAgent.Client.SyncDirection    = Microsoft.Synchronization.Data.SyncDirection.DownloadOnly;
                         syncAgent.Client.CreationOption   = Microsoft.Synchronization.Data.TableCreationOption.DropExistingOrCreateNewTable;
                         syncAgent.Store.SyncDirection     = Microsoft.Synchronization.Data.SyncDirection.DownloadOnly;
                         syncAgent.Store.CreationOption    = Microsoft.Synchronization.Data.TableCreationOption.DropExistingOrCreateNewTable;
                         syncAgent.ScanData.SyncDirection  = Microsoft.Synchronization.Data.SyncDirection.UploadOnly;
                         syncAgent.ScanData.CreationOption = Microsoft.Synchronization.Data.TableCreationOption.DropExistingOrCreateNewTable;
                         syncAgent.Synchronize();
                     }
                     catch (Exception ex) { App.ReportError(ex); }
                     finally { Cursor.Current = Cursors.Default; }
                 }
                 else
                 {
                     return;
                 }
             }
         }
         Application.Run(new Main());
     }
     catch (Exception ex) { App.ReportError(ex); Application.Exit(); }
 }