public void AddTerminal(Terminal terminal) { //Ensure terminal is not already in List if (Terminals.FirstOrDefault(x => x.Name.Equals(terminal.Name, StringComparison.OrdinalIgnoreCase)) == null) { Terminals.Add(terminal); } }
public void RemoveTerminal(string id) { var terminal = Terminals.FirstOrDefault(t => t.Id == id); if (terminal != null) { Terminals.Remove(terminal); } }
public Terminal GetTerminal(string term) { Terminal result = Terminals.FirstOrDefault(t => t.Term == term); if (result == null) { result = new Terminal(term); } return(result); }
private void Initialize() { _terminals = new ObservableCollection <Terminal>(); TestSoundCommand = new DelegateCommand(PlaySound); SoundList = new ObservableCollection <string>(); SliderValue = SoundPlayerUtilities.Instance.GetSystemVolume(); LoadSoundNames(); LoadTerminals(); LoadFontSizes(); SelectedTerminal = Terminals.FirstOrDefault(s => s.TerminalId == CurrentSettings.OutputTerminal); }
public void Call(Terminal fromTerminal, int number) { var terminal = Terminals.FirstOrDefault(x => x.Equals(fromTerminal)); if (terminal == null) { return; } terminal.TerminalSendMessage += TerminalOnTerminalSendMessage; terminal?.Call(number); terminal.TerminalSendMessage -= TerminalOnTerminalSendMessage; }
protected virtual void TerminalOnTerminalRequiredAnswer(object sender, string message) { var terminal = sender as Terminal; if (terminal == null) { return; } Console.WriteLine(message); var userTerminal = Terminals.FirstOrDefault(x => x.Number == terminal.Number); terminal?.Answer(Console.ReadLine()); }
public void RemoveTerminal(Terminal terminal) { if (Terminals.Remove(Terminals.FirstOrDefault(x => x.Name.Equals(terminal.Name, StringComparison.OrdinalIgnoreCase)))) { if (string.IsNullOrWhiteSpace(DefaultTerminalName)) { ResetToDefaultTerminal(); } else if (DefaultTerminalName.Equals(terminal.Name, StringComparison.OrdinalIgnoreCase)) { ResetToDefaultTerminal(); } } }
public Terminal GetDefaultTerminal() { Terminal terminal = Terminals.FirstOrDefault(x => x.Name.Equals(DefaultTerminalName, StringComparison.OrdinalIgnoreCase)); if (terminal != null) { return(terminal); } else { ResetToDefaultTerminal(); } return(Terminals.First()); }