コード例 #1
0
 public Multiplexer(IChannelConnectNotifier channelFactory)
 {
     channelFactory.PipeConnected += (sender, args) =>
     {
         args.Messenger.MessageReceived         += (o, @event) => MessageReceived?.Invoke(o, @event);
         args.Messenger.ConnectionReestablished += (o, @event) => ConnectionReestablished?.Invoke(o, @event);
     };
 }
コード例 #2
0
 private void EnsureConnected()
 {
     if (this.connectionState == PipeMessengerState.Disconnected && !string.IsNullOrEmpty(this.outPipeName))
     {
         Connect();
         ConnectionReestablished?.Invoke(this, EventArgs.Empty);
     }
 }
コード例 #3
0
ファイル: Connector.cs プロジェクト: lulzzz/PersonalAnalytics
        private async void OnReconnectTry(object obj)
        {
            DeviceInformation device = obj as DeviceInformation;

            LoggerWrapper.Instance.WriteToConsole("Try restablishing connection to " + device.Name);

            bool connected = false;

            if (device != null)
            {
                connected = await Connect(device);
            }

            if (connected)
            {
                if (_reconnectTimer != null)
                {
                    _reconnectTimer.Cancel();
                }
                ConnectionReestablished?.Invoke();
            }
        }
コード例 #4
0
 public void ReestablishConnection()
 {
     ConnectionReestablished?.Invoke(this, EventArgs.Empty);
 }
コード例 #5
0
 protected virtual void OnConnectionReestablished()
 {
     ConnectionReestablished?.Invoke(this, EventArgs.Empty);
 }
コード例 #6
0
        /// <summary>
        /// Add connection settings for a new host.
        /// </summary>
        /// <param name="host">The host name</param>
        /// <param name="messengerFactory">Factory for creating a messenger which forwards messages to the host</param>
        public void AddConnection(string host, Func <IMessenger> messengerFactory)
        {
            var hostConnection = new HostConnection {
                Host = host, MessengerFactory = messengerFactory
            };

            this.hosts[hostConnection.Host] = hostConnection;
            if (hostConnection.Messenger != null)
            {
                hostConnection.Messenger.MessageReceived         += (sender, @event) => MessageReceived?.Invoke(this, @event);
                hostConnection.Messenger.ConnectionReestablished += (sender, @event) => ConnectionReestablished?.Invoke(this, @event);
            }
        }
コード例 #7
0
 private void TryConnect(HostConnection hostConnection)
 {
     try
     {
         hostConnection.Messenger = hostConnection.MessengerFactory();
         hostConnection.Messenger.MessageReceived         += (sender, @event) => MessageReceived?.Invoke(this, @event);
         hostConnection.Messenger.ConnectionReestablished += (sender, @event) => ConnectionReestablished?.Invoke(this, @event);
     }
     catch (Exception ex)
     {
         Log.Warning(ex.Message);
     }
 }
コード例 #8
0
ファイル: Settings.cs プロジェクト: Shelim/ResGateClientNet
 internal void InvokeConnectionReestablished(Client client)
 {
     ConnectionReestablished?.Invoke(client, new ConnectionReestablishedEventArgs());
 }