提交 ebd314b5 authored 作者: Mitch Capper's avatar Mitch Capper

Accessibility changes, keyboard shortcuts, UIA, key handling cleanup, account…

Accessibility changes, keyboard shortcuts, UIA, key handling cleanup, account enabled on account options page
上级 05667783
using System; using System;
using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
...@@ -383,10 +384,19 @@ namespace FSClient { ...@@ -383,10 +384,19 @@ namespace FSClient {
public bool edit() { public bool edit() {
current_editing_account = this; current_editing_account = this;
GenericEditor editor = new GenericEditor(); GenericEditor editor = new GenericEditor();
editor.Init("Editing Account", values); List<FieldValue> vals = new List<FieldValue>(values);
var enabled_field = new Field(Field.FIELD_TYPE.Bool, "Account Enabled","enabled","",enabled ? "true" : "false","");
var enabled_val = enabled_field.GetDefaultValue();
vals.Insert(0, enabled_val);
editor.Init("Editing Account", vals);
editor.ShowDialog(); editor.ShowDialog();
if (editor.DialogResult == true) if (editor.DialogResult == true){
if (enabled_val.value == "true")
enabled = true;
else
enabled = false;
ReloadAccount(); ReloadAccount();
}
else else
return false; return false;
return true; return true;
......
...@@ -29,7 +29,6 @@ namespace FSClient { ...@@ -29,7 +29,6 @@ namespace FSClient {
NewEvent += conference.NewFSEvent; NewEvent += conference.NewFSEvent;
Call.CallStateChanged += CallStateChangedHandler; Call.CallStateChanged += CallStateChangedHandler;
Call.ActiveCallChanged += ActiveCallChanged;
init_us(); init_us();
DelayedFunction.DelayedCall("LoadContactManager", initContactManager, 1000); DelayedFunction.DelayedCall("LoadContactManager", initContactManager, 1000);
...@@ -118,6 +117,7 @@ namespace FSClient { ...@@ -118,6 +117,7 @@ namespace FSClient {
theme = Properties.Settings.Default.Theme; theme = Properties.Settings.Default.Theme;
IncomingBalloons = Properties.Settings.Default.IncomingBalloons; IncomingBalloons = Properties.Settings.Default.IncomingBalloons;
IncomingTopMost = Properties.Settings.Default.FrontOnIncoming; IncomingTopMost = Properties.Settings.Default.FrontOnIncoming;
IncomingKeyboardFocus = Properties.Settings.Default.KeyboardFocusIncomingCall;
ClearDTMFS = Properties.Settings.Default.ClearDTMFS; ClearDTMFS = Properties.Settings.Default.ClearDTMFS;
UPNPNAT = Properties.Settings.Default.UPNPNAT; UPNPNAT = Properties.Settings.Default.UPNPNAT;
DirectSipDial = Properties.Settings.Default.DirectSipDial; DirectSipDial = Properties.Settings.Default.DirectSipDial;
...@@ -187,41 +187,7 @@ namespace FSClient { ...@@ -187,41 +187,7 @@ namespace FSClient {
#region Text Input #region Text Input
public enum KEYBOARD_ACTION { Backspace, Erase, Enter, Escape };
public void handle_special_action(KEYBOARD_ACTION action) {
switch (action) {
case KEYBOARD_ACTION.Backspace:
if (cur_dial_str.Length > 0 && (Call.active_call == null || Call.active_call.state != Call.CALL_STATE.Answered))
cur_dial_str = cur_dial_str.Remove(cur_dial_str.Length - 1);
break;
case KEYBOARD_ACTION.Escape:
HangupPressed();
break;
case KEYBOARD_ACTION.Enter:
TalkPressed();
break;
}
}
public void handle_key_action(char key) {
cur_dial_str += key;
if (key != '*' && key != '#' && (key < '0' || key > '9'))
return;
if (Call.active_call != null && Call.active_call.state == Call.CALL_STATE.Answered)
Call.active_call.send_dtmf(key.ToString());
else {
#if ! NO_FS
PortAudio.PlayDTMF(key, null, true);
DelayedFunction.DelayedCall("PortAudioLastDigitHitStreamClose", close_streams, 5000);
#endif
}
}
private void close_streams() {
if (active_calls == 0)
PortAudio.CloseStreams();
}
#endregion #endregion
public PortAudio.AudioDevice SpeakerInDev { get; private set; } public PortAudio.AudioDevice SpeakerInDev { get; private set; }
...@@ -350,34 +316,10 @@ namespace FSClient { ...@@ -350,34 +316,10 @@ namespace FSClient {
account.CreateCall(str); account.CreateCall(str);
} }
public void TalkPressed() { public void TalkPressed() {
if (Call.active_call != null) { Application.Current.Dispatcher.BeginInvoke((Action)(() => MainWindow.get_instance().TalkPressed()));
if (Call.active_call.state == Call.CALL_STATE.Ringing && Call.active_call.is_outgoing == false)
Call.active_call.answer();
else
DialTone();
}
else {
if (String.IsNullOrEmpty(cur_dial_str))
DialTone();
else {
DialString(cur_dial_str);
cur_dial_str = "";
}
}
} }
public void HangupPressed() { public void HangupPressed() {
if (Call.active_call != null) { Application.Current.Dispatcher.BeginInvoke((Action)(() => MainWindow.get_instance().HangupPressed()));
if (Call.active_call.state == Call.CALL_STATE.Ringing) {
Call.active_call.hangup(Call.active_call.is_outgoing ? "User Cancelled" : "User Ignored Call");
}
else
Call.active_call.hangup("User Ended");
}
else
cur_dial_str = "";
}
public void FlashPressed() {
throw new NotImplementedException();
} }
public void TalkTogglePressed() { public void TalkTogglePressed() {
if (Call.active_call != null && (Call.active_call.state != Call.CALL_STATE.Ringing || Call.active_call.is_outgoing)) if (Call.active_call != null && (Call.active_call.state != Call.CALL_STATE.Ringing || Call.active_call.is_outgoing))
...@@ -385,9 +327,6 @@ namespace FSClient { ...@@ -385,9 +327,6 @@ namespace FSClient {
else else
TalkPressed(); TalkPressed();
} }
public void RedialPressed() {
throw new NotImplementedException();
}
#region deconstructors #region deconstructors
...@@ -416,6 +355,7 @@ namespace FSClient { ...@@ -416,6 +355,7 @@ namespace FSClient {
Properties.Settings.Default.CheckForUpdates = CheckForUpdates; Properties.Settings.Default.CheckForUpdates = CheckForUpdates;
Properties.Settings.Default.GuiStartup = GUIStartup; Properties.Settings.Default.GuiStartup = GUIStartup;
Properties.Settings.Default.FrontOnIncoming = IncomingTopMost; Properties.Settings.Default.FrontOnIncoming = IncomingTopMost;
Properties.Settings.Default.KeyboardFocusIncomingCall = IncomingKeyboardFocus;
Properties.Settings.Default.ClearDTMFS = ClearDTMFS; Properties.Settings.Default.ClearDTMFS = ClearDTMFS;
Properties.Settings.Default.UPNPNAT = UPNPNAT; Properties.Settings.Default.UPNPNAT = UPNPNAT;
Properties.Settings.Default.DirectSipDial = DirectSipDial; Properties.Settings.Default.DirectSipDial = DirectSipDial;
...@@ -474,12 +414,6 @@ namespace FSClient { ...@@ -474,12 +414,6 @@ namespace FSClient {
call_answeredChanged(this, is_call_answered); call_answeredChanged(this, is_call_answered);
} }
private void ActiveCallChanged(object sender, Call.ActiveCallChangedArgs e) {
if (Call.active_call != null)
cur_dial_str = Call.active_call.dtmfs;
else
cur_dial_str = "";
}
private void HandleCallWaiting(Timer timer, Call c) { private void HandleCallWaiting(Timer timer, Call c) {
if (c.state != Call.CALL_STATE.Ringing || Call.active_call == c) { if (c.state != Call.CALL_STATE.Ringing || Call.active_call == c) {
if (timer != null) { if (timer != null) {
...@@ -509,6 +443,8 @@ namespace FSClient { ...@@ -509,6 +443,8 @@ namespace FSClient {
if (Call.active_call != args.call && Call.active_call != null) if (Call.active_call != args.call && Call.active_call != null)
HandleCallWaiting(null, args.call); HandleCallWaiting(null, args.call);
} }
else if (IncomingKeyboardFocus)
Utils.SetForegroundWindow(MainWindow.get_instance());
} }
if (DND && args.call != null && args.call.is_outgoing == false && args.call.state == Call.CALL_STATE.Ringing) if (DND && args.call != null && args.call.is_outgoing == false && args.call.state == Call.CALL_STATE.Ringing)
args.call.hangup("Call ignored due to DND"); args.call.hangup("Call ignored due to DND");
...@@ -521,6 +457,7 @@ namespace FSClient { ...@@ -521,6 +457,7 @@ namespace FSClient {
public bool IncomingBalloons; public bool IncomingBalloons;
public bool IncomingTopMost; public bool IncomingTopMost;
public bool IncomingKeyboardFocus;
public string CheckForUpdates; public string CheckForUpdates;
public string GUIStartup; public string GUIStartup;
...@@ -713,19 +650,6 @@ namespace FSClient { ...@@ -713,19 +650,6 @@ namespace FSClient {
private bool _DND; private bool _DND;
public Utils.ObjectEventHandler<bool> DNDChanged; public Utils.ObjectEventHandler<bool> DNDChanged;
public string cur_dial_str {
get { return _cur_dial_str; }
set {
if (value == _cur_dial_str)
return;
_cur_dial_str = value;
if (cur_dial_strChanged != null)
cur_dial_strChanged(this, value);
}
}
private string _cur_dial_str;
public Utils.ObjectEventHandler<string> cur_dial_strChanged;
public string recordings_folder { public string recordings_folder {
get { return _recordings_folder; } get { return _recordings_folder; }
set { set {
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
...@@ -193,7 +194,7 @@ namespace FSClient { ...@@ -193,7 +194,7 @@ namespace FSClient {
RaisePropertyChanged("dtmfs"); RaisePropertyChanged("dtmfs");
} }
} }
private string _dtmfs; private string _dtmfs="";
#endregion #endregion
...@@ -253,13 +254,13 @@ namespace FSClient { ...@@ -253,13 +254,13 @@ namespace FSClient {
item = new MenuItem() { Header = "Their Volume" }; item = new MenuItem() { Header = "Their Volume" };
for (int x = -4; x <= 4; x++) { for (int x = -4; x <= 4; x++) {
int val = x; int val = x;
item.Items.Add(CreateMenuItem("Level " + x, () => SetOtherPartyAudioLevel(val))); item.Items.Add(CreateMenuItem("Level " + x + (other_audio_level == x ? "*" : ""), () => SetOtherPartyAudioLevel(val)));
} }
menu.Items.Add(item); menu.Items.Add(item);
item = new MenuItem() { Header = "Your Volume" }; item = new MenuItem() { Header = "Your Volume" };
for (int x = -4; x <= 4; x++) { for (int x = -4; x <= 4; x++) {
int val = x; int val = x;
item.Items.Add(CreateMenuItem("Level " + x, () => SetOurAudioLevel(val))); item.Items.Add(CreateMenuItem("Level " + x + (our_audio_level == x ? "*" : ""), () => SetOurAudioLevel(val)));
} }
menu.Items.Add(item); menu.Items.Add(item);
menu.Items.Add(CreateMenuItem("End Call", hangup)); menu.Items.Add(CreateMenuItem("End Call", hangup));
...@@ -346,7 +347,6 @@ namespace FSClient { ...@@ -346,7 +347,6 @@ namespace FSClient {
var call = (from c in calls where (c.leg_a_uuid == uuid || c.leg_b_uuid == uuid) && c.call_ended==false select c).SingleOrDefault(); var call = (from c in calls where (c.leg_a_uuid == uuid || c.leg_b_uuid == uuid) && c.call_ended==false select c).SingleOrDefault();
if (call != null && call.state == CALL_STATE.Answered && digit.Length == 1) if (call != null && call.state == CALL_STATE.Answered && digit.Length == 1)
PortAudio.PlayDTMF(digit[0], call.leg_a_uuid); PortAudio.PlayDTMF(digit[0], call.leg_a_uuid);
} }
public static void HandleOutgoingEvent(FSEvent evt, String uuid) //capture an outgoing call the other leg public static void HandleOutgoingEvent(FSEvent evt, String uuid) //capture an outgoing call the other leg
{ {
...@@ -458,7 +458,7 @@ namespace FSClient { ...@@ -458,7 +458,7 @@ namespace FSClient {
return; return;
if (call.state == CALL_STATE.Ringing || (call.state == CALL_STATE.Hold_Ringing && !call.is_outgoing)) if (call.state == CALL_STATE.Ringing || (call.state == CALL_STATE.Hold_Ringing && !call.is_outgoing))
call.UpdateCallState(CALL_STATE.Answered, call.is_outgoing ? active_call : active_call); call.UpdateCallState(CALL_STATE.Answered, (call.is_outgoing || call.is_conference_call) ? active_call : call);
else if (call.state == CALL_STATE.Hold_Ringing) else if (call.state == CALL_STATE.Hold_Ringing)
call.UpdateCallState(CALL_STATE.Hold, active_call); call.UpdateCallState(CALL_STATE.Hold, active_call);
else else
...@@ -538,23 +538,31 @@ namespace FSClient { ...@@ -538,23 +538,31 @@ namespace FSClient {
item.Click += (o, args) => action(); item.Click += (o, args) => action();
return item; return item;
} }
public ContextMenu CallRightClickMenu() { private ContextMenu _CallRightClickMenu;
ContextMenu menu = new ContextMenu(); public ContextMenu CallRightClickMenu {
menu.Opened += call_ContextMenuOpened; get{
if (_CallRightClickMenu == null){
return menu; _CallRightClickMenu = new ContextMenu();
_CallRightClickMenu.Opened += call_ContextMenuOpened;
}
return _CallRightClickMenu;
}
} }
private static Broker broker; private static Broker broker;
private int our_audio_level;
public void SetOurAudioLevel(int level){ public void SetOurAudioLevel(int level){
if (level > 4 || level < -4) if (level > 4 || level < -4)
return; return;
our_audio_level = level;
Utils.bgapi_exec("uuid_audio", leg_b_uuid + " start write level " + level); Utils.bgapi_exec("uuid_audio", leg_b_uuid + " start write level " + level);
} }
private int other_audio_level;
public void SetOtherPartyAudioLevel(int level){ public void SetOtherPartyAudioLevel(int level){
if (level > 4 || level < -4) if (level > 4 || level < -4)
return; return;
other_audio_level = level;
Utils.bgapi_exec("uuid_audio", leg_b_uuid + " start read level " + level); Utils.bgapi_exec("uuid_audio", leg_b_uuid + " start read level " + level);
} }
public void RemoveCallFromHistory(){ public void RemoveCallFromHistory(){
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Controls; using System.Windows.Controls;
namespace FSClient.Controls { namespace FSClient.Controls {
public class OurAutoCompleteBox : AutoCompleteBox { public class OurAutoCompleteBox : AutoCompleteBox {
private TextBox the_textbox; private TextBox the_textbox;
private void find_textbox(){ private void find_textbox(){
if (the_textbox != null) if (the_textbox != null)
return; return;
the_textbox = Template.FindName("Text", this) as TextBox; the_textbox = Template.FindName("Text", this) as TextBox;
} if (the_textbox != null)
public TextBox GetActualTextbox() { the_textbox.TabIndex = TabIndex;
find_textbox(); }
return the_textbox; public TextBox GetActualTextbox() {
} find_textbox();
public bool TextBoxHasFocus(){ return the_textbox;
find_textbox(); }
if (the_textbox == null) public bool TextBoxHasFocus(){
return false; find_textbox();
return the_textbox.IsFocused; if (the_textbox == null)
} return false;
public void TextBoxFocus(){ return the_textbox.IsFocused;
find_textbox(); }
if (the_textbox != null) public void TextBoxFocus(){
the_textbox.Focus(); find_textbox();
} if (the_textbox != null)
} the_textbox.Focus();
} }
}
}
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" xmlns:Controls="clr-namespace:FSClient.Controls" mc:Ignorable="d"
x:Class="FSClient.Controls.PhonePadButton" x:Class="FSClient.Controls.PhonePadButton"
x:Name="UserControl" x:Name="UserControl"
Width="30" Height="30"> Width="30" Height="30">
<Grid x:Name="LayoutRoot"> <Grid x:Name="LayoutRoot">
<Button Style="{DynamicResource GlassButtonStyle}" Foreground="White" x:Name="btn"> <Button Style="{DynamicResource GlassButtonStyle}" Foreground="White" x:Name="btn" TabIndex="{Binding Path=TabIndex, RelativeSource={RelativeSource AncestorType={x:Type Controls:PhonePadButton}}}">
<StackPanel Width="Auto"> <StackPanel Width="Auto">
<TextBlock x:Name="lblNumber" FontSize="12" FontWeight="Bold" HorizontalAlignment="Center" Margin="0,-2,0,0" Text="5"/> <TextBlock x:Name="lblNumber" FontSize="12" FontWeight="Bold" HorizontalAlignment="Center" Margin="0,-2,0,0" Text="5"/>
<TextBlock x:Name="lblLetters" FontSize="7" HorizontalAlignment="Center" Foreground="#FFC2B4B4" FontWeight="Bold" Width="24.388" TextAlignment="Center" RenderTransformOrigin="0.5,0.5" Margin="0,-2,0,0" > <TextBlock x:Name="lblLetters" FontSize="7" HorizontalAlignment="Center" Foreground="#FFC2B4B4" FontWeight="Bold" Width="24.388" TextAlignment="Center" RenderTransformOrigin="0.5,0.5" Margin="0,-2,0,0" >
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows; using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Peers;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Documents; using System.Windows.Documents;
...@@ -36,14 +38,17 @@ namespace FSClient.Controls ...@@ -36,14 +38,17 @@ namespace FSClient.Controls
public string Number public string Number
{ {
get { return lblNumber.Text; } get { return lblNumber.Text; }
set { lblNumber.Text = value; } set { lblNumber.Text = value; AutomationProperties.SetName(btn, value); AutomationProperties.SetName(this, value); AutomationProperties.SetItemType(this,"Button"); }
} }
public string Letters public string Letters
{ {
get { return lblLetters.Text; } get { return lblLetters.Text; }
set { lblLetters.Text = value; } set { lblLetters.Text = value; }
} }
protected AutomationControlType GetAutomationControlTypeCore() {
return AutomationControlType.Button;
}
} }
} }
\ No newline at end of file
...@@ -88,7 +88,10 @@ namespace FSClient { ...@@ -88,7 +88,10 @@ namespace FSClient {
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
if (value == null) if (value == null)
return ""; return "";
bool is_outgoing = (bool)value; return EnglishDirectionConverter.Convert((bool)value);
}
public static String Convert(bool is_outgoing) {
return is_outgoing ? "Outgoing" : "Incoming"; return is_outgoing ? "Outgoing" : "Incoming";
} }
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
...@@ -110,7 +113,9 @@ namespace FSClient { ...@@ -110,7 +113,9 @@ namespace FSClient {
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
if (value == null) if (value == null)
return ""; return "";
TimeSpan duration = (TimeSpan)value; return Convert((TimeSpan)value);
}
public static string Convert(TimeSpan duration) {
return duration.Minutes + ":" + duration.Seconds.ToString("00"); return duration.Minutes + ":" + duration.Seconds.ToString("00");
} }
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
<TabControl Margin="8,44,14,53" Name="tabControlMain"> <TabControl Margin="8,44,14,53" Name="tabControlMain">
</TabControl> </TabControl>
<Button x:Name="btnCancel" Content="Cancel" HorizontalAlignment="Right" Margin="0,0,82,17.04" VerticalAlignment="Bottom" Width="75" Click="btnCancel_Click" /> <Button x:Name="btnCancel" Content="Cancel" HorizontalAlignment="Right" Margin="0,0,82,17.04" VerticalAlignment="Bottom" Width="75" Click="btnCancel_Click" IsCancel="True" />
<Button x:Name="btnSave" Content="Save" HorizontalAlignment="Left" Margin="57,0,0,17.04" VerticalAlignment="Bottom" Width="75" Click="btnSave_Click" /> <Button x:Name="btnSave" Content="Save" HorizontalAlignment="Left" Margin="57,0,0,17.04" VerticalAlignment="Bottom" Width="75" Click="btnSave_Click" IsDefault="True" />
<TextBlock Height="29" Margin="8,9,14,0" Name="txtTitle" Text="Title Here" VerticalAlignment="Top" FontSize="20" FontWeight="Bold" TextAlignment="Center" /> <TextBlock Height="29" Margin="8,9,14,0" Name="txtTitle" Text="Title Here" VerticalAlignment="Top" FontSize="20" FontWeight="Bold" TextAlignment="Center" />
</Grid> </Grid>
</Window> </Window>
\ No newline at end of file
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows; using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls; using System.Windows.Controls;
namespace FSClient { namespace FSClient {
...@@ -15,7 +16,7 @@ namespace FSClient { ...@@ -15,7 +16,7 @@ namespace FSClient {
} }
private Dictionary<FieldValue, UIElement> elements_to_ui = new Dictionary<FieldValue, UIElement>(); private Dictionary<FieldValue, UIElement> elements_to_ui = new Dictionary<FieldValue, UIElement>();
private Dictionary<FieldValue, TabItem> element_to_page = new Dictionary<FieldValue, TabItem>(); private Dictionary<FieldValue, TabItem> element_to_page = new Dictionary<FieldValue, TabItem>();
public void Init(String title, FieldValue[] values) { public void Init(String title, IEnumerable<FieldValue> values) {
txtTitle.Text = title; txtTitle.Text = title;
Title = title; Title = title;
Dictionary<string, StackPanel> tabs = new Dictionary<string, StackPanel>(); Dictionary<string, StackPanel> tabs = new Dictionary<string, StackPanel>();
...@@ -108,6 +109,7 @@ namespace FSClient { ...@@ -108,6 +109,7 @@ namespace FSClient {
ret = comboBox; ret = comboBox;
break; break;
} }
AutomationProperties.SetName(ret, value.field.display_name);
return ret; return ret;
} }
private void btnCancel_Click(object sender, RoutedEventArgs e) { private void btnCancel_Click(object sender, RoutedEventArgs e) {
......
...@@ -235,11 +235,11 @@ namespace FSClient { ...@@ -235,11 +235,11 @@ namespace FSClient {
broker.Muted = false; broker.Muted = false;
break; break;
case IHeadsetDevice.HEADSET_EVENT_TYPE.Redial: case IHeadsetDevice.HEADSET_EVENT_TYPE.Redial:
broker.RedialPressed(); //broker.RedialPressed();
break; break;
case IHeadsetDevice.HEADSET_EVENT_TYPE.Flash: case IHeadsetDevice.HEADSET_EVENT_TYPE.Flash:
broker.FlashPressed(); //broker.FlashPressed();
break; break;
} }
......
...@@ -25,9 +25,9 @@ ...@@ -25,9 +25,9 @@
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Name="lblCaller" HorizontalAlignment="Left" TextWrapping="Wrap" Text="800-ComCasT" VerticalAlignment="Top" Grid.ColumnSpan="3"/> <TextBlock Name="lblCaller" HorizontalAlignment="Left" TextWrapping="Wrap" Text="800-ComCasT" VerticalAlignment="Top" Grid.ColumnSpan="3"/>
<Button Content="Answer" Height="20" x:Name="btnCall" Width="50" Click="btnCall_Click" Style="{DynamicResource GlassButtonStyle}" Foreground="#FF4EFF00" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Bottom" Grid.Row="1" Margin="2,0,0,2" /> <Button Content="Answer" Height="20" x:Name="btnCall" Width="50" Click="btnCall_Click" Style="{DynamicResource GlassButtonStyle}" Foreground="#FF4EFF00" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Bottom" Grid.Row="1" Margin="2,0,0,2" AutomationProperties.Name="Answer Call" TabIndex="1" IsDefault="True" />
<Button Content="End" Height="20" HorizontalAlignment="Right" x:Name="btnHangup" Width="50" Click="btnHangup_Click" Style="{DynamicResource GlassButtonStyle}" Foreground="#FFF50000" FontWeight="Bold" VerticalAlignment="Bottom" Grid.Row="1" Grid.Column="2" Margin="0,0,2,2" /> <Button Content="End" Height="20" HorizontalAlignment="Right" x:Name="btnHangup" Width="50" Click="btnHangup_Click" Style="{DynamicResource GlassButtonStyle}" Foreground="#FFF50000" FontWeight="Bold" VerticalAlignment="Bottom" Grid.Row="1" Grid.Column="2" Margin="0,0,2,2" AutomationProperties.Name="End Call" TabIndex="3" />
<Button Content="Send To Voicemail" FontWeight="Bold" Foreground="#FFF5E200" Grid.RowSpan="2" Height="20" HorizontalAlignment="Stretch" Margin="20,18,20,0" Name="btnSendVoicemail" Style="{DynamicResource GlassButtonStyle}" VerticalAlignment="Top" Grid.ColumnSpan="3" Click="btnSendVoicemail_Click" /> <Button Content="Send To Voicemail" FontWeight="Bold" Foreground="#FFF5E200" Grid.RowSpan="2" Height="20" HorizontalAlignment="Stretch" Margin="20,18,20,0" Name="btnSendVoicemail" Style="{DynamicResource GlassButtonStyle}" VerticalAlignment="Top" Grid.ColumnSpan="3" Click="btnSendVoicemail_Click" AutomationProperties.Name="Send To Voicemail" TabIndex="4" />
<Button Content="XFER" FontWeight="Bold" Foreground="Blue" Height="20" Grid.Row="1" Grid.Column="1" VerticalAlignment="Bottom" Margin="0,0,2,2" Name="btnTransfer" Style="{DynamicResource GlassButtonStyle}" Width="40" Click="btnTransfer_Click" /> <Button Content="XFER" FontWeight="Bold" Foreground="Blue" Height="20" Grid.Row="1" Grid.Column="1" VerticalAlignment="Bottom" Margin="0,0,2,2" Name="btnTransfer" Style="{DynamicResource GlassButtonStyle}" Width="40" Click="btnTransfer_Click" AutomationProperties.Name="Transfer" TabIndex="2" />
</Grid> </Grid>
</Window> </Window>
\ No newline at end of file
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows; using System.Windows;
using System.Windows.Automation;
using System.Windows.Forms; using System.Windows.Forms;
namespace FSClient { namespace FSClient {
...@@ -23,12 +24,19 @@ namespace FSClient { ...@@ -23,12 +24,19 @@ namespace FSClient {
private void Window_Loaded(object sender, RoutedEventArgs e) { private void Window_Loaded(object sender, RoutedEventArgs e) {
PositionWindows(); PositionWindows();
lblCaller.Text = call.other_party_name + " - " + call.other_party_number; lblCaller.Text = call.other_party_name + " - " + call.other_party_number;
Title = "FSClient Incoming Call " + lblCaller.Text;
prop_changed = new System.ComponentModel.PropertyChangedEventHandler(call_PropertyChanged); prop_changed = new System.ComponentModel.PropertyChangedEventHandler(call_PropertyChanged);
call.PropertyChanged += prop_changed; call.PropertyChanged += prop_changed;
btnSendVoicemail.Visibility = call.CanSendToVoicemail() ? Visibility.Visible : Visibility.Hidden; btnSendVoicemail.Visibility = call.CanSendToVoicemail() ? Visibility.Visible : Visibility.Hidden;
btnTransfer.ContextMenu = Broker.get_instance().XFERContextMenu(); btnTransfer.ContextMenu = Broker.get_instance().XFERContextMenu();
if (Broker.get_instance().IncomingKeyboardFocus)
DelayedFunction.DelayedCall("BubbleTop", MakeUsTop, 500);
Show();
Topmost = true;
}
private void MakeUsTop(){
Dispatcher.BeginInvoke((Action)(() => Utils.SetForegroundWindow(this)));
} }
void call_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { void call_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) {
if (e.PropertyName == "state") { if (e.PropertyName == "state") {
if (call.state != Call.CALL_STATE.Ringing) if (call.state != Call.CALL_STATE.Ringing)
......
...@@ -9,14 +9,14 @@ ...@@ -9,14 +9,14 @@
<RowDefinition Height="35" /> <RowDefinition Height="35" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Name="lblDesc" Grid.Row="0"/> <Label Name="lblDesc" Grid.Row="0"/>
<TextBox Name="txtInput" Grid.Row="1" Margin="10" KeyUp="txtInput_KeyUp" /> <TextBox Name="txtInput" Grid.Row="1" Margin="10" />
<Grid Grid.Row="2"> <Grid Grid.Row="2">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Button Content="Ok" Width="75" Grid.Column="0" HorizontalAlignment="Left" Name="btnOk" Margin="5" Click="btnOk_Click" /> <Button Content="Ok" Width="75" Grid.Column="0" HorizontalAlignment="Left" Name="btnOk" Margin="5" Click="btnOk_Click" IsDefault="True" />
<Button Content="Cancel" Width="75" HorizontalAlignment="Right" Margin="5" Grid.Column="1" Name="btnCancel" Click="btnCancel_Click" /> <Button Content="Cancel" Width="75" HorizontalAlignment="Right" Margin="5" Grid.Column="1" Name="btnCancel" Click="btnCancel_Click" IsCancel="True" />
</Grid> </Grid>
......
using System; using System;
using System.Windows; using System.Windows;
using System.Windows.Automation;
using System.Windows.Input; using System.Windows.Input;
namespace FSClient { namespace FSClient {
...@@ -20,6 +21,7 @@ namespace FSClient { ...@@ -20,6 +21,7 @@ namespace FSClient {
InputBox box = new InputBox(); InputBox box = new InputBox();
box.lblDesc.Content = desc; box.lblDesc.Content = desc;
box.Title = title; box.Title = title;
AutomationProperties.SetName(box.txtInput, desc);
box.txtInput.Text = default_value; box.txtInput.Text = default_value;
if (box.ShowDialog() != true) if (box.ShowDialog() != true)
return null; return null;
...@@ -36,9 +38,5 @@ namespace FSClient { ...@@ -36,9 +38,5 @@ namespace FSClient {
Close(); Close();
} }
private void txtInput_KeyUp(object sender, KeyEventArgs e) {
if (e.Key == Key.Return)
btnOk_Click(null, null);
}
} }
} }
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition />
<RowDefinition Height="130" /> <RowDefinition Height="110" />
<RowDefinition Height="30" /> <RowDefinition Height="30" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid Grid.ColumnSpan="2"> <Grid Grid.ColumnSpan="2">
...@@ -37,49 +37,51 @@ ...@@ -37,49 +37,51 @@
<RowDefinition /> <RowDefinition />
<RowDefinition /> <RowDefinition />
<RowDefinition /> <RowDefinition />
<RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" > <StackPanel Orientation="Horizontal" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" >
<Button Content="Reload Devices" Height="23" Name="btnReloadDevices" Width="100" Click="btnReloadDevices_Click" /> <Button Content="Reload Devices" Height="23" Name="btnReloadDevices" Width="100" Click="btnReloadDevices_Click" TabIndex="50" />
<Button Content="Sofia Settings" Height="23" Name="btnSofiaSettings" Width="100" Margin="10,0,0,0" Click="btnSofiaSettings_Click" /> <Button Content="Sofia Settings" Height="23" Name="btnSofiaSettings" Width="100" Margin="10,0,0,0" Click="btnSofiaSettings_Click" TabIndex="51" />
<Button Content="Event Socket Settings" Height="23" Name="btnEventSocketSettings" Width="125" Margin="10,0,0,0" Click="btnEventSocketSettings_Click" /> <Button Content="Event Socket Settings" Height="23" Name="btnEventSocketSettings" Width="125" Margin="10,0,0,0" Click="btnEventSocketSettings_Click" TabIndex="52" />
<Button Content="Plugin Settings" Height="23" Name="btnPluginSettings" Width="100" Margin="10,0,0,0" Click="btnPluginSettings_Click" /> <Button Content="Plugin Settings" Height="23" Name="btnPluginSettings" Width="100" Margin="10,0,0,0" Click="btnPluginSettings_Click" TabIndex="53" />
</StackPanel> </StackPanel>
<TextBlock Grid.Row="1" Text="Headset Device:" Style="{DynamicResource OptionHeaderStyle}" /> <TextBlock Grid.Row="1" Text="Headset Extras:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="1" Grid.Column="1" Name="comboHeadsetDevice" Width="340" /> <ComboBox Height="23" Grid.Row="1" Grid.Column="1" Name="comboHeadsetDevice" Width="340" TabIndex="1" />
<TextBlock Grid.Row="2" Text="Main Input:" Style="{DynamicResource OptionHeaderStyle}" /> <TextBlock Grid.Row="2" Text="Main Input:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="2" Grid.Column="1" Name="comboHeadsetInput" Width="340" /> <ComboBox Height="23" Grid.Row="2" Grid.Column="1" Name="comboHeadsetInput" Width="340" TabIndex="2" />
<TextBlock Grid.Row="3" Text="Main Output:" Style="{DynamicResource OptionHeaderStyle}" /> <TextBlock Grid.Row="3" Text="Main Output:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="3" Grid.Column="1" Name="comboHeadsetOutput" Width="340" /> <ComboBox Height="23" Grid.Row="3" Grid.Column="1" Name="comboHeadsetOutput" Width="340" TabIndex="3" />
<TextBlock Grid.Row="4" Text="Speakerphone Input:" Style="{DynamicResource OptionHeaderStyle}" /> <TextBlock Grid.Row="4" Text="Speakerphone Input:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="4" Grid.Column="1" Name="comboSpeakerInput" Width="340" /> <ComboBox Height="23" Grid.Row="4" Grid.Column="1" Name="comboSpeakerInput" Width="340" TabIndex="4" />
<TextBlock Grid.Row="5" Text="Speakerphone Output:" Style="{DynamicResource OptionHeaderStyle}" /> <TextBlock Grid.Row="5" Text="Speakerphone Output:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="5" Grid.Column="1" Name="comboSpeakerOutput" Width="340" /> <ComboBox Height="23" Grid.Row="5" Grid.Column="1" Name="comboSpeakerOutput" Width="340" TabIndex="5" />
<TextBlock Grid.Row="6" Text="Ring Device:" Style="{DynamicResource OptionHeaderStyle}" /> <TextBlock Grid.Row="6" Text="Ring Device:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="6" Grid.Column="1" Name="comboRingDevice" Width="340" /> <ComboBox Height="23" Grid.Row="6" Grid.Column="1" Name="comboRingDevice" Width="340" TabIndex="6" />
<TextBlock Grid.Row="7" Text="Startup Layout:" Style="{DynamicResource OptionHeaderStyle}" /> <TextBlock Grid.Row="7" Text="On Incoming Call:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="7" Grid.Column="1" Name="comboGUIStartup" Width="340" /> <ComboBox Height="23" Grid.Row="7" Grid.Column="1" Name="comboOnIncomingCall" Width="340" TabIndex="6" />
<TextBlock Grid.Row="8" Text="Theme:" Style="{DynamicResource OptionHeaderStyle}" /> <TextBlock Grid.Row="8" Text="Startup Layout:" Style="{DynamicResource OptionHeaderStyle}" />
<ComboBox Height="23" Grid.Row="8" Grid.Column="1" Name="comboTheme" Width="340" /> <ComboBox Height="23" Grid.Row="8" Grid.Column="1" Name="comboGUIStartup" Width="340" TabIndex="15" />
<TextBlock Grid.Row="9" Text="Recording Path:" Style="{DynamicResource OptionHeaderStyle}" /> <TextBlock Grid.Row="9" Text="Theme:" Style="{DynamicResource OptionHeaderStyle}" />
<StackPanel Orientation="Horizontal" Grid.Row="9" Grid.Column="1"> <ComboBox Height="23" Grid.Row="9" Grid.Column="1" Name="comboTheme" Width="340" TabIndex="16" />
<TextBox Height="23" Name="txtRecordingPath" Width="286" Margin="10,0" /> <TextBlock Grid.Row="10" Text="Recording Path:" Style="{DynamicResource OptionHeaderStyle}" />
<Button Name="btnPathBrowse" Content="Browse" Height="25" Click="btnPathBrowse_Click" /> <StackPanel Orientation="Horizontal" Grid.Row="11" Grid.Column="1">
<TextBox Height="23" Name="txtRecordingPath" Width="286" Margin="10,0" AutomationProperties.Name="Path to store recordings in" TabIndex="17" />
<Button Name="btnPathBrowse" Content="Browse" Height="25" Click="btnPathBrowse_Click" AutomationProperties.Name="Browse for folder to store recordings in" TabIndex="18" />
</StackPanel> </StackPanel>
</Grid> </Grid>
<StackPanel Grid.Row="1" Grid.Column="1"> <StackPanel Grid.Row="1" Grid.Column="1">
<CheckBox x:Name="chkIncomingFront" Content="Bring To Front On Incoming Calls" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" /> <CheckBox x:Name="chkIncomingBalloons" Content="Show Incoming Call Notification Balloons" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" TabIndex="26" />
<CheckBox x:Name="chkIncomingBalloons" Content="Show Incoming Call Notification Balloons" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" /> <CheckBox x:Name="chkClearDTMFS" Content="Clear Key Presses In Call Stats On Disconnect" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" TabIndex="27" />
<CheckBox x:Name="chkClearDTMFS" Content="Clear Key Presses In Call Stats On Disconnect" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" /> <CheckBox x:Name="chkUseNumbers" Content="Only Allow Numerical Input While Dialing" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" TabIndex="28" />
<CheckBox x:Name="chkUseNumbers" Content="Only Allow Numerical Input While Dialing" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" /> <CheckBox x:Name="chkUpdatesOnStart" Content="Check for Updates on Startup" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" TabIndex="29" />
<CheckBox x:Name="chkUpdatesOnStart" Content="Check for Updates on Startup" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" /> <CheckBox x:Name="chkNAT" Content="UPNP NAT Startup Check(slows startup 5-10s)" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" TabIndex="30" />
<CheckBox x:Name="chkNAT" Content="UPNP NAT Startup Check(slows startup 5-10s)" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" /> <CheckBox x:Name="chkDirectSip" Content="Direct SIP: Dialing" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" TabIndex="31" />
<CheckBox x:Name="chkDirectSip" Content="Direct SIP: Dialing" VerticalAlignment="Center" FontWeight="Bold" FontSize="13.333" />
</StackPanel> </StackPanel>
<Button Content="Save" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="101,0,0,0" Name="btnSave" VerticalAlignment="Center" Width="75" Grid.ColumnSpan="2" Click="btnSave_Click" /> <Button Content="Save" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="101,0,0,0" Name="btnSave" VerticalAlignment="Center" Width="75" Grid.ColumnSpan="2" Click="btnSave_Click" TabIndex="40" IsDefault="True" />
<Button Content="Cancel" Grid.Column="1" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="172,0,0,0" Name="btnCancel" VerticalAlignment="Center" Width="75" Click="btnCancel_Click" /> <Button Content="Cancel" Grid.Column="1" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="172,0,0,0" Name="btnCancel" VerticalAlignment="Center" Width="75" Click="btnCancel_Click" TabIndex="41" IsCancel="True" />
</Grid> </Grid>
......
...@@ -27,6 +27,13 @@ namespace FSClient { ...@@ -27,6 +27,13 @@ namespace FSClient {
themes.Add(new ComboOption { key = "Black", name = "Black" }); themes.Add(new ComboOption { key = "Black", name = "Black" });
themes.Add(new ComboOption { key = "White", name = "White" }); themes.Add(new ComboOption { key = "White", name = "White" });
comboTheme.ItemsSource = themes; comboTheme.ItemsSource = themes;
IncomingCallOptions = new List<ComboOption>();
IncomingCallOptions.Add(new ComboOption { key = "None", name = "Do Nothing" });
IncomingCallOptions.Add(new ComboOption { key = "Front", name = "Bring To Front" });
IncomingCallOptions.Add(new ComboOption { key = "FrontKeyboard", name = "Bring To Front & Keyboard Focus" });
comboOnIncomingCall.ItemsSource = IncomingCallOptions;
load_devices(true); load_devices(true);
} }
...@@ -38,7 +45,8 @@ namespace FSClient { ...@@ -38,7 +45,8 @@ namespace FSClient {
} }
} }
private List<ComboOption> GuiOptions; private List<ComboOption> GuiOptions;
private List<ComboOption> themes; private List<ComboOption> themes;
private List<ComboOption> IncomingCallOptions;
private void load_devices(bool from_settings) { private void load_devices(bool from_settings) {
PortAudio.AudioDevice[] devices = broker.audio_devices; PortAudio.AudioDevice[] devices = broker.audio_devices;
comboSpeakerInput.ItemsSource = comboHeadsetInput.ItemsSource = (from d in devices where d.inputs > 0 select d).ToArray(); comboSpeakerInput.ItemsSource = comboHeadsetInput.ItemsSource = (from d in devices where d.inputs > 0 select d).ToArray();
...@@ -55,8 +63,13 @@ namespace FSClient { ...@@ -55,8 +63,13 @@ namespace FSClient {
comboSpeakerInput.SelectedItem = broker.SpeakerInDev; comboSpeakerInput.SelectedItem = broker.SpeakerInDev;
comboSpeakerOutput.SelectedItem = broker.SpeakerOutDev; comboSpeakerOutput.SelectedItem = broker.SpeakerOutDev;
comboRingDevice.SelectedItem = broker.RingDev; comboRingDevice.SelectedItem = broker.RingDev;
chkIncomingBalloons.IsChecked = broker.IncomingBalloons; chkIncomingBalloons.IsChecked = broker.IncomingBalloons;
chkIncomingFront.IsChecked = broker.IncomingTopMost; string incoming_key = "None";
if (broker.IncomingTopMost)
incoming_key = broker.IncomingKeyboardFocus ? "FrontKeyboard" : "Front";
comboOnIncomingCall.SelectedItem = (from g in IncomingCallOptions where g.key == incoming_key select g).FirstOrDefault();
if (comboOnIncomingCall.SelectedIndex == -1)
comboOnIncomingCall.SelectedIndex = 1;
chkClearDTMFS.IsChecked = broker.ClearDTMFS; chkClearDTMFS.IsChecked = broker.ClearDTMFS;
chkUseNumbers.IsChecked = broker.UseNumberOnlyInput; chkUseNumbers.IsChecked = broker.UseNumberOnlyInput;
chkUpdatesOnStart.IsChecked = broker.CheckForUpdates != "Never"; chkUpdatesOnStart.IsChecked = broker.CheckForUpdates != "Never";
...@@ -84,8 +97,14 @@ namespace FSClient { ...@@ -84,8 +97,14 @@ namespace FSClient {
broker.SetSpeakerDevs(indev == null ? "" : indev.name, outdev == null ? "" : outdev.name); broker.SetSpeakerDevs(indev == null ? "" : indev.name, outdev == null ? "" : outdev.name);
outdev = comboRingDevice.SelectedItem as PortAudio.AudioDevice; outdev = comboRingDevice.SelectedItem as PortAudio.AudioDevice;
broker.SetRingDev(outdev == null ? "" : outdev.name); broker.SetRingDev(outdev == null ? "" : outdev.name);
broker.IncomingBalloons = chkIncomingBalloons.IsChecked == true; broker.IncomingBalloons = chkIncomingBalloons.IsChecked == true;
broker.IncomingTopMost = chkIncomingFront.IsChecked == true; string incoming_key = (comboOnIncomingCall.SelectedItem as ComboOption).key;
if (incoming_key == "None")
broker.IncomingKeyboardFocus = broker.IncomingTopMost = false;
else{
broker.IncomingTopMost = true;
broker.IncomingKeyboardFocus = (incoming_key == "FrontKeyboard");
}
broker.ClearDTMFS = chkClearDTMFS.IsChecked == true; broker.ClearDTMFS = chkClearDTMFS.IsChecked == true;
broker.UPNPNAT = chkNAT.IsChecked == true; broker.UPNPNAT = chkNAT.IsChecked == true;
broker.DirectSipDial = chkDirectSip.IsChecked == true; broker.DirectSipDial = chkDirectSip.IsChecked == true;
......
...@@ -18,17 +18,24 @@ ...@@ -18,17 +18,24 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Text="Contact Plugin" TextAlignment="Center" FontWeight="Bold" /> <TextBlock Text="Contact Plugin" TextAlignment="Center" FontWeight="Bold" />
<TextBlock Text="Headset Plugins" Grid.Column="1" TextAlignment="Center" FontWeight="Bold" /> <TextBlock Text="Headset Plugins" Grid.Column="1" TextAlignment="Center" FontWeight="Bold" />
<ComboBox HorizontalAlignment="Center" Name="comboContact" VerticalAlignment="Top" Width="220" Grid.Row="1" /> <ComboBox HorizontalAlignment="Center" Name="comboContact" VerticalAlignment="Top" Width="220" Grid.Row="1" AutomationProperties.Name="Contact Plugin Enabled" />
<ListBox Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" Height="100" HorizontalAlignment="Center" Name="listHeadset" VerticalAlignment="Top" Width="220" SelectionMode="Multiple" /> <ListBox Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" Height="100" HorizontalAlignment="Center" Name="listHeadset" VerticalAlignment="Top" Width="220" SelectionMode="Multiple" AutomationProperties.Name="Headset Plugins" />
<TextBlock Text="Enabled Plugins" Grid.Row="2" Grid.ColumnSpan="2" FontWeight="Bold" TextAlignment="Center" /> <TextBlock Text="Enabled Plugins" Grid.Row="2" Grid.ColumnSpan="2" FontWeight="Bold" TextAlignment="Center" />
<ItemsControl Grid.Row="3" Grid.ColumnSpan="2" Name="itemscontrolEnabledPlugins"> <ItemsControl Grid.Row="3" Grid.ColumnSpan="2" Name="itemscontrolEnabledPlugins" AutomationProperties.Name="Plugin Options">
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<Border BorderBrush="Black" BorderThickness="1" Margin="0,3" Width="500"> <Border BorderBrush="Black" BorderThickness="1" Margin="0,3" Width="500">
<StackPanel Orientation="Horizontal" Margin="5"> <StackPanel Orientation="Horizontal" Margin="5">
<Button Content="Options" Visibility="{Binding has_options_button, Converter={StaticResource BoolToVisibilityConverter}}" Click="btn_PluginOptions_Click" /> <Button Content="Options" Visibility="{Binding has_options_button, Converter={StaticResource BoolToVisibilityConverter}}" Click="btn_PluginOptions_Click">
<AutomationProperties.Name>
<MultiBinding StringFormat="Plugin {0} Options - {1}">
<Binding Path="name" />
<Binding Path="error_msg" />
</MultiBinding>
</AutomationProperties.Name>
</Button>
<Image Source="warning.png" Margin="10,0" Visibility="{Binding error_exists, Converter={StaticResource BoolToVisibilityConverter}}" ToolTip="{Binding error_msg}" Height="20" /> <Image Source="warning.png" Margin="10,0" Visibility="{Binding error_exists, Converter={StaticResource BoolToVisibilityConverter}}" ToolTip="{Binding error_msg}" Height="20" />
<TextBlock Text="{Binding name}" VerticalAlignment="Center" /> <TextBlock Text="{Binding name}" VerticalAlignment="Center" />
</StackPanel> </StackPanel>
...@@ -36,7 +43,7 @@ ...@@ -36,7 +43,7 @@
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>
<Button Content="Save" Grid.Row="4" Height="22" Width="50" Name="btnSave" Click="btnSave_Click" /> <Button Content="Save" Grid.Row="4" Height="22" Width="50" Name="btnSave" Click="btnSave_Click" IsDefault="True" />
<Button Content="Cancel" Grid.Row="4" Height="22" Width="50" Grid.Column="1" Name="btnCancel" Click="btnCancel_Click" /> <Button Content="Cancel" Grid.Row="4" Height="22" Width="50" Grid.Column="1" Name="btnCancel" Click="btnCancel_Click" IsCancel="True" />
</Grid> </Grid>
</Window> </Window>
using System.Collections.Generic; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Windows;
using System.Xml; using System.Xml;
namespace FSClient { namespace FSClient {
public class PortAudio { public class PortAudio {
...@@ -116,7 +118,14 @@ namespace FSClient { ...@@ -116,7 +118,14 @@ namespace FSClient {
foreach (InternalAudioDevice device in _devices) foreach (InternalAudioDevice device in _devices)
device.is_alive = false; device.is_alive = false;
Utils.api_exec("pa", "rescan"); Utils.api_exec("pa", "rescan");
XmlDocument doc = XmlUtils.GetDocument(Utils.api_exec("pa", "devlist xml")); XmlDocument doc=null;
try{
doc = XmlUtils.GetDocument(Utils.api_exec("pa", "devlist xml"));
}catch(KeyNotFoundException){
MessageBox.Show("Portaudio did not return a device list most likely because it cannot find an active microphone or speaker it can use, FSClient will now exit.", "Missing Device List", MessageBoxButton.OK, MessageBoxImage.Error);
Environment.Exit(-1);
return;
}
XmlNode node = XmlUtils.GetNode(doc, "devices", 0); XmlNode node = XmlUtils.GetNode(doc, "devices", 0);
foreach (XmlNode child in node.ChildNodes) { foreach (XmlNode child in node.ChildNodes) {
AudioDevice dev = new AudioDevice( AudioDevice dev = new AudioDevice(
......
...@@ -51,5 +51,5 @@ using System.Windows; ...@@ -51,5 +51,5 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.1")] [assembly: AssemblyVersion("1.2.0.9")]
[assembly: AssemblyFileVersion("1.2.0.1")] [assembly: AssemblyFileVersion("1.2.0.9")]
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.269 // Runtime Version:4.0.30319.17929
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
...@@ -293,5 +293,17 @@ namespace FSClient.Properties { ...@@ -293,5 +293,17 @@ namespace FSClient.Properties {
this["Theme"] = value; this["Theme"] = value;
} }
} }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool KeyboardFocusIncomingCall {
get {
return ((bool)(this["KeyboardFocusIncomingCall"]));
}
set {
this["KeyboardFocusIncomingCall"] = value;
}
}
} }
} }
...@@ -71,5 +71,8 @@ ...@@ -71,5 +71,8 @@
<Setting Name="Theme" Type="System.String" Scope="User"> <Setting Name="Theme" Type="System.String" Scope="User">
<Value Profile="(Default)">Steel</Value> <Value Profile="(Default)">Steel</Value>
</Setting> </Setting>
<Setting Name="KeyboardFocusIncomingCall" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings> </Settings>
</SettingsFile> </SettingsFile>
\ No newline at end of file
using System; using System;
using System.Configuration; using System.Configuration;
using System.Reflection; using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Timers; using System.Timers;
using System.Windows; using System.Windows;
using System.Windows.Interop;
using System.Xml; using System.Xml;
using FreeSWITCH.Native; using FreeSWITCH.Native;
using System.IO; using System.IO;
...@@ -134,6 +137,39 @@ namespace FSClient { ...@@ -134,6 +137,39 @@ namespace FSClient {
} }
DebugWrite(event_dump + "\n"); DebugWrite(event_dump + "\n");
#endif #endif
} }
[DllImport("user32")]
public static extern IntPtr GetForegroundWindow();
[DllImport("user32")]
public static extern bool AttachThreadInput(uint idAttach, uint idAttachTo, bool fAttach);
[DllImport("kernel32.dll")]
public static extern uint GetCurrentThreadId();
[DllImport("user32.dll", SetLastError = true)]
public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, uint nCmdShow);
[DllImport("user32")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
private static uint GetProcessId(IntPtr hwnd, out uint thread_id) {
uint pid = 0;
thread_id = GetWindowThreadProcessId(hwnd, out pid);
return pid;
}
public const uint SW_SHOW = 0x05;
public static void SetForegroundWindow(Window to_foreground){
IntPtr hWnd = new WindowInteropHelper(to_foreground).Handle;
uint thread_id;
IntPtr foregroundHwnd = GetForegroundWindow();
GetProcessId(foregroundHwnd, out thread_id);
uint our_id = GetCurrentThreadId();
SetForegroundWindow(hWnd);
ShowWindowAsync(hWnd, SW_SHOW);
if (!AttachThreadInput(thread_id, our_id, true))
return;
SetForegroundWindow(hWnd);
ShowWindowAsync(hWnd, SW_SHOW);
AttachThreadInput(thread_id, our_id, false);
}
} }
} }
...@@ -61,6 +61,9 @@ ...@@ -61,6 +61,9 @@
<setting name="Theme" serializeAs="String"> <setting name="Theme" serializeAs="String">
<value>Steel</value> <value>Steel</value>
</setting> </setting>
<setting name="KeyboardFocusIncomingCall" serializeAs="String">
<value>False</value>
</setting>
</FSClient.Properties.Settings> </FSClient.Properties.Settings>
</userSettings> </userSettings>
</configuration> </configuration>
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论