Esempio n. 1
0
 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);
     }
 }
Esempio n. 2
0
        public void RemoveTerminal(string id)
        {
            var terminal = Terminals.FirstOrDefault(t => t.Id == id);

            if (terminal != null)
            {
                Terminals.Remove(terminal);
            }
        }
Esempio n. 3
0
        public Terminal GetTerminal(string term)
        {
            Terminal result = Terminals.FirstOrDefault(t => t.Term == term);

            if (result == null)
            {
                result = new Terminal(term);
            }
            return(result);
        }
Esempio n. 4
0
 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());
        }
Esempio n. 7
0
 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();
         }
     }
 }
Esempio n. 8
0
        public Terminal GetDefaultTerminal()
        {
            Terminal terminal = Terminals.FirstOrDefault(x => x.Name.Equals(DefaultTerminalName, StringComparison.OrdinalIgnoreCase));

            if (terminal != null)
            {
                return(terminal);
            }
            else
            {
                ResetToDefaultTerminal();
            }

            return(Terminals.First());
        }