Commit 07df8123 authored by Margaux Clerc's avatar Margaux Clerc

Add received message and call missed counter

parent 2c3c47f9
......@@ -97,6 +97,7 @@
<Content Include="Assets\linphonerc-factory" />
<Content Include="Assets\avatar.png" />
<Content Include="Assets\avatar2.png" />
<Content Include="Assets\linphone_user.png" />
<Content Include="Assets\rootca.pem" />
<None Include="project.json" />
</ItemGroup>
......
......@@ -189,6 +189,19 @@ namespace Linphone.Model
}
#endregion
#region Chat
public int GetUnreadMessageCount()
{
int nbUnreadMessages = 0;
foreach(ChatRoom chatroom in Core.ChatRooms)
{
nbUnreadMessages += chatroom.UnreadMessageCount;
}
return nbUnreadMessages;
}
#endregion
private List<CallLogModel> _history;
public List<CallLogModel> GetCallsHistory()
......@@ -327,8 +340,6 @@ namespace Linphone.Model
}
set
{
var toto = AudioRoutingManager.GetDefault().AvailableAudioEndpoints;
var titi = AudioRoutingManager.GetDefault().GetAudioEndpoint();
if (value)
AudioRoutingManager.GetDefault().SetAudioEndpoint(AudioRoutingEndpoint.Speakerphone);
else
......
......@@ -159,7 +159,13 @@
<CommandBar Grid.Row="2" VerticalAlignment="Bottom">
<AppBarButton Icon="Save" Label="Save" Click="save_Click_1"/>
<AppBarButton Icon="Cancel" Label="Cancel" Click="cancel_Click_1" />
<AppBarButton Icon="Emoji" Label="Linphone" Click="linphone_Click_1"/>
<AppBarButton Label="Linphone" Click="linphone_Click_1">
<AppBarButton.Content>
<Grid>
<Image Source="/Assets/linphone_user.png"/>
</Grid>
</AppBarButton.Content>
</AppBarButton>
</CommandBar>
</Grid>
......
......@@ -256,9 +256,39 @@
</Grid>
<CommandBar Grid.Row="3" VerticalAlignment="Bottom">
<AppBarButton Icon="Clock" Label="History" Click="history_Click"/>
<AppBarButton Label="History" Click="history_Click">
<AppBarButton.Content>
<Grid>
<FontIcon FontFamily="Segoe MDL2 Assets"
Glyph="&#xE121;"
FontSize="20"/>
<TextBlock
x:Name="MissedCallText"
Visibility="Collapsed"
Text="{Binding MissedCallCount, Mode = TwoWay}"
HorizontalAlignment="Right"
Style="{StaticResource TextStyle}"
Padding="0,5,12,0"/>
</Grid>
</AppBarButton.Content>
</AppBarButton>
<AppBarButton Icon="Contact" Label="Contacts" Click="contacts_Click"/>
<AppBarButton Icon="Message" Label="Chat" Click="chat_Click"/>
<AppBarButton Label="Chat" Click="chat_Click">
<AppBarButton.Content>
<Grid>
<FontIcon FontFamily="Segoe MDL2 Assets"
Glyph="&#xE8BD;"
FontSize="20"/>
<TextBlock
x:Name="unreadMassageText"
Visibility="Collapsed"
Text="{Binding UnreadMessageCount, Mode = TwoWay}"
HorizontalAlignment="Right"
Style="{StaticResource TextStyle}"
Padding="0,5,12,0"/>
</Grid>
</AppBarButton.Content>
</AppBarButton>
<AppBarButton Icon="Setting" Label="Settings" Click="settings_Click"/>
<CommandBar.SecondaryCommands>
......
......@@ -21,19 +21,76 @@ using System;
using BelledonneCommunications.Linphone.Native;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Input;
using System.ComponentModel;
namespace Linphone.Views
{
public sealed partial class Dialer : Page
public sealed partial class Dialer : Page, INotifyPropertyChanged
{
public Dialer()
{
this.InitializeComponent();
DataContext = this;
ContactsManager contactsManager = ContactsManager.Instance;
}
private int unreadMessageCount;
public int UnreadMessageCount
{
get
{
return unreadMessageCount;
}
set
{
unreadMessageCount = value;
if(unreadMessageCount > 0)
{
unreadMassageText.Visibility = Visibility.Visible;
} else
{
unreadMassageText.Visibility = Visibility.Collapsed;
}
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("UnreadMessageCount"));
}
}
}
private int missedCallCount;
public int MissedCallCount
{
get
{
return missedCallCount;
}
set
{
missedCallCount = value;
if (missedCallCount > 0)
{
MissedCallText.Visibility = Visibility.Visible;
}
else
{
MissedCallText.Visibility = Visibility.Collapsed;
}
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("MissedCallCount"));
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void LogUploadProgressIndication(int offset, int total)
{
/* base.UIDispatcher.BeginInvoke(() =>
......@@ -51,12 +108,25 @@ namespace Linphone.Views
status.RefreshStatus();
}
private void MessageReceived(object sender, EventArgs e)
{
UnreadMessageCount = LinphoneManager.Instance.GetUnreadMessageCount();
}
private void CallStateChanged(object sender, EventArgs e)
{
MissedCallCount = LinphoneManager.Instance.Core.MissedCallsCount;
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
LinphoneManager.Instance.CoreDispatcher = Dispatcher;
LinphoneManager.Instance.RegistrationChanged += RegistrationChanged;
LinphoneManager.Instance.MessagReceived += MessageReceived;
LinphoneManager.Instance.CallStateChanged += CallStateChanged;
status.RefreshStatus();
/* if (e.NavigationMode == NavigationMode.New)
{
......@@ -108,6 +178,11 @@ namespace Linphone.Views
String uri = call.RemoteAddress.AsStringUriOnly();
Frame.Navigate(typeof(Views.InCall), uri);
}
if(LinphoneManager.Instance.GetUnreadMessageCount() > 0)
{
UnreadMessageCount = LinphoneManager.Instance.GetUnreadMessageCount();
}
}
protected override void OnNavigatedFrom(NavigationEventArgs nee)
......
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