private void LoguearNivelDeTracingConfigurador()
        {
            if (SyncTracer.IsErrorEnabled() || SyncTracer.IsWarningEnabled() || SyncTracer.IsInfoEnabled() || SyncTracer.IsVerboseEnabled())
            {
                Loguear("Tracing activado! revisar en config cual es el archivo.");
            }
            else
            {
                Loguear("Tracing desactivado, activar en el config.");
            }

            if (SyncTracer.IsErrorEnabled())
            {
                Loguear("Tracing de errores Activado");
            }

            if (SyncTracer.IsWarningEnabled())
            {
                Loguear("Tracing de advertencias Activado");
            }

            if (SyncTracer.IsInfoEnabled())
            {
                Loguear("Tracing de información Activado");
            }

            if (SyncTracer.IsVerboseEnabled())
            {
                Loguear("Tracing de todo Activado");
            }
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            //The Utility class handles all functionality that is not
            //directly related to synchronization, such as holding connection
            //string information and making changes to the server database.
            Utility util = new Utility();

            //The SampleStats class handles information from the SyncStatistics
            //object that the Synchronize method returns.
            SampleStats sampleStats = new SampleStats();

            //Delete and re-create the database. The client synchronization
            //provider also enables you to create the client database
            //if it does not exist.
            util.SetClientPassword();
            util.RecreateClientDatabase();

            //Write to the console which tracing levels are enabled. The app.config
            //file specifies a value of 3 for the SyncTracer switch, which corresponds
            //to Info. Therefore, Error, Warning, and Info return True, and Verbose
            //returns False.
            Console.WriteLine("");
            //<snippetOCS_CS_Tracing_LevelsEnabled>
            Console.WriteLine("** Tracing Levels Enabled for this Application **");
            Console.WriteLine("Error: " + SyncTracer.IsErrorEnabled().ToString());
            Console.WriteLine("Warning: " + SyncTracer.IsWarningEnabled().ToString());
            Console.WriteLine("Info: " + SyncTracer.IsInfoEnabled().ToString());
            Console.WriteLine("Verbose: " + SyncTracer.IsVerboseEnabled().ToString());
            //</snippetOCS_CS_Tracing_LevelsEnabled>

            //Initial synchronization. Instantiate the SyncAgent
            //and call Synchronize.
            //<snippetOCS_CS_Tracing_Synchronize>
            SampleSyncAgent sampleSyncAgent = new SampleSyncAgent();
            SyncStatistics  syncStatistics  = sampleSyncAgent.Synchronize();

            //</snippetOCS_CS_Tracing_Synchronize>
            sampleStats.DisplayStats(syncStatistics, "initial");

            //Make a change at the client that fails when it is
            //applied at the server. The constraint violation
            //is automatically written to the trace file as a warning.
            util.MakeFailingChangesOnClient();

            //Make changes at the client and server that conflict
            //when they are synchronized. The conflicts are written
            //to the trace file in the SampleServerSyncProvider_ApplyChangeFailed
            //event handler.
            util.MakeConflictingChangesOnClientAndServer();

            //Subsequent synchronization.
            syncStatistics = sampleSyncAgent.Synchronize();
            sampleStats.DisplayStats(syncStatistics, "subsequent");

            //Return server data back to its original state.
            util.CleanUpServer();

            //Exit.
            Console.Write("\nPress Enter to close the window.");
            Console.ReadLine();
        }