Ejemplo n.º 1
0
        //--------------------------------------------------------------------------
        // Protected Methods
        //--------------------------------------------------------------------------

        /// <summary>
        /// Will close streams in the reverse order of intended creation.
        /// </summary>
        protected void ReleaseStreams()
        {
            try
            {
                // closing in revers order of creation
                if (DestinationProxy != null)
                {
                    if (DestinationProxy == SourceProxy)
                    {
                        SourceProxy = null;
                    }
                    DestinationProxy.Close();
                    DestinationProxy = null;
                }
            }
            finally
            {
                try
                {
                    if (WorkspaceProxy != null)
                    {
                        WorkspaceProxy.Close();
                        WorkspaceProxy = null;
                    }
                }
                finally
                {
                    if (SourceProxy != null)
                    {
                        SourceProxy.Close();
                        SourceProxy = null;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            SourceProxy      sourceProxy      = new SourceProxy();
            DestinationProxy destinationProxy = new DestinationProxy();

            List <User> users = new List <User>();

            while (true)
            {
                try
                {
                    users = sourceProxy.ReciveData();
                    destinationProxy.SendData(users);
                    Audit.ReplicationSuccess();
                }
                catch (Exception e)
                {
                    Audit.ReplicationFailed();
                }
                Thread.Sleep(5000);
            }
        }