| 1 |
** |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
using System; |
| 13 |
using VoipUI.Helpers; |
| 14 |
using VoipTasks.BackgroundOperations; |
| 15 |
using Windows.UI.Xaml; |
| 16 |
using Windows.UI.Xaml.Controls; |
| 17 |
using System.Diagnostics; |
| 18 |
using VoipBackEnd; |
| 19 |
using System.Threading; |
| 20 |
using Windows.ApplicationModel.AppService; |
| 21 |
using Windows.UI.Xaml.Navigation; |
| 22 |
|
| 23 |
namespace VoipUI |
| 24 |
{ |
| 25 |
public sealed partial class MainPage : Page |
| 26 |
{ |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
private int MethodCallUnexpectedTime = -2147483634; |
| 31 |
|
| 32 |
public static string callerName, callerNumber; |
| 33 |
public static MainPage Current; |
| 34 |
|
| 35 |
public MainPage() |
| 36 |
{ |
| 37 |
this.InitializeComponent(); |
| 38 |
Current = this; |
| 39 |
} |
| 40 |
|
| 41 |
private async void GetAccountInfoAsync() |
| 42 |
{ |
| 43 |
try |
| 44 |
{ |
| 45 |
OperationResult result = await EndpointHelper.GetAccountInfo(); |
| 46 |
} |
| 47 |
catch (Exception ex) |
| 48 |
{ |
| 49 |
Debug.WriteLine(ex.Message); |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
private async void ModifyAccountAsync() |
| 54 |
{ |
| 55 |
try |
| 56 |
{ |
| 57 |
OperationResult result = await EndpointHelper.ModifyAccount( |
| 58 |
txt_UserId.Text, |
| 59 |
txt_Registrar.Text, |
| 60 |
txt_Proxy.Text, |
| 61 |
txt_RegUserName.Text, |
| 62 |
txt_Password.Text); |
| 63 |
} |
| 64 |
catch (Exception ex) |
| 65 |
{ |
| 66 |
Debug.WriteLine(ex.Message); |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
private async void NewOutgoingCallAsync() |
| 71 |
{ |
| 72 |
try |
| 73 |
{ |
| 74 |
OperationResult result = await VoipCallHelper.NewOutgoingCallAsync(txt_CallerNumber.Text); |
| 75 |
} |
| 76 |
catch (Exception ex) |
| 77 |
{ |
| 78 |
Debug.WriteLine(ex.Message); |
| 79 |
} |
| 80 |
} |
| 81 |
|
| 82 |
private void EndCall() |
| 83 |
{ |
| 84 |
try |
| 85 |
{ |
| 86 |
OperationResult result = VoipCallHelper.EndCallAsync(); |
| 87 |
} |
| 88 |
catch (Exception ex) |
| 89 |
{ |
| 90 |
Debug.WriteLine(ex.Message); |
| 91 |
} |
| 92 |
txt_CallStatus.Text = "Disconnected"; |
| 93 |
} |
| 94 |
|
| 95 |
public void UpdateAccountInfo(String id, String registrar, String proxy, |
| 96 |
String username, String password) |
| 97 |
{ |
| 98 |
txt_UserId.Text = id; |
| 99 |
txt_Registrar.Text = registrar; |
| 100 |
txt_Proxy.Text = proxy; |
| 101 |
txt_RegUserName.Text = username; |
| 102 |
txt_Password.Text = password; |
| 103 |
} |
| 104 |
|
| 105 |
private void btn_NewOutgoingCall_Click(object sender, RoutedEventArgs e) |
| 106 |
{ |
| 107 |
NewOutgoingCallAsync(); |
| 108 |
} |
| 109 |
|
| 110 |
|
| 111 |
private void btn_EndCall_Click(object sender, RoutedEventArgs e) |
| 112 |
{ |
| 113 |
EndCall(); |
| 114 |
} |
| 115 |
|
| 116 |
public void UpdateCallState(String state) |
| 117 |
{ |
| 118 |
txt_CallStatus.Text = state; |
| 119 |
} |
| 120 |
|
| 121 |
public void UpdateRegState(String state) |
| 122 |
{ |
| 123 |
txt_RegState.Text = "Reg:" + state; |
| 124 |
} |
| 125 |
|
| 126 |
private void btn_GetAccountInfo_Click(object sender, RoutedEventArgs e) |
| 127 |
{ |
| 128 |
GetAccountInfoAsync(); |
| 129 |
} |
| 130 |
|
| 131 |
private void btn_ModifyAccount_Click(object sender, RoutedEventArgs e) |
| 132 |
{ |
| 133 |
ModifyAccountAsync(); |
| 134 |
} |
| 135 |
} |
| 136 |
} |