Commit 948a4cd8 authored by Ghislain MARY's avatar Ghislain MARY

Initialize the linphone core as early as possible.

parent 80505476
......@@ -221,6 +221,9 @@ namespace Linphone.Model
BackgroundProcessConnected = true;
Debug.WriteLine("[LinphoneManager] Background process connected to interface");
// Create LinphoneCore if not created yet, otherwise do nothing
InitLinphoneCore();
}
/// <summary>
......@@ -537,6 +540,7 @@ namespace Linphone.Model
/// </summary>
public void MuteMic(Boolean isMicMuted)
{
if (BaseModel.UIDispatcher == null) return;
BaseModel.UIDispatcher.BeginInvoke(() =>
{
if (LinphoneCore.GetCallsNb() > 0)
......@@ -799,6 +803,7 @@ namespace Linphone.Model
/// </summary>
public void CallState(LinphoneCall call, LinphoneCallState state, string message)
{
if (BaseModel.UIDispatcher == null) return;
if (state == LinphoneCallState.OutgoingProgress)
{
BaseModel.UIDispatcher.BeginInvoke(() =>
......@@ -936,9 +941,7 @@ namespace Linphone.Model
/// </summary>
public void RegistrationState(LinphoneProxyConfig config, RegistrationState state, string message)
{
if (config == null)
return;
if ((config == null) || BaseModel.UIDispatcher == null) return;
BaseModel.UIDispatcher.BeginInvoke(() =>
{
try
......@@ -1031,6 +1034,7 @@ namespace Linphone.Model
/// </summary>
public void MessageReceived(LinphoneChatMessage message)
{
if (BaseModel.UIDispatcher == null) return;
BaseModel.UIDispatcher.BeginInvoke(() =>
{
string sipAddress = message.GetFrom().AsStringUriOnly().Replace("sip:", "");
......@@ -1105,6 +1109,7 @@ namespace Linphone.Model
/// </summary>
public void ComposingReceived(LinphoneChatRoom room)
{
if (BaseModel.UIDispatcher == null) return;
BaseModel.UIDispatcher.BeginInvoke(() =>
{
if (ComposingListener != null && room != null)
......@@ -1131,6 +1136,7 @@ namespace Linphone.Model
/// </summary>
public void LogUploadStatusChanged(LinphoneCoreLogCollectionUploadState state, string info)
{
if (BaseModel.UIDispatcher == null) return;
BaseModel.UIDispatcher.BeginInvoke(() =>
{
if (state == LinphoneCoreLogCollectionUploadState.LinphoneCoreLogCollectionUploadStateDelivered)
......@@ -1210,14 +1216,13 @@ namespace Linphone.Model
if (e.ContactFound != null)
{
Logger.Msg("[LinphoneManager] Contact found: " + e.ContactFound.DisplayName + "\r\n");
ContactManager.ContactFound -= OnContactFound;
// Store the contact name as display name for call logs
if (LinphoneManager.Instance.LinphoneCore.GetCurrentCall() != null)
{
LinphoneManager.Instance.LinphoneCore.GetCurrentCall().GetRemoteAddress().SetDisplayName(e.ContactFound.DisplayName);
}
}
ContactManager.ContactFound -= OnContactFound;
}
#endregion
}
......
......@@ -79,16 +79,6 @@ namespace Linphone.Views
}
}
/// <summary>
/// Method called when the page is displayed.
/// </summary>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
// Create LinphoneCore if not created yet, otherwise do nothing
LinphoneManager.Instance.InitLinphoneCore();
}
/// <summary>
/// Method called when the user is navigation away from this page
/// </summary>
......
......@@ -108,8 +108,6 @@ namespace Linphone.Views
{
base.OnNavigatedTo(e);
saveSettingsOnLeave = true;
// Create LinphoneCore if not created yet, otherwise do nothing
LinphoneManager.Instance.InitLinphoneCore();
}
/// <summary>
......
......@@ -48,9 +48,6 @@ namespace Linphone.Views
{
base.OnNavigatedTo(e);
LinphoneManager.Instance.ECListener = this;
// Create LinphoneCore if not created yet, otherwise do nothing
LinphoneManager.Instance.InitLinphoneCore();
}
/// <summary>
......
......@@ -96,9 +96,6 @@ namespace Linphone.Views
LinphoneManager.Instance.MessageListener = this;
LinphoneManager.Instance.ComposingListener = this;
// Create LinphoneCore if not created yet, otherwise do nothing
LinphoneManager.Instance.InitLinphoneCore();
ContactManager cm = ContactManager.Instance;
cm.ContactFound += cm_ContactFound;
......
......@@ -98,9 +98,6 @@ namespace Linphone
StatusBar = status;
BasePage.StatusBar.RefreshStatus(LinphoneManager.Instance.LastKnownState);
// Create LinphoneCore if not created yet, otherwise do nothing
LinphoneManager.Instance.InitLinphoneCore();
BuildLocalizedApplicationBar();
// Check for the navigation direction to avoid going to incall view when coming back from incall view
......
......@@ -34,9 +34,6 @@ namespace Linphone.Views
{
base.OnNavigatedTo(e);
// Create LinphoneCore if not created yet, otherwise do nothing
LinphoneManager.Instance.InitLinphoneCore();
if (LinphoneManager.Instance.LinphoneCore.GetProxyConfigList().Count > 0)
{
NavigationService.Navigate(new Uri("/Views/Dialer.xaml", UriKind.RelativeOrAbsolute));
......
......@@ -39,9 +39,6 @@ namespace Linphone.Views
{
base.OnNavigatedTo(e);
// Create LinphoneCore if not created yet, otherwise do nothing
LinphoneManager.Instance.InitLinphoneCore();
LinphoneManager.Instance.LinphoneCore.ResetMissedCallsCount();
List<CallLog> callsHistory = LinphoneManager.Instance.GetCallsHistory();
......
......@@ -175,9 +175,6 @@ namespace Linphone.Views
/// </summary>
protected override void OnNavigatedTo(NavigationEventArgs nee)
{
// Create LinphoneCore if not created yet, otherwise do nothing
LinphoneManager.Instance.InitLinphoneCore();
base.OnNavigatedTo(nee);
this.ViewModel.MuteListener = this;
this.ViewModel.PauseListener = this;
......
......@@ -62,9 +62,6 @@ namespace Linphone.Views
/// </summary>
protected override void OnNavigatedTo(NavigationEventArgs nee)
{
// Create LinphoneCore if not created yet, otherwise do nothing
LinphoneManager.Instance.InitLinphoneCore();
base.OnNavigatedTo(nee);
if (NavigationContext.QueryString.ContainsKey("sip"))
......
......@@ -28,8 +28,6 @@ namespace Linphone.Views
{
base.OnNavigatedTo(e);
// Create LinphoneCore if not created yet, otherwise do nothing
LinphoneManager.Instance.InitLinphoneCore();
bool isVideoEnabled = LinphoneManager.Instance.LinphoneCore.IsVideoSupported() && (LinphoneManager.Instance.LinphoneCore.IsVideoDisplayEnabled() || LinphoneManager.Instance.LinphoneCore.IsVideoCaptureEnabled());
Video.Visibility = isVideoEnabled ? Visibility.Visible : Visibility.Collapsed;
}
......
......@@ -43,16 +43,6 @@ namespace Linphone.Views
H264.IsChecked = _codecsSettings.H264;
}
/// <summary>
/// Method called when the page is displayed.
/// </summary>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
// Create LinphoneCore if not created yet, otherwise do nothing
LinphoneManager.Instance.InitLinphoneCore();
}
/// <summary>
/// Method called when the user is navigation away from this page
/// </summary>
......
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