Пример #1
0
 private void AutoCall_OnClick(object sender, RoutedEventArgs e)
 {
     _autoHangupSetting   = null;
     AutoHangup.IsChecked = false;
     AutoCall.IsChecked   = true;
     if (_autoCallSettingInfos == null || _autoCallSettingInfos.Length != _appSetting.Phones.Count)
     {
         _autoCallSettingInfos = new AutoCallSettingInfo[_appSetting.Phones.Count];
         for (var i = 0; i < _appSetting.Phones.Count; i++)
         {
             _autoCallSettingInfos[i] = new AutoCallSettingInfo(_appSetting.Phones[i].Number);
         }
     }
     new AutoCallSetting {
         Settings = _autoCallSettingInfos
     }.ShowDialog();
     foreach (var phone in Phones.Children)
     {
         if (!(phone is Phone p))
         {
             continue;
         }
         var newAutoOperator = _autoCallSettingInfos.FirstOrDefault(s => s.TelNumber == p.Setting?.Number);
         p.SetAutoOperator(newAutoOperator);
     }
 }
Пример #2
0
 public void SetAutoOperator(AutoCallSettingInfo setting)
 {
     GridButtons.IsEnabled = true;
     if (setting == null)
     {
         return;
     }
     GridButtons.IsEnabled = !setting.AutoCall;
     _autoCallSetting      = null;
     StopAuto();
     _autoCallSetting = setting;
     StartAuto();
 }