Commit 0fa8ba66 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Updated LinphoneManager/History behavior

parent a5a7a720
......@@ -228,9 +228,23 @@ namespace Linphone.Model
/// <summary>
/// Remove all calls' history from LinphoneCore
/// </summary>
public void ClearCallLogs()
/// <returns>An empty list</returns>
public List<CallLogs> ClearCallLogs()
{
LinphoneCore.ClearCallLogs();
_history = new List<CallLogs>();
ObservableCollection<CallLog> calls = new ObservableCollection<CallLog>();
ObservableCollection<CallLog> missedCalls = new ObservableCollection<CallLog>();
CallLogs all = new CallLogs("All", calls);
_history.Add(all);
CallLogs missed = new CallLogs("Missed", missedCalls);
_history.Add(missed);
return _history;
}
/// <summary>
......
......@@ -34,8 +34,7 @@ namespace Linphone.Views
private void deleteAll_Click_1(object sender, EventArgs e)
{
history.ItemsSource = null;
LinphoneManager.Instance.ClearCallLogs();
history.ItemsSource = LinphoneManager.Instance.ClearCallLogs();
}
private void deleteSelection_Click_1(object sender, EventArgs e)
......
......@@ -74,16 +74,15 @@ namespace Linphone.Views
var op = await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-lock:"));
}
//TODO: Remove later
private void Simulate_Click_1(object sender, RoutedEventArgs e)
{
try
{
// Create an HTTPWebRequest that posts the raw notification to the Microsoft Push Notification Service.
// HTTP POST is the only method allowed to send the notification.
HttpWebRequest sendNotificationRequest = (HttpWebRequest)WebRequest.Create(((App)App.Current).PushChannelUri);
sendNotificationRequest.Method = "POST";
// Create the raw message.
string rawMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<root>" +
"<Value1>" + "Sylvain Berfini" + "<Value1>" +
......@@ -91,12 +90,11 @@ namespace Linphone.Views
"</root>";
byte[] notificationMessage = Encoding.UTF8.GetBytes(rawMessage);
// Set the required web request headers
sendNotificationRequest.ContentLength = notificationMessage.Length;
sendNotificationRequest.ContentType = "text/xml";
sendNotificationRequest.Headers["X-NotificationClass"] = "4";
// 4 is the type of VoIP PNs
// Write the request body
sendNotificationRequest.BeginGetRequestStream((IAsyncResult arRequest) =>
{
try
......@@ -106,7 +104,6 @@ namespace Linphone.Views
requestStream.Write(notificationMessage, 0, notificationMessage.Length);
}
// Get the response.
sendNotificationRequest.BeginGetResponse((IAsyncResult arResponse) =>
{
try
......@@ -116,17 +113,17 @@ namespace Linphone.Views
string subscriptionStatus = response.Headers["X-SubscriptionStatus"];
string deviceConnectionStatus = response.Headers["X-DeviceConnectionStatus"];
}
catch (Exception ex)
catch (Exception)
{
}
}, null);
}
catch (Exception ex)
catch (Exception)
{
}
}, null);
}
catch (Exception ex)
catch (Exception)
{
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment