示例#1
0
 public void Login(ClientCredential user)
 {
     try
     {
         _server.Login(user);
     }
     catch (Exception ex)
     {
         Messenger.Default.Send(new NotificationMessage(ex.Message, MainViewModel.ShowWcfWarningWindow));
     }
 }
        public void Connect()
        {
            try
            {
                var binding = new NetTcpBinding();
                binding.Security.Mode = SecurityMode.None;
                var channelFactory = new DuplexChannelFactory<ICrmServer>(this, binding, _connectionProperties.ConnectionString + "/CrmServer");

                _server = channelFactory.CreateChannel();
                _server.Login(_clientCredential);

                _pingTimer = new Timer(5000);
                _pingTimer.Elapsed += (sender, args) => PingServer();
                _pingTimer.Start();
            }
            catch (Exception ex)
            {
                Messenger.Default.Send(new NotificationMessage(ex.Message, MainViewModel.ShowWcfWarningWindow));
            }
        }
示例#3
0
        public void Connect()
        {
            try
            {
                var binding = new NetTcpBinding();
                binding.Security.Mode = SecurityMode.None;
                var channelFactory = new DuplexChannelFactory <ICrmServer>(this, binding, _connectionProperties.ConnectionString + "/CrmServer");

                _server = channelFactory.CreateChannel();
                _server.Login(_clientCredential);

                _pingTimer          = new Timer(5000);
                _pingTimer.Elapsed += (sender, args) => PingServer();
                _pingTimer.Start();
            }
            catch (Exception ex)
            {
                Messenger.Default.Send(new NotificationMessage(ex.Message, MainViewModel.ShowWcfWarningWindow));
            }
        }