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

Comments for public UI methods and classes

parent 67780856
......@@ -11,6 +11,9 @@ namespace Linphone.Agents
{
}
/// <summary>
/// Called when the first call has started.
/// </summary>
protected override void OnFirstCallStarting()
{
Debug.WriteLine("[LinphoneCallInProgressAgent] The first call has started.");
......@@ -18,6 +21,9 @@ namespace Linphone.Agents
Globals.Instance.StartServer(RegistrationHelper.OutOfProcServerClassNames);
}
/// <summary>
/// Called when the last call has ended.
/// </summary>
protected override void OnCancel()
{
Debug.WriteLine("[LinphoneCallInProgressAgent] The last call has ended. Calling NotifyComplete");
......
......@@ -13,6 +13,9 @@ namespace Linphone.Agents
}
/// <summary>
/// Called when the app is in foreground (when it starts or when it's resumed)
/// </summary>
protected override void OnLaunched()
{
Debug.WriteLine("[LinphoneForegroundLifeTimeAgent] The UI has entered the foreground.");
......@@ -20,6 +23,9 @@ namespace Linphone.Agents
Globals.Instance.StartServer(RegistrationHelper.OutOfProcServerClassNames);
}
/// <summary>
/// Called when the app is in background
/// </summary>
protected override void OnCancel()
{
Debug.WriteLine("[LinphoneForegroundLifeTimeAgent] The UI is leaving the foreground");
......
......@@ -6,6 +6,8 @@ using System.Diagnostics;
using System.IO;
using System.Xml.Serialization;
using System;
using System.Linq;
using System.Xml.Linq;
namespace Linphone.Agents
{
......@@ -32,11 +34,17 @@ namespace Linphone.Agents
String message = System.Text.Encoding.UTF8.GetString(incomingCallTask.MessageBody, 0, incomingCallTask.MessageBody.Length);
Debug.WriteLine("[LinphoneScheduledAgent] Received VoIP Incoming Call task with body {0}", message);
//TODO Parse the the incoming push notification message
XDocument doc = XDocument.Parse(message);
String callerName = "", callerNumber = "";
var incomingCallPN = from prop in doc.Descendants("IncomingCall") select prop.Element("Name").Value;
callerName = incomingCallPN.First().ToString();
incomingCallPN = from prop in doc.Descendants("IncomingCall") select prop.Element("Number").Value;
callerNumber = incomingCallPN.First().ToString();
Debug.WriteLine("[{0}] Incoming call from caller {1}, number {2}", "KeepAliveAgent", callerName, callerNumber);
bool incomingCallProcessingStarted = Globals.Instance.CallController.OnIncomingCallReceived(callerName, "+33609668573", this.OnIncomingCallViewDismissed);
bool incomingCallProcessingStarted = Globals.Instance.CallController.OnIncomingCallReceived(callerName, callerNumber, this.OnIncomingCallViewDismissed);
if (!incomingCallProcessingStarted)
{
......@@ -60,6 +68,9 @@ namespace Linphone.Agents
}
}
/// <summary>
/// Called when the incoming call view is dismissed, either by accepting or denying the call
/// </summary>
private void OnIncomingCallViewDismissed()
{
Debug.WriteLine("[IncomingCallAgent] Incoming call processing is now complete.");
......
No preview for this file type
......@@ -15,6 +15,9 @@ using Microsoft.Phone.Networking.Voip;
namespace Linphone
{
/// <summary>
/// Root frame for the application.
/// </summary>
public partial class App : Application
{
/// <summary>
......@@ -170,6 +173,9 @@ namespace Linphone
private const string incomingCallTaskName = "Linphone.IncomingCallTask";
/// <summary>
/// Starts the push notification task.
/// </summary>
public void InitHttpNotificationTask()
{
// Obtain a reference to the existing task, if any.
......@@ -195,6 +201,9 @@ namespace Linphone
private const string keepAliveTaskName = "Linphone.KeepAliveTask";
/// <summary>
/// Starts the keep alive task agent
/// </summary>
public void InitKeepAliveTask()
{
// Obtain a reference to the existing task, if any.
......
......@@ -10,15 +10,29 @@ using System.Windows.Navigation;
namespace Linphone
{
/// <summary>
/// Model view for each page implementing the call controller listener to adjust displayed page depending on call events.
/// </summary>
public class BaseModel : CallControllerListener
{
/// <summary>
/// Public constructor.
/// </summary>
public BaseModel()
{
}
/// <summary>
/// Page currently displayed.
/// </summary>
public BasePage Page { get; set; }
/// <summary>
/// Called when a call is starting.
/// Displays the InCall.xaml page.
/// </summary>
/// <param name="callerNumber"></param>
public void NewCallStarted(string callerNumber)
{
this.Page.Dispatcher.BeginInvoke(() =>
......@@ -27,6 +41,10 @@ namespace Linphone
});
}
/// <summary>
/// Called when a call is finished.
/// Goes back to the last page if possible, else displays Dialer.xaml.
/// </summary>
public void CallEnded()
{
this.Page.Dispatcher.BeginInvoke(() =>
......@@ -43,11 +61,19 @@ namespace Linphone
});
}
/// <summary>
/// Actualises the listener when the pages changes.
/// </summary>
/// <param name="nea"></param>
public virtual void OnNavigatedTo(NavigationEventArgs nea)
{
LinphoneManager.Instance.CallController.SetCallControllerListener(this);
}
/// <summary>
/// Actualises the listener when the pages changes.
/// </summary>
/// <param name="nea"></param>
public virtual void OnNavigatedFrom(NavigationEventArgs nea)
{
LinphoneManager.Instance.CallController.SetCallControllerListener(null);
......
......@@ -9,14 +9,23 @@ using System.Windows.Navigation;
namespace Linphone
{
/// <summary>
/// Base Phone Application Page for every Page in the application that need to be call event aware.
/// </summary>
public class BasePage: PhoneApplicationPage
{
/// <summary>
/// Public constructor.
/// </summary>
protected BasePage()
: this(new BaseModel())
{
}
/// <summary>
/// Public constructor.
/// </summary>
protected BasePage(BaseModel viewModel)
{
this.ViewModel = viewModel;
......@@ -24,13 +33,22 @@ namespace Linphone
this.Loaded += BasePage_Loaded;
}
/// <summary>
/// View model linked to the page, implements the call state listener.
/// </summary>
protected readonly BaseModel ViewModel;
/// <summary>
/// Bind the view model to the page when it's been loaded.
/// </summary>
protected virtual void BasePage_Loaded(object sender, RoutedEventArgs e)
{
this.DataContext = ViewModel;
}
/// <summary>
/// Forwards the OnNavigatedTo event to the model
/// </summary>
protected override void OnNavigatedTo(NavigationEventArgs nee)
{
base.OnNavigatedTo(nee);
......@@ -38,6 +56,9 @@ namespace Linphone
this.ViewModel.OnNavigatedTo(nee);
}
/// <summary>
/// Forwards the OnNavigatedFrom event to the model
/// </summary>
protected override void OnNavigatedFrom(NavigationEventArgs nee)
{
base.OnNavigatedFrom(nee);
......
......@@ -12,14 +12,23 @@ using System.Windows.Media.Imaging;
namespace Linphone.Controls
{
/// <summary>
/// Custom control representing a textbox that contains a SIP address
/// </summary>
public partial class AddressBox : UserControl
{
/// <summary>
/// String content of the textbox.
/// </summary>
public String Text
{
get { return address.Text; }
set { address.Text = value; }
}
/// <summary>
/// Public constructor.
/// </summary>
public AddressBox()
{
InitializeComponent();
......
......@@ -11,9 +11,15 @@ using System.Windows.Media.Imaging;
namespace Linphone.Controls
{
/// <summary>
/// Custom user control representing a possible action on a phone number or email (in the Contact.xaml view).
/// </summary>
public partial class ContactAction : UserControl
{
private String _action;
/// <summary>
/// URI of an Image that represents the action.
/// </summary>
public String Action
{
get
......@@ -28,6 +34,9 @@ namespace Linphone.Controls
}
private String _label;
/// <summary>
/// Label of the phone number or the email displayed.
/// </summary>
public String Label
{
get
......@@ -42,6 +51,9 @@ namespace Linphone.Controls
}
private String _numberOrAddress;
/// <summary>
/// Phone number or email address to display.
/// </summary>
public String NumberOrAddress
{
get
......@@ -55,6 +67,9 @@ namespace Linphone.Controls
}
}
/// <summary>
/// Event triggered when action image is clicked.
/// </summary>
public RoutedEventHandler Click
{
set
......@@ -65,6 +80,9 @@ namespace Linphone.Controls
get { return null; }
}
/// <summary>
/// Public constructor.
/// </summary>
public ContactAction()
{
InitializeComponent();
......
......@@ -12,30 +12,54 @@ using System.Windows.Input;
namespace Linphone.Controls
{
/// <summary>
/// Custom control to represent a Digit in the numpad.
/// </summary>
public partial class Digit : UserControl
{
/// <summary>
/// Dependency property for the idle image.
/// </summary>
public static readonly DependencyProperty DefaultImageProperty = DependencyProperty.Register("DefaultImage", typeof(String), typeof(Digit), new PropertyMetadata(""));
/// <summary>
/// Dependency property for the pressed image.
/// </summary>
public static readonly DependencyProperty OverImageProperty = DependencyProperty.Register("OverImage", typeof(String), typeof(Digit), new PropertyMetadata(""));
/// <summary>
/// Dependency property for the numpad host.
/// </summary>
public static readonly DependencyProperty NumpadProperty = DependencyProperty.Register("Numpad", typeof(Numpad), typeof(Digit), new PropertyMetadata(null));
/// <summary>
/// Idle image for the digit.
/// </summary>
public String DefaultImage
{
get { return (String)GetValue(DefaultImageProperty); }
set { SetValue(DefaultImageProperty, value); }
}
/// <summary>
/// Image to display when the digit is pressed.
/// </summary>
public String OverImage
{
get { return (String)GetValue(OverImageProperty); }
set { SetValue(OverImageProperty, value); }
}
/// <summary>
/// Numpad in which the digit is displayed.
/// </summary>
public Numpad Numpad
{
get { return (Numpad)GetValue(NumpadProperty); }
set { SetValue(NumpadProperty, value); }
}
/// <summary>
/// Public constructor.
/// </summary>
public Digit()
{
InitializeComponent();
......
......@@ -13,16 +13,28 @@ using System.Windows.Input;
namespace Linphone.Controls
{
/// <summary>
/// Custom control to represent a numpad (composed of Digits and an AddressBox).
/// </summary>
public partial class Numpad : UserControl
{
/// <summary>
/// Dependency property for the AddressBox.
/// </summary>
public static readonly DependencyProperty AddressProperty = DependencyProperty.Register("Address", typeof(AddressBox), typeof(Numpad), new PropertyMetadata(new AddressBox()));
/// <summary>
/// AddressBox (custom control) in which to append the clicked digits.
/// </summary>
public AddressBox Address
{
get { return (AddressBox)GetValue(AddressProperty); }
set { SetValue(AddressProperty, value); }
}
/// <summary>
/// Public constructor.
/// </summary>
public Numpad()
{
InitializeComponent();
......@@ -46,6 +58,11 @@ namespace Linphone.Controls
sharp.Numpad = this;
}
/// <summary>
/// Event triggered when a Digit is pressed and released.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void digit_Click_1(object sender, RoutedEventArgs e)
{
Digit button = (sender as Digit);
......
......@@ -12,29 +12,50 @@ using System.Windows.Input;
namespace Linphone.Controls
{
/// <summary>
/// Custom control to represent a two state button where each state is an image.
/// </summary>
public partial class TwoStateButton : UserControl
{
/// <summary>
/// Dependency property for the idle image.
/// </summary>
public static readonly DependencyProperty DefaultImageProperty = DependencyProperty.Register("DefaultImage", typeof(String), typeof(TwoStateButton), new PropertyMetadata(""));
/// <summary>
/// Dependency property for the pressed image.
/// </summary>
public static readonly DependencyProperty OverImageProperty = DependencyProperty.Register("OverImage", typeof(String), typeof(TwoStateButton), new PropertyMetadata(""));
/// <summary>
/// Image displayed while the button is in idle state.
/// </summary>
public String DefaultImage
{
get { return (String)GetValue(DefaultImageProperty); }
set { SetValue(DefaultImageProperty, value); }
}
/// <summary>
/// Image displayed while the button is pressed.
/// </summary>
public String OverImage
{
get { return (String)GetValue(OverImageProperty); }
set { SetValue(OverImageProperty, value); }
}
/// <summary>
/// Event triggered when the button is clicked.
/// </summary>
public RoutedEventHandler Click
{
set { button.Click += value; }
get { return null; }
}
/// <summary>
/// Public constructor.
/// </summary>
public TwoStateButton()
{
InitializeComponent();
......
......@@ -9,6 +9,9 @@ namespace Linphone
{
private static AppResources _localizedResources = new AppResources();
/// <summary>
/// Provides easy access to localized resources.
/// </summary>
public AppResources LocalizedResources { get { return _localizedResources; } }
}
}
\ No newline at end of file
......@@ -21,7 +21,7 @@ namespace Linphone.Model
public delegate string GetKeyDelegate(T item);
/// <summary>
/// The Key of this group.
/// The Key for this group.
/// </summary>
public string Key { get; private set; }
......@@ -37,7 +37,6 @@ namespace Linphone.Model
/// <summary>
/// Create a list of AlphaGroup<T> with keys set by a SortedLocaleGrouping.
/// </summary>
/// <param name="slg">The </param>
/// <returns>Theitems source for a LongListSelector</returns>
private static List<AlphaKeyGroup<T>> CreateGroups(SortedLocaleGrouping slg)
{
......@@ -67,13 +66,7 @@ namespace Linphone.Model
foreach (T item in items)
{
int index = 0;
if (slg.SupportsPhonetics)
{
//check if your database has yomi string for item
//if it does not, then do you want to generate Yomi or ask the user for this item.
//index = slg.GetGroupIndex(getKey(Yomiof(item)));
}
else
if (!slg.SupportsPhonetics)
{
index = slg.GetGroupIndex(getKey(item));
}
......
......@@ -8,9 +8,15 @@ using System.Windows.Media.Imaging;
namespace Linphone.Model
{
/// <summary>
/// Object that represents a list of call logs.
/// </summary>
public class CallLogs
{
private String _title;
/// <summary>
/// Title for this list of call logs, will be displayed as header in the pivot control.
/// </summary>
public String Title
{
get
......@@ -23,8 +29,14 @@ namespace Linphone.Model
}
}
/// <summary>
/// List of callLogs.
/// </summary>
public ObservableCollection<CallLog> Calls { get; set; }
/// <summary>
/// Public constructor.
/// </summary>
public CallLogs(String title, ObservableCollection<CallLog> calls)
{
_title = title;
......@@ -32,6 +44,10 @@ namespace Linphone.Model
}
}
/// <summary>
/// Object representing a call log.
/// Keeps a reference to a C++/CX CallLog object and provides some useful methods.
/// </summary>
public class CallLog
{
private static BitmapImage _incomingIcon = new BitmapImage(new Uri("/Assets/call_status_incoming.png", UriKind.Relative));
......@@ -39,6 +55,9 @@ namespace Linphone.Model
private static BitmapImage _missedIcon = new BitmapImage(new Uri("/Assets/call_status_missed.png", UriKind.Relative));
private Object _nativeLog;
/// <summary>
/// C++/CX call log object.
/// </summary>
public Object NativeLog
{
get
......@@ -52,6 +71,9 @@ namespace Linphone.Model
}
private String _from;
/// <summary>
/// Call initiator name or address.
/// </summary>
public String From
{
get
......@@ -65,6 +87,9 @@ namespace Linphone.Model
}
private String _to;
/// <summary>
/// Call receiver name or address.
/// </summary>
public String To
{
get
......@@ -78,6 +103,9 @@ namespace Linphone.Model
}
private bool _isIncoming;
/// <summary>
/// For the user, has the call been outgoing or incoming.
/// </summary>
public bool IsIncoming
{
get
......@@ -91,6 +119,9 @@ namespace Linphone.Model
}
private bool _isMissed;
/// <summary>
/// Indicated whether or not the call has been missed by the user.
/// </summary>
public bool IsMissed
{
get
......@@ -102,7 +133,10 @@ namespace Linphone.Model
_isMissed = value;
}
}
/// <summary>
/// Returns a BitmapImage representing the status of the call (incoming, outgoing or missed).
/// </summary>
public BitmapImage StatusIcon
{
get
......@@ -119,6 +153,9 @@ namespace Linphone.Model
}
}
/// <summary>
/// Named displayed for the caller/callee.
/// </summary>
public String DisplayedName
{
get
......@@ -130,6 +167,9 @@ namespace Linphone.Model
}
}
/// <summary>
/// Public constructor.
/// </summary>
public CallLog(Object nativeLog, String from, String to, bool isIncoming, bool isMissed)
{
_nativeLog = nativeLog;
......
......@@ -8,11 +8,29 @@ using System.Threading.Tasks;
namespace Linphone.Model
{
/// <summary>
/// Param object for contact found event listener.
/// </summary>
public class ContactFoundEventArgs : EventArgs
{
/// <summary>
/// Contact found if actually found.
/// </summary>
public Contact ContactFound;
/// <summary>
/// Phone number used to find this contact.
/// </summary>
public String PhoneNumber;
/// <summary>
/// Phone label associated to the phone number.
/// </summary>
public String PhoneLabel;
/// <summary>
/// Public constructor.
/// </summary>
public ContactFoundEventArgs(Contact contact, String number, String label = null)
{
ContactFound = contact;
......@@ -21,9 +39,15 @@ namespace Linphone.Model
}
}
/// <summary>
/// Utility class used to handle every contact related requests.
/// </summary>
public class ContactManager
{
private static ContactManager singleton;
/// <summary>
/// Static instance for this class.
/// </summary>
public static ContactManager Instance
{
get
......@@ -37,11 +61,26 @@ namespace Linphone.Model
private List<AlphaKeyGroup<Contact>> _contacts;
private String tempNumberForContactLookup;
/// <summary>
/// Represents the selected contact clicked on by the user.
/// We keep it here to avoid giving it as param when navigating from Contacts.xaml to Contact.xaml
/// </summary>
public Contact TempContact;
/// <summary>
/// Delegate for contact found event.
/// </summary>
public delegate void ContactFoundEventHandler(object sender, ContactFoundEventArgs e);
/// <summary>
/// Handler for contact found event.
/// </summary>
public event ContactFoundEventHandler ContactFound;
/// <summary>
/// Public constructor.
/// </summary>
public ContactManager()
{
Microsoft.Phone.UserData.Contacts contacts = new Microsoft.Phone.UserData.Contacts();
......@@ -114,9 +153,9 @@ namespace Linphone.Model
}
/// <summary>
/// Searches if a there is a contact for whom the phone number is stored
/// Searches if a there is a contact for whom the email is stored
/// </summary>
/// <param name="number">phone number to use to filter the contacts</param>
/// <param name="email">email to use to filter the contacts</param>
private void FindContactByEmail(String email)
{
Microsoft.Phone.UserData.Contacts contacts = new Microsoft.Phone.UserData.Contacts();
......
......@@ -14,6 +14,9 @@ namespace Linphone.Model
/// </summary>
public class ContactPictureConverter : System.Windows.Data.IValueConverter
{
/// <summary>
/// Converts the picture of a contact (an ImageStream) into an Image object.
/// </summary>
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
Contact c = value as Contact;
......@@ -27,6 +30,9 @@ namespace Linphone.Model
return null;
}
/// <summary>
/// Not implemented (not needed).
/// </summary>
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
......
......@@ -15,9 +15,15 @@ using Windows.Phone.Networking.Voip;
namespace Linphone.Model
{
/// <summary>
/// Utility class to handle most of the LinphoneCore (and more globally the C++/CX API) methods calls.
/// </summary>
public sealed class LinphoneManager : LinphoneCoreListener
{
private static LinphoneManager singleton;
/// <summary>
/// Static instance of the class.
/// </summary>
public static LinphoneManager Instance
{
get
......@@ -29,6 +35,9 @@ namespace Linphone.Model
}
}
/// <summary>
/// Quick accessor for the LinphoneCore object through the OoP server.
/// </summary>
public LinphoneCore LinphoneCore
{
get
......@@ -37,6 +46,9 @@ namespace Linphone.Model
}
}
/// <summary>
/// Quick accessor for the CallController object through the OoP server.