public DrawingViewModel(IDrawingView view) : base(view)
        {
            view.UpdateRectangleState = UpdateRectangleState;

            _rectangles = new List <Rectangle>();

            _replicationClient = new ReplicationClient <Rectangle>();
            _replicationClient.ObjectReplicated += OnReplicationClientObjectReplicated;
        }
        public void Initialize(string ipAddress, string port, string endpoint)
        {
            var factory = new DuplexChannelFactory <IReplicationClient <R> >(this,
                                                                             new NetTcpBinding()
            {
                OpenTimeout = TimeSpan.MaxValue
            },
                                                                             new EndpointAddress($"net.tcp://{ipAddress}:{port}/ReplicationClient/{endpoint}"));

            proxy = factory.CreateChannel();
        }
        public bool Initialize(string address, string port, string endpoint, IReplicationClient <R> replicationService)
        {
            try
            {
                host = new ServiceHost(replicationService, new Uri($"net.tcp://{address}:{port}"));
                host.AddServiceEndpoint(typeof(IReplicationClient <R>), new NetTcpBinding(), $"ReplicationClient/{endpoint}");
                info = $"net.tcp://{address}:{port}/ReplicationClient/{endpoint}";

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error while initializing replication client host: {e.Message}");
                return(false);
            }
        }