Commit 0e14c708 authored by Sylvain Berfini's avatar Sylvain Berfini

Various fixes

parent e75fc31a
......@@ -44,8 +44,6 @@
BorderThickness="0"
Margin="-10"
Click="speaker_Click_1"
IsChecked="{Binding SpeakerButtonToggled}"
Visibility="{Binding SpeakerButtonVisibility}"
Background="{StaticResource PhoneChromeBrush}">
<StackPanel Orientation="Vertical">
<Image x:Name="speakerImg" Source="/Assets/AppBar/speaker.png" Stretch="None"/>
......@@ -61,8 +59,6 @@
Margin="-10"
Click="microphone_Click_1"
IsEnabled="False"
IsChecked="{Binding MuteButtonToggled}"
Visibility="{Binding MicrophoneButtonVisibility}"
Background="{StaticResource PhoneChromeBrush}">
<StackPanel Orientation="Vertical">
<Image x:Name="microImg" Source="/Assets/AppBar/mic.png" Stretch="None"/>
......@@ -78,8 +74,6 @@
Margin="-10"
Click="pause_Click_1"
IsEnabled="False"
IsChecked="{Binding PauseButtonToggled}"
Visibility="{Binding PauseButtonVisibility}"
Background="{StaticResource PhoneChromeBrush}">
<StackPanel Orientation="Vertical">
<Image x:Name="pauseImg" Source="/Assets/AppBar/pause.png" Stretch="None"/>
......@@ -94,8 +88,6 @@
BorderThickness="0"
Margin="-10"
Click="stats_Click_1"
IsChecked="{Binding StatsButtonToggled}"
Visibility="{Binding StatsButtonVisibility}"
Background="{StaticResource PhoneChromeBrush}">
<StackPanel Orientation="Vertical">
<Image x:Name="statsImg" Source="/Assets/AppBar/stats.png" Stretch="None"/>
......@@ -111,7 +103,6 @@
Margin="-10"
Click="video_Click_1"
IsEnabled="False"
IsChecked="{Binding VideoButtonToggled}"
Visibility="{Binding VideoButtonVisibility}"
Background="{StaticResource PhoneChromeBrush}">
<StackPanel Orientation="Vertical">
......@@ -141,8 +132,7 @@
BorderThickness="0"
Margin="-10"
Click="dialpad_Click_1"
Background="{StaticResource PhoneChromeBrush}"
IsChecked="{Binding DialpadButtonToggled}">
Background="{StaticResource PhoneChromeBrush}">
<Image Source="/Assets/AppBar/dialpad.png" Stretch="None"/>
</ToggleButton>
......@@ -153,10 +143,10 @@
Grid.RowSpan="2"
Grid.Column="3"
Grid.ColumnSpan="3"
Visibility="{Binding NumpadVisibility}"/>
Visibility="Collapsed"/>
<!-- Statistics panel -->
<Grid Background="{StaticResource PhoneChromeBrush}" Grid.Row="0" Grid.RowSpan="2" Grid.Column="3" Grid.ColumnSpan="3" Visibility="{Binding StatsPanelVisibility}">
<Grid x:Name="statsPanel" Background="{StaticResource PhoneChromeBrush}" Grid.Row="0" Grid.RowSpan="2" Grid.Column="3" Grid.ColumnSpan="3" Visibility="Collapsed">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
......
......@@ -44,8 +44,7 @@
BorderThickness="0"
Margin="-10"
Click="dialpad_Click_1"
Background="{StaticResource PhoneChromeBrush}"
IsChecked="{Binding DialpadButtonToggled}">
Background="{StaticResource PhoneChromeBrush}">
<Image Source="/Assets/AppBar/dialpad.png" Stretch="None"/>
</ToggleButton>
......@@ -56,8 +55,6 @@
BorderThickness="0"
Margin="-10"
Click="speaker_Click_1"
IsChecked="{Binding SpeakerButtonToggled}"
Visibility="{Binding SpeakerButtonVisibility}"
Background="{StaticResource PhoneChromeBrush}">
<StackPanel Orientation="Vertical">
<Image x:Name="speakerImg" Source="/Assets/AppBar/speaker.png" Stretch="None"/>
......@@ -73,8 +70,6 @@
Margin="-10"
Click="microphone_Click_1"
IsEnabled="False"
IsChecked="{Binding MuteButtonToggled}"
Visibility="{Binding MicrophoneButtonVisibility}"
Background="{StaticResource PhoneChromeBrush}">
<StackPanel Orientation="Vertical">
<Image x:Name="microImg" Source="/Assets/AppBar/mic.png" Stretch="None"/>
......@@ -90,8 +85,6 @@
Margin="-10"
Click="pause_Click_1"
IsEnabled="False"
IsChecked="{Binding PauseButtonToggled}"
Visibility="{Binding PauseButtonVisibility}"
Background="{StaticResource PhoneChromeBrush}">
<StackPanel Orientation="Vertical">
<Image x:Name="pauseImg" Source="/Assets/AppBar/pause.png" Stretch="None"/>
......@@ -106,8 +99,6 @@
BorderThickness="0"
Margin="-10"
Click="stats_Click_1"
IsChecked="{Binding StatsButtonToggled}"
Visibility="{Binding StatsButtonVisibility}"
Background="{StaticResource PhoneChromeBrush}">
<StackPanel Orientation="Vertical">
<Image x:Name="statsImg" Source="/Assets/AppBar/stats.png" Stretch="None"/>
......@@ -152,10 +143,10 @@
Grid.Row="1"
Grid.RowSpan="2"
Grid.ColumnSpan="3"
Visibility="{Binding NumpadVisibility}"/>
Visibility="Collapsed"/>
<!-- Statistics panel -->
<Grid Background="{StaticResource PhoneChromeBrush}" Grid.Row="0" Grid.RowSpan="2" Grid.ColumnSpan="3" Visibility="{Binding StatsPanelVisibility}">
<Grid x:Name="statsPanel" Background="{StaticResource PhoneChromeBrush}" Grid.Row="0" Grid.RowSpan="2" Grid.ColumnSpan="3" Visibility="Collapsed">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
......
......@@ -69,14 +69,6 @@ namespace Linphone.Views
{
LinphoneManager.Instance.ToggleCameras();
ShowLocalVideo();
}
/// <summary>
/// Changes the visibility of the stats panel
/// </summary>
public void ChangeStatsVisibility(bool areStatsVisible)
{
StatsPanelVisibility = areStatsVisible ? Visibility.Visible : Visibility.Collapsed;
}
private void ShowRemoteVideo()
......@@ -161,101 +153,6 @@ namespace Linphone.Views
#endregion
#region Button properties
/// <summary>
/// Visibility of the numeric pad.
/// </summary>
public Visibility NumpadVisibility
{
get
{
return this.numpadVisibility;
}
set
{
if (this.numpadVisibility != value)
{
this.numpadVisibility = value;
this.OnPropertyChanged();
}
}
}
/// <summary>
/// Visibility of the pause button.
/// </summary>
public Visibility PauseButtonVisibility
{
get
{
return this.pauseButtonVisibility;
}
set
{
if (this.pauseButtonVisibility != value)
{
this.pauseButtonVisibility = value;
this.OnPropertyChanged();
}
}
}
/// <summary>
/// Visibility of the microphone button.
/// </summary>
public Visibility MicrophoneButtonVisibility
{
get
{
return this.microphoneButtonVisibility;
}
set
{
if (this.microphoneButtonVisibility != value)
{
this.microphoneButtonVisibility = value;
this.OnPropertyChanged();
}
}
}
/// <summary>
/// Visibility of the speaker button.
/// </summary>
public Visibility SpeakerButtonVisibility
{
get
{
return this.speakerButtonVisibility;
}
set
{
if (this.speakerButtonVisibility != value)
{
this.speakerButtonVisibility = value;
this.OnPropertyChanged();
}
}
}
/// <summary>
/// Visibility of the statistics button.
/// </summary>
public Visibility StatsButtonVisibility
{
get
{
return this.statsButtonVisibility;
}
set
{
if (this.statsButtonVisibility != value)
{
this.statsButtonVisibility = value;
this.OnPropertyChanged();
}
}
}
/// <summary>
/// Visibility of the video button.
/// </summary>
......@@ -330,143 +227,10 @@ namespace Linphone.Views
this.OnPropertyChanged();
}
}
}
/// <summary>
/// Visibility of the landscape buttons.
/// </summary>
public Visibility StatsPanelVisibility
{
get
{
return this.statsPanelVisibility;
}
set
{
if (this.statsPanelVisibility != value)
{
this.statsPanelVisibility = value;
this.OnPropertyChanged();
}
}
}
/// <summary>
/// Checked state of the stats button
/// </summary>
public bool StatsButtonToggled
{
get
{
return this.isStatsToggled;
}
set
{
if (this.isStatsToggled != value)
{
this.isStatsToggled = value;
this.OnPropertyChanged();
}
}
}
/// <summary>
/// Checked state of the speaker button
/// </summary>
public bool SpeakerButtonToggled
{
get
{
return this.isSpeakerToggled;
}
set
{
if (this.isSpeakerToggled != value)
{
this.isSpeakerToggled = value;
this.OnPropertyChanged();
}
}
}
/// <summary>
/// Checked state of the mute button
/// </summary>
public bool MuteButtonToggled
{
get
{
return this.isMuteToggled;
}
set
{
if (this.isMuteToggled != value)
{
this.isMuteToggled = value;
this.OnPropertyChanged();
}
}
}
/// <summary>
/// Checked state of the pause button
/// </summary>
public bool PauseButtonToggled
{
get
{
return this.isPauseToggled;
}
set
{
if (this.isPauseToggled != value)
{
this.isPauseToggled = value;
this.OnPropertyChanged();
}
}
}
/// <summary>
/// Checked state of the numpad button
/// </summary>
public bool DialpadButtonToggled
{
get
{
return this.isDialpadToggled;
}
set
{
if (this.isDialpadToggled != value)
{
this.isDialpadToggled = value;
this.OnPropertyChanged();
}
}
}
#endregion
#region Video properties
/// <summary>
/// Checked state of the video button
/// </summary>
public bool VideoButtonToggled
{
get
{
return this.isVideoToggled;
}
set
{
if (this.isVideoToggled != value)
{
this.isVideoToggled = value;
this.OnPropertyChanged();
}
}
}
#region Video properties
/// <summary>
/// Is the video active (Boolean).
/// </summary>
......@@ -725,17 +489,10 @@ namespace Linphone.Views
}
#endregion
#region Private variables
private Visibility numpadVisibility = Visibility.Collapsed;
private Visibility pauseButtonVisibility = Visibility.Visible;
private Visibility microphoneButtonVisibility = Visibility.Visible;
private Visibility speakerButtonVisibility = Visibility.Visible;
private Visibility statsButtonVisibility = Visibility.Visible;
private Visibility videoButtonVisibility = Visibility.Collapsed;
private Visibility cameraButtonVisibility = Visibility.Collapsed;
private Visibility portraitButtonsVisibility = Visibility.Visible;
private Visibility landscapeButtonsVisibility = Visibility.Collapsed;
private Visibility statsPanelVisibility = Visibility.Collapsed;
private Visibility landscapeButtonsVisibility = Visibility.Collapsed;
private Boolean isVideoActive = false;
private Uri remoteVideoUri = null;
private Visibility remoteVideoVisibility = Visibility.Collapsed;
......@@ -744,12 +501,6 @@ namespace Linphone.Views
private Visibility localVideoVisibility = Visibility.Collapsed;
private Double localVideoRotation = 0;
private Double localVideoScaleX = 1.0;
private bool isStatsToggled = false;
private bool isMuteToggled = false;
private bool isSpeakerToggled = false;
private bool isDialpadToggled = false;
private bool isPauseToggled = false;
private bool isVideoToggled = false;
private string mediaEncryption = "";
private string audioDownBw = "";
private string audioPType = "";
......
......@@ -70,7 +70,7 @@ namespace Linphone.Views
/// <summary>
/// Method called when the page is displayed.
/// </summary>
protected override async void OnNavigatedTo(NavigationEventArgs e)
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
// Create LinphoneCore if not created yet, otherwise do nothing
......
......@@ -102,7 +102,7 @@ namespace Linphone.Views
/// <summary>
/// Method called when the page is displayed.
/// </summary>
protected override async void OnNavigatedTo(NavigationEventArgs e)
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
saveSettingsOnLeave = true;
......
......@@ -44,7 +44,7 @@ namespace Linphone.Views
/// <summary>
/// Method called when the page is displayed.
/// </summary>
protected override async void OnNavigatedTo(NavigationEventArgs e)
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
LinphoneManager.Instance.ECListener = this;
......
......@@ -88,7 +88,7 @@ namespace Linphone.Views
/// Method called when the page is displayed.
/// Check if the uri contains a sip address, if yes, it displays the matching chat history.
/// </summary>
protected override async void OnNavigatedTo(NavigationEventArgs e)
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
LinphoneManager.Instance.MessageListener = this;
......
......@@ -40,7 +40,7 @@ namespace Linphone
/// Method called when the page is displayed.
/// Check if the uri contains a sip address, if yes, it starts a call to this address.
/// </summary>
protected override async void OnNavigatedTo(NavigationEventArgs e)
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
......
......@@ -30,7 +30,7 @@ namespace Linphone.Views
/// <summary>
/// Method called when the page is displayed.
/// </summary>
protected override async void OnNavigatedTo(NavigationEventArgs e)
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
......
......@@ -35,7 +35,7 @@ namespace Linphone.Views
/// Fetches the logs from the LinphoneManager and displays them.
/// </summary>
/// <param name="e"></param>
protected override async void OnNavigatedTo(NavigationEventArgs e)
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
......
......@@ -65,28 +65,34 @@ namespace Linphone.Views
private void buttons_DialpadClick(object sender, bool isDialpadShown)
{
((InCallModel)ViewModel).DialpadButtonToggled = isDialpadShown;
((InCallModel)ViewModel).NumpadVisibility = isDialpadShown ? Visibility.Visible : Visibility.Collapsed;
buttons.dialpad.IsChecked = isDialpadShown;
buttons_landscape.dialpad.IsChecked = isDialpadShown;
buttons.numpad.Visibility = isDialpadShown ? Visibility.Visible : Visibility.Collapsed;
buttons_landscape.numpad.Visibility = isDialpadShown ? Visibility.Visible : Visibility.Collapsed;
}
private void buttons_VideoClick(object sender, bool isVideoOn)
{
((InCallModel)ViewModel).VideoButtonToggled = isVideoOn;
buttons.video.IsChecked = isVideoOn;
buttons_landscape.video.IsChecked = isVideoOn;
if (!LinphoneManager.Instance.EnableVideo(isVideoOn))
{
((InCallModel)ViewModel).VideoButtonToggled = !isVideoOn;
buttons.video.IsChecked = !isVideoOn;
buttons_landscape.video.IsChecked = !isVideoOn;
}
}
private void buttons_MuteClick(object sender, bool isMuteOn)
{
((InCallModel)ViewModel).MuteButtonToggled = isMuteOn;
buttons.microphone.IsChecked = isMuteOn;
buttons_landscape.microphone.IsChecked = isMuteOn;
LinphoneManager.Instance.MuteMic(isMuteOn);
}
private bool buttons_SpeakerClick(object sender, bool isSpeakerOn)
{
((InCallModel)ViewModel).SpeakerButtonToggled = isSpeakerOn;
buttons.speaker.IsChecked = isSpeakerOn;
buttons_landscape.speaker.IsChecked = isSpeakerOn;
try
{
LinphoneManager.Instance.EnableSpeaker(isSpeakerOn);
......@@ -95,14 +101,16 @@ namespace Linphone.Views
catch
{
Logger.Warn("Exception while trying to toggle speaker to {0}", isSpeakerOn.ToString());
((InCallModel)ViewModel).SpeakerButtonToggled = !isSpeakerOn;
buttons.speaker.IsChecked = isSpeakerOn;
buttons_landscape.speaker.IsChecked = isSpeakerOn;
}
return false;
}
private void buttons_PauseClick(object sender, bool isPaused)
{
((InCallModel)ViewModel).PauseButtonToggled = isPaused;
buttons.pause.IsChecked = isPaused;
buttons_landscape.pause.IsChecked = isPaused;
buttons.pauseImg.Source = new BitmapImage(new Uri(isPaused ? pauseOn : pauseOff, UriKind.RelativeOrAbsolute));
buttons_landscape.pauseImg.Source = new BitmapImage(new Uri(isPaused ? pauseOn : pauseOff, UriKind.RelativeOrAbsolute));
......@@ -119,8 +127,10 @@ namespace Linphone.Views
private void buttons_StatsClick(object sender, bool areStatsVisible)
{
((InCallModel)ViewModel).StatsButtonToggled = areStatsVisible;
((InCallModel)ViewModel).ChangeStatsVisibility(areStatsVisible);
buttons.stats.IsChecked = areStatsVisible;
buttons_landscape.stats.IsChecked = areStatsVisible;
buttons.statsPanel.Visibility = areStatsVisible ? Visibility.Visible : Visibility.Collapsed;
buttons_landscape.statsPanel.Visibility = areStatsVisible ? Visibility.Visible : Visibility.Collapsed;
}
private void buttons_HangUpClick(object sender)
......@@ -136,7 +146,7 @@ namespace Linphone.Views
/// Method called when the page is displayed.
/// Searches for a matching contact using the current call address or number and display information if found.
/// </summary>
protected override async void OnNavigatedTo(NavigationEventArgs nee)
protected override void OnNavigatedTo(NavigationEventArgs nee)
{
// Create LinphoneCore if not created yet, otherwise do nothing
LinphoneManager.Instance.InitLinphoneCore();
......@@ -168,7 +178,7 @@ namespace Linphone.Views
private void CallStateChanged(LinphoneCall call, LinphoneCallState state)
{
if (state == LinphoneCallState.StreamsRunning)
if (state == LinphoneCallState.StreamsRunning || state == LinphoneCallState.Connected)
{
buttons.pause.IsEnabled = true;
buttons.microphone.IsEnabled = true;
......@@ -176,7 +186,9 @@ namespace Linphone.Views
buttons_landscape.microphone.IsEnabled = true;
buttons.video.IsEnabled = true;
buttons_landscape.video.IsEnabled = true;
((InCallModel)ViewModel).VideoButtonToggled = call.GetCurrentParamsCopy().IsVideoEnabled();
bool isVideoEnabled = call.GetCurrentParamsCopy().IsVideoEnabled();
buttons.video.IsChecked = isVideoEnabled;
buttons_landscape.video.IsChecked = isVideoEnabled;
}
else if (state == LinphoneCallState.PausedByRemote)
{
......@@ -241,7 +253,8 @@ namespace Linphone.Views
/// </summary>
public void MuteStateChanged(Boolean isMicMuted)
{
((InCallModel)ViewModel).MuteButtonToggled = isMicMuted;
buttons.microphone.IsChecked = isMicMuted;
buttons_landscape.microphone.IsChecked = isMicMuted;
buttons.microImg.Source = new BitmapImage(new Uri(isMicMuted ? micOn : micOff, UriKind.RelativeOrAbsolute));
buttons_landscape.microImg.Source = new BitmapImage(new Uri(isMicMuted ? micOn : micOff, UriKind.RelativeOrAbsolute));
}
......@@ -251,7 +264,8 @@ namespace Linphone.Views
/// </summary>
public void PauseStateChanged(LinphoneCall call, bool isCallPaused, bool isCallPausedByRemote)
{
((InCallModel)ViewModel).PauseButtonToggled = isCallPaused || isCallPausedByRemote;
buttons.pause.IsChecked = isCallPaused || isCallPausedByRemote;
buttons_landscape.pause.IsChecked = isCallPaused || isCallPausedByRemote;
if (oneSecondTimer == null)
{
......@@ -264,7 +278,8 @@ namespace Linphone.Views
{
// Show video if it was not shown yet
((InCallModel)ViewModel).IsVideoActive = true;
((InCallModel)ViewModel).VideoButtonToggled = true;
buttons.video.IsChecked = true;
buttons_landscape.video.IsChecked = true;
ButtonsFadeInVideoAnimation.Begin();
StartFadeTimer();
}
......@@ -272,7 +287,8 @@ namespace Linphone.Views
{
// Stop video if it is no longer active
((InCallModel)ViewModel).IsVideoActive = false;
((InCallModel)ViewModel).VideoButtonToggled = false;
buttons.video.IsChecked = false;
buttons_landscape.video.IsChecked = false;
ButtonsFadeInAudioAnimation.Begin();
StopFadeTimer();
}
......
......@@ -60,7 +60,7 @@ namespace Linphone.Views
/// Method called when the page is displayed.
/// Searches for a matching contact using the current call address or number and display information if found.
/// </summary>
protected override async void OnNavigatedTo(NavigationEventArgs nee)
protected override void OnNavigatedTo(NavigationEventArgs nee)
{
// Create LinphoneCore if not created yet, otherwise do nothing
LinphoneManager.Instance.InitLinphoneCore();
......
......@@ -24,7 +24,7 @@ namespace Linphone.Views
/// <summary>
/// Method called when the page is displayed.
/// </summary>
protected override async void OnNavigatedTo(NavigationEventArgs e)
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
......
......@@ -37,7 +37,7 @@ namespace Linphone.Views
/// <summary>
/// Method called when the page is displayed.
/// </summary>
protected override async void OnNavigatedTo(NavigationEventArgs e)
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
// Create LinphoneCore if not created yet, otherwise do nothing
......
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