public void Show(object sender, EEventArgs e) { Console.Write("This telephone have number: "); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(this.Number); Console.ResetColor(); var account = sender as MobileAccount; if (e.Message != null) { Console.Write("Message text: "); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(e.Message); Console.ResetColor(); Console.Write("Message from: "); } else { Console.Write("Coll from: "); } if (account != null) { var acc = addressBook.FirstOrDefault(x => x.Key == account.Number); Console.ForegroundColor = ConsoleColor.Green; if (acc.Value != null) { Console.WriteLine(acc.Value); } } Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(account.Number); Console.ResetColor(); }
public void AcceptAndSend(object sender, EEventArgs e) { var account = sender as MobileAccount; if (account != null) { foreach (var item in _listAccount) { if (e.Number == item.Number) { if (e.Message == null) { _magazine[e.Number].InCall += 2; _magazine[account.Number].OutCall += 2; item.Show(sender, e); break; } else { _magazine[e.Number].InCall++; _magazine[account.Number].OutCall++; item.Show(sender, e); break; } } } } }
public void Show(object sender, EEventArgs e) { Console.Write("This telephone have number: "); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(this.Number); Console.ResetColor(); var account = sender as MobileAccount; if (e.Message != null) { Console.Write("Message text: "); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(e.Message); Console.ResetColor(); Console.Write("Message from: "); } else { Console.Write("Coll from: "); } if (account != null) { foreach (var item in addressBook) { if (account.Number == item.Key) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(item.Value); } } } Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(account.Number); Console.ResetColor(); }
public void AcceptAndSend(object sender, EEventArgs e) { foreach (var item in _listAccount) { if (e.Number == item.Number) { item.Show(sender, e); break; } } }
public void AcceptAndSend(object accountOut, EEventArgs eventArg) { var account = accountOut as MobileAccount; if (account != null) { if (_dictAccount.ContainsKey(eventArg.Number)) { if (eventArg.Message == null) { _magazine[eventArg.Number].InCall += 2; _magazine[account.Number].OutCall += 2; _dictAccount[eventArg.Number].Show(account, eventArg); } else { _magazine[eventArg.Number].InCall++; _magazine[account.Number].OutCall++; _dictAccount[eventArg.Number].Show(account, eventArg); } } } }