protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason) { if (reason != StopReason.UserReconnect) { Stop(reason); } }
protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason) { switch (reason) { case StopReason.UnavailableError: IgnoreNode(connection.SourceUri); Reconnect(SelectSourceHost()); break; case StopReason.ConnectionError: case StopReason.OffAir: if (connection.SourceUri == this.SourceUri) { Stop(reason); } else { IgnoreNode(connection.SourceUri); Reconnect(SelectSourceHost()); } break; case StopReason.UserReconnect: break; case StopReason.UserShutdown: default: Stop(reason); break; } }
protected void StartConnection(Uri source_uri) { if (sourceConnection != null) { StopConnection(StopReason.UserReconnect); } var conn = CreateConnection(source_uri); sourceConnection = conn; sourceConnectionTask = sourceConnection .Run() .ContinueWith(prev => { if (prev.IsFaulted) { Queue(() => { OnConnectionStopped(conn, StopReason.NotIdentifiedError); }); } else if (prev.IsCanceled) { Queue(() => { OnConnectionStopped(conn, StopReason.UserShutdown); }); } else { Queue(() => { OnConnectionStopped(conn, prev.Result); }); } }); }
protected override void OnConnectionStopped(ISourceConnection connection, ConnectionStoppedArgs args) { switch (args.Reason) { case StopReason.UserReconnect: case StopReason.UserShutdown: break; default: args.Delay = 3000; args.Reconnect = true; break; } }
public Telegram(TelegramDefinition def, ref ISourceConnection source) { InitializeComponent(); dataSource = source; telegramDef = def; itemControls = new Dictionary <string, IValueControl>(); itemDefs = new Dictionary <string, LibTelcom.TelegramItem>(); groupBox1.Text = def.TelegramName + " (" + def.Description + ")"; foreach (LibTelcom.TelegramItem item in def.TelegramItems) { addItem(item); } }
protected void StartConnection(Uri source_uri) { if (sourceConnection != null) { sourceConnection.Stopped -= OnSourceConnectionStopped; StopConnection(StopReason.UserReconnect); } sourceConnection = CreateConnection(source_uri); sourceConnection.Stopped += OnSourceConnectionStopped; sourceConnectionThread = new Thread(state => { sourceConnection.Run(); }); sourceConnectionThread.Start(); }
protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason) { switch (reason) { case StopReason.UserReconnect: break; case StopReason.UserShutdown: Stop(reason); break; default: Task.Delay(3000).ContinueWith(prev => Reconnect()); break; } }
protected override void OnConnectionStopped(ISourceConnection connection, ConnectionStoppedArgs args) { switch (args.Reason) { case StopReason.UnavailableError: args.IgnoreSource = connection.SourceUri; args.Reconnect = true; break; case StopReason.ConnectionError: case StopReason.OffAir: if (connection.SourceUri != this.SourceUri) { args.IgnoreSource = connection.SourceUri; args.Reconnect = true; } break; } }
protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason) { switch (reason) { case StopReason.UserReconnect: break; case StopReason.UserShutdown: Stop(reason); break; case StopReason.NoHost: Stop(reason); break; default: Reconnect(); break; } }
protected void StartConnection(Uri source_uri) { if (sourceConnection!=null) { sourceConnection.Stopped -= OnSourceConnectionStopped; StopConnection(StopReason.UserReconnect); } sourceConnection = CreateConnection(source_uri); sourceConnection.Stopped += OnSourceConnectionStopped; sourceConnectionThread = new Thread(state => { sourceConnection.Run(); }); sourceConnectionThread.Start(); }
protected virtual void OnConnectionStopped(ISourceConnection connection, ConnectionStoppedArgs args) { }
protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason) { switch (reason) { case StopReason.UserReconnect: break; case StopReason.UserShutdown: Stop(reason); break; case StopReason.NoHost: Stop(reason); break; default: Task.Delay(3000).ContinueWith(prev => Reconnect()); break; } }
public ConnectionStoppedEvent(ISourceConnection connection, StopReason reason) : base(SourceStreamEventType.ConnectionStopped) { this.Connection = connection; this.StopReason = reason; }
protected abstract void OnConnectionStopped(ISourceConnection connection, StopReason reason);
private ConnectionWrapper(ISourceConnection connection, Func <ConnectionWrapper, Task <StopReason>, Task> taskFunc) { Connection = connection; Task = taskFunc(this, connection.Run()); }
static public ConnectionWrapper Run(ISourceConnection connection, Func <ConnectionWrapper, Task <StopReason>, Task> taskFunc) { return(new ConnectionWrapper(connection, taskFunc)); }
protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason) { switch (reason) { case StopReason.UnavailableError: IgnoreNode(connection.SourceUri); Reconnect(SelectSourceHost()); break; case StopReason.ConnectionError: case StopReason.OffAir: if (connection.SourceUri==this.SourceUri) { Stop(reason); } else { IgnoreNode(connection.SourceUri); Reconnect(SelectSourceHost()); } break; case StopReason.UserReconnect: break; case StopReason.UserShutdown: default: Stop(reason); break; } }