예제 #1
0
파일: Form1.cs 프로젝트: acharal/spsync
        private void button1_Click(object sender, EventArgs e)
        {
            SpSync.Data.Server.SpServerSyncProvider prov = new SpSync.Data.Server.SpServerSyncProvider();
            prov.ServiceCredentials = new System.Net.NetworkCredential("nangelc1it", "p@n@th@s13", "VIANEX");
            prov.BatchSize          = 100;
            SyncServerInfo info = prov.GetServerInfo(null);

            Microsoft.Synchronization.Data.SqlServerCe.SqlCeClientSyncProvider client = new Microsoft.Synchronization.Data.SqlServerCe.SqlCeClientSyncProvider("Data Source=test.sdf", true);
            Microsoft.Synchronization.SyncAgent agent = new Microsoft.Synchronization.SyncAgent(client, prov);
            //agent.Configuration.SyncTables.Add("Doctors", SyncDirection.Bidirectional);
            agent.Configuration.SyncTables.Add("Accounts", SyncDirection.DownloadOnly);
            //agent.Configuration.SyncTables.Add("Contacts", SyncDirection.DownloadOnly);
            agent.SessionProgress += new EventHandler <Microsoft.Synchronization.SessionProgressEventArgs>(agent_SessionProgress);
            agent.StateChanged    += new EventHandler <Microsoft.Synchronization.SessionStateChangedEventArgs>(agent_StateChanged);
            SyncStatistics stats = agent.Synchronize();
        }
예제 #2
0
파일: Program.cs 프로젝트: acharal/spsync
        static void Main(string[] args)
        {
            System.Diagnostics.Trace.Listeners.Add(new System.Diagnostics.ConsoleTraceListener());
            SpSync.Data.Server.SpServerSyncProvider prov = new SpSync.Data.Server.SpServerSyncProvider();
            prov.ServiceCredentials = new System.Net.NetworkCredential("nangelc1it", "p@n@th@s13", "VIANEX");
            prov.BatchSize          = 500;
            SyncServerInfo info = prov.GetServerInfo(null);

            Microsoft.Synchronization.Data.SqlServerCe.SqlCeClientSyncProvider client = new Microsoft.Synchronization.Data.SqlServerCe.SqlCeClientSyncProvider(Settings.Default.testConnectionString, true);
            Microsoft.Synchronization.SyncAgent agent = new Microsoft.Synchronization.SyncAgent(client, prov);
            //agent.Configuration.SyncTables.Add("Doctors", SyncDirection.Bidirectional);
            agent.Configuration.SyncTables.Add("Accounts", SyncDirection.DownloadOnly);
            agent.Configuration.SyncTables.Add("Contacts", SyncDirection.DownloadOnly);
            agent.SessionProgress += new EventHandler <Microsoft.Synchronization.SessionProgressEventArgs>(agent_SessionProgress);
            agent.StateChanged    += new EventHandler <Microsoft.Synchronization.SessionStateChangedEventArgs>(agent_StateChanged);
            SyncStatistics stats = agent.Synchronize();

            PrintStats(stats);
            Console.Read();
        }