Commit a9e1e2c2 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

First commit

parents
Linphone/Bin/
Linphone/obj/
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Phone
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Linphone", "Linphone\Linphone.csproj", "{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Debug|ARM.ActiveCfg = Debug|ARM
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Debug|ARM.Build.0 = Debug|ARM
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Debug|ARM.Deploy.0 = Debug|ARM
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Debug|x86.ActiveCfg = Debug|x86
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Debug|x86.Build.0 = Debug|x86
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Debug|x86.Deploy.0 = Debug|x86
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Release|Any CPU.Build.0 = Release|Any CPU
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Release|Any CPU.Deploy.0 = Release|Any CPU
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Release|ARM.ActiveCfg = Release|ARM
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Release|ARM.Build.0 = Release|ARM
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Release|ARM.Deploy.0 = Release|ARM
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Release|x86.ActiveCfg = Release|x86
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Release|x86.Build.0 = Release|x86
{BB0B8F3F-8638-49CF-B968-E097A2E6CBBE}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
<Application
x:Class="Linphone.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">
<!--Application Resources-->
<Application.Resources>
<local:LocalizedStrings xmlns:local="clr-namespace:Linphone" x:Key="LocalizedStrings"/>
</Application.Resources>
<Application.ApplicationLifetimeObjects>
<!--Required object that handles lifetime events for the application-->
<shell:PhoneApplicationService
Launching="Application_Launching" Closing="Application_Closing"
Activated="Application_Activated" Deactivated="Application_Deactivated"/>
</Application.ApplicationLifetimeObjects>
</Application>
\ No newline at end of file
using System;
using System.Diagnostics;
using System.Resources;
using System.Windows;
using System.Windows.Markup;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Linphone.Resources;
namespace Linphone
{
public partial class App : Application
{
/// <summary>
/// Provides easy access to the root frame of the Phone Application.
/// </summary>
/// <returns>The root frame of the Phone Application.</returns>
public static PhoneApplicationFrame RootFrame { get; private set; }
/// <summary>
/// Constructor for the Application object.
/// </summary>
public App()
{
// Global handler for uncaught exceptions.
UnhandledException += Application_UnhandledException;
// Standard XAML initialization
InitializeComponent();
// Phone-specific initialization
InitializePhoneApplication();
// Language display initialization
InitializeLanguage();
// Show graphics profiling information while debugging.
if (Debugger.IsAttached)
{
// Display the current frame rate counters.
Application.Current.Host.Settings.EnableFrameRateCounter = true;
// Show the areas of the app that are being redrawn in each frame.
//Application.Current.Host.Settings.EnableRedrawRegions = true;
// Enable non-production analysis visualization mode,
// which shows areas of a page that are handed off to GPU with a colored overlay.
//Application.Current.Host.Settings.EnableCacheVisualization = true;
// Prevent the screen from turning off while under the debugger by disabling
// the application's idle detection.
// Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
// and consume battery power when the user is not using the phone.
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
}
}
// Code to execute when the application is launching (eg, from Start)
// This code will not execute when the application is reactivated
private void Application_Launching(object sender, LaunchingEventArgs e)
{
}
// Code to execute when the application is activated (brought to foreground)
// This code will not execute when the application is first launched
private void Application_Activated(object sender, ActivatedEventArgs e)
{
}
// Code to execute when the application is deactivated (sent to background)
// This code will not execute when the application is closing
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
{
}
// Code to execute when the application is closing (eg, user hit Back)
// This code will not execute when the application is deactivated
private void Application_Closing(object sender, ClosingEventArgs e)
{
}
// Code to execute if a navigation fails
private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
{
if (Debugger.IsAttached)
{
// A navigation has failed; break into the debugger
Debugger.Break();
}
}
// Code to execute on Unhandled Exceptions
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
Debugger.Break();
}
}
#region Phone application initialization
// Avoid double-initialization
private bool phoneApplicationInitialized = false;
// Do not add any additional code to this method
private void InitializePhoneApplication()
{
if (phoneApplicationInitialized)
return;
// Create the frame but don't set it as RootVisual yet; this allows the splash
// screen to remain active until the application is ready to render.
RootFrame = new PhoneApplicationFrame();
RootFrame.Navigated += CompleteInitializePhoneApplication;
// Handle navigation failures
RootFrame.NavigationFailed += RootFrame_NavigationFailed;
// Handle reset requests for clearing the backstack
RootFrame.Navigated += CheckForResetNavigation;
// Ensure we don't initialize again
phoneApplicationInitialized = true;
}
// Do not add any additional code to this method
private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
{
// Set the root visual to allow the application to render
if (RootVisual != RootFrame)
RootVisual = RootFrame;
// Remove this handler since it is no longer needed
RootFrame.Navigated -= CompleteInitializePhoneApplication;
}
private void CheckForResetNavigation(object sender, NavigationEventArgs e)
{
// If the app has received a 'reset' navigation, then we need to check
// on the next navigation to see if the page stack should be reset
if (e.NavigationMode == NavigationMode.Reset)
RootFrame.Navigated += ClearBackStackAfterReset;
}
private void ClearBackStackAfterReset(object sender, NavigationEventArgs e)
{
// Unregister the event so it doesn't get called again
RootFrame.Navigated -= ClearBackStackAfterReset;
// Only clear the stack for 'new' (forward) and 'refresh' navigations
if (e.NavigationMode != NavigationMode.New && e.NavigationMode != NavigationMode.Refresh)
return;
// For UI consistency, clear the entire page stack
while (RootFrame.RemoveBackEntry() != null)
{
; // do nothing
}
}
#endregion
// Initialize the app's font and flow direction as defined in its localized resource strings.
//
// To ensure that the font of your application is aligned with its supported languages and that the
// FlowDirection for each of those languages follows its traditional direction, ResourceLanguage
// and ResourceFlowDirection should be initialized in each resx file to match these values with that
// file's culture. For example:
//
// AppResources.es-ES.resx
// ResourceLanguage's value should be "es-ES"
// ResourceFlowDirection's value should be "LeftToRight"
//
// AppResources.ar-SA.resx
// ResourceLanguage's value should be "ar-SA"
// ResourceFlowDirection's value should be "RightToLeft"
//
// For more info on localizing Windows Phone apps see http://go.microsoft.com/fwlink/?LinkId=262072.
//
private void InitializeLanguage()
{
try
{
// Set the font to match the display language defined by the
// ResourceLanguage resource string for each supported language.
//
// Fall back to the font of the neutral language if the Display
// language of the phone is not supported.
//
// If a compiler error is hit then ResourceLanguage is missing from
// the resource file.
RootFrame.Language = XmlLanguage.GetLanguage(AppResources.ResourceLanguage);
// Set the FlowDirection of all elements under the root frame based
// on the ResourceFlowDirection resource string for each
// supported language.
//
// If a compiler error is hit then ResourceFlowDirection is missing from
// the resource file.
FlowDirection flow = (FlowDirection)Enum.Parse(typeof(FlowDirection), AppResources.ResourceFlowDirection);
RootFrame.FlowDirection = flow;
}
catch
{
// If an exception is caught here it is most likely due to either
// ResourceLangauge not being correctly set to a supported language
// code or ResourceFlowDirection is set to a value other than LeftToRight
// or RightToLeft.
if (Debugger.IsAttached)
{
Debugger.Break();
}
throw;
}
}
}
}
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<CurrentDeployCmdId>256</CurrentDeployCmdId>
<CurrentDeployID>30F105C9-681E-420b-A277-7C086EAD8A4E</CurrentDeployID>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<CurrentDeployCmdId>256</CurrentDeployCmdId>
<CurrentDeployID>30F105C9-681E-420b-A277-7C086EAD8A4E</CurrentDeployID>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{C089C8C0-30E0-4E22-80C0-CE093F111A43}">
<SilverlightMobileCSProjectFlavor>
<FullDeploy>False</FullDeploy>
<DebuggerType>Managed</DebuggerType>
<Tombstone>False</Tombstone>
</SilverlightMobileCSProjectFlavor>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
\ No newline at end of file
using Linphone.Resources;
namespace Linphone
{
/// <summary>
/// Provides access to string resources.
/// </summary>
public class LocalizedStrings
{
private static AppResources _localizedResources = new AppResources();
public AppResources LocalizedResources { get { return _localizedResources; } }
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
namespace Linphone.Model
{
public class CallLogs
{
private String _title;
public String Title
{
get
{
return _title;
}
set
{
_title = value;
}
}
public ObservableCollection<CallLog> Calls { get; set; }
public CallLogs(String title, ObservableCollection<CallLog> calls)
{
_title = title;
Calls = calls;
}
}
public class CallLog
{
private static BitmapImage _incomingIcon = new BitmapImage(new Uri("/Assets/call_status_incoming.png", UriKind.Relative));
private static BitmapImage _outgoingIcon = new BitmapImage(new Uri("/Assets/call_status_outgoing.png", UriKind.Relative));
private static BitmapImage _missedIcon = new BitmapImage(new Uri("/Assets/call_status_missed.png", UriKind.Relative));
private String _from;
public String From
{
get
{
return _from;
}
set
{
_from = value;
}
}
private String _to;
public String To
{
get
{
return _to;
}
set
{
_to = value;
}
}
private bool _isIncoming;
public bool IsIncoming
{
get
{
return _isIncoming;
}
set
{
_isIncoming = value;
}
}
private bool _isMissed;
public bool IsMissed
{
get
{
return _isMissed;
}
set
{
_isMissed = value;
}
}
public BitmapImage StatusIcon
{
get
{
if (_isIncoming)
{
if (_isMissed)
return _missedIcon;
else
return _incomingIcon;
}
else
return _outgoingIcon;
}
}
public String DisplayedName
{
get
{
if (_isIncoming)
return _from;
else
return _to;
}
}
public CallLog(String from, String to, bool isIncoming, bool isMissed)
{
_from = from;
_to = to;
_isIncoming = isIncoming;
_isMissed = isMissed;
}
}
}
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Linphone.Model
{
public class LinphoneManager
{
private static LinphoneManager _instance = new LinphoneManager();
public static LinphoneManager Instance
{
get { return _instance; }
}
private List<CallLogs> _history;
/// <summary>
/// Set the debug value for liblinphone
/// </summary>
/// <param name="enable">true to enable debug traces, false to disable them</param>
/// <returns></returns>
public void EnableDebug(bool enable)
{
}
/// <summary>
/// Get the calls' history
/// </summary>
/// <returns>A list of CallLogs, each one representing a type of calls (All, Missed, ...)</returns>
public List<CallLogs> GetCallsHistory()
{
_history = new List<CallLogs>();
ObservableCollection<CallLog> calls = new ObservableCollection<CallLog>();
ObservableCollection<CallLog> missedCalls = new ObservableCollection<CallLog>();
CallLog logA = new CallLog("sip:cotcot@sip.linphone.org", "sip:miaou@sip.linphone.org", true, false);
CallLog logB = new CallLog("sip:cotcot@sip.linphone.org", "sip:miaou@sip.linphone.org", true, true);
CallLog logC = new CallLog("sip:cotcot@sip.linphone.org", "sip:miaou@sip.linphone.org", false, false);
CallLog logD = new CallLog("sip:cotcot@sip.linphone.org", "sip:miaou@sip.linphone.org", true, true);
CallLog logE = new CallLog("sip:cotcot@sip.linphone.org", "sip:miaou@sip.linphone.org", false, false);
CallLog logF = new CallLog("sip:cotcot@sip.linphone.org", "sip:miaou@sip.linphone.org", false, false);
CallLog logG = new CallLog("sip:cotcot@sip.linphone.org", "sip:miaou@sip.linphone.org", true, true);
CallLog logH = new CallLog("sip:cotcot@sip.linphone.org", "sip:miaou@sip.linphone.org", false, false);
calls.Add(logA);
calls.Add(logB);
calls.Add(logC);
calls.Add(logD);
calls.Add(logE);
calls.Add(logF);
calls.Add(logG);
calls.Add(logH);
missedCalls.Add(logB);
missedCalls.Add(logD);
missedCalls.Add(logG);
CallLogs all = new CallLogs("All", calls);
_history.Add(all);
CallLogs missed = new CallLogs("Missed", missedCalls);
_history.Add(missed);
return _history;
}
/// <summary>
/// Remove one or many entries from the calls' history
/// </summary>
/// <returns>A list of CallLogs, without the removed entries</returns>
public List<CallLogs> RemoveCallLogs(IEnumerable<CallLog> logsToRemove)
{
// When removing log from history, it will be removed from logsToRemove list too.
// Using foreach causing the app to crash on a InvalidOperationException, so we are using while
while (logsToRemove.Count() > 0)
{
CallLog logToRemove = logsToRemove.First();
foreach (CallLogs logs in _history)
{
logs.Calls.Remove(logToRemove);
}
}
return _history;
}
/// <summary>
/// Remove all calls' history from LinphoneCore
/// </summary>
public void ClearCallLogs()
{