SipUriToUsernameConverter.cs 1023 Bytes
Newer Older
1 2 3 4 5
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
6
using Linphone.Core;
7 8 9 10 11 12 13 14 15 16 17 18

namespace Linphone.Model
{
    /// <summary>
    /// Converter returning the AccentColorBrush if the boolean is true, else returning a title color.
    /// </summary>
    public class SipUriToUsernameConverter : IValueConverter
    {
        /// <returns>A SolidColorBrush (PhoneAccentBrush or PhoneSubtleBrush).</returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string sipAddress = (string)value;
19
            LinphoneAddress addr = LinphoneManager.Instance.LinphoneCore.InterpretURL(sipAddress);
20
            return addr.UserName;
21 22 23 24 25 26 27 28 29 30 31
        }

        /// <summary>
        /// Not implemented.
        /// </summary>
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}