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