protected bool Equals(RelaySource other) { return(string.Equals(Name, other.Name) && SourceType == other.SourceType && SessionId.Equals(other.SessionId)); }
private void cbSource_SelectionChangeCommitted(object sender, EventArgs e) { currentSource = cbSource.SelectedItem as RelaySource; }
void RefreshGroups() { if (InvokeRequired) { if (IsHandleCreated) BeginInvoke(new MethodInvoker(() => RefreshGroups())); return; } cbSource.Items.Clear(); bool foundActive = false; foreach (var tab in TC.Tabs) { RelaySourceType sourcetype = RelaySourceType.Unknown; RelaySource newSource; if (tab.Value.Control is GroupIMTabWindow) sourcetype = RelaySourceType.Group; else if (tab.Value.Control is ConferenceIMTabWindow) sourcetype = RelaySourceType.Conference; else if (tab.Value.Control is IMTabWindow) sourcetype = RelaySourceType.IM; else if (tab.Value.Control is ChatConsole) sourcetype = RelaySourceType.Chat; else continue; UUID sessionId = UUID.Zero; UUID.TryParse(tab.Key, out sessionId); if (sessionId == UUID.Zero && sourcetype != RelaySourceType.Chat) continue; newSource = new RelaySource(sourcetype + ": " + tab.Value.Label, sourcetype, sessionId); if (sourcetype == RelaySourceType.IM) newSource.SessionId = (tab.Value.Control as IMTabWindow).TargetId; if (newSource == currentSource) foundActive = true; cbSource.Items.Add(newSource); } if (!foundActive) { currentSource = null; cbSource.Text = "None"; } }
void RefreshGroups() { if (InvokeRequired) { if (IsHandleCreated) { BeginInvoke(new MethodInvoker(() => RefreshGroups())); } return; } cbSource.Items.Clear(); bool foundActive = false; foreach (var tab in TC.Tabs) { RelaySourceType sourcetype = RelaySourceType.Unknown; RelaySource newSource; if (tab.Value.Control is GroupIMTabWindow) { sourcetype = RelaySourceType.Group; } else if (tab.Value.Control is ConferenceIMTabWindow) { sourcetype = RelaySourceType.Conference; } else if (tab.Value.Control is IMTabWindow) { sourcetype = RelaySourceType.IM; } else if (tab.Value.Control is ChatConsole) { sourcetype = RelaySourceType.Chat; } else { continue; } UUID sessionId = UUID.Zero; UUID.TryParse(tab.Key, out sessionId); if (sessionId == UUID.Zero && sourcetype != RelaySourceType.Chat) { continue; } newSource = new RelaySource(sourcetype + ": " + tab.Value.Label, sourcetype, sessionId); if (sourcetype == RelaySourceType.IM) { newSource.SessionId = (tab.Value.Control as IMTabWindow).TargetId; } if (newSource == currentSource) { foundActive = true; } cbSource.Items.Add(newSource); } if (!foundActive) { currentSource = null; cbSource.Text = "None"; } }