Commit fd36dd6b authored by Margaux Clerc's avatar Margaux Clerc

Clean & fix part 2

parent 55227173
......@@ -15,26 +15,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using BelledonneCommunications.Linphone.Native;
using Linphone.Model;
using System.Diagnostics;
using Windows.UI.Core;
using Windows.Networking.PushNotifications;
namespace Linphone
{
......@@ -52,9 +41,18 @@ namespace Linphone
public App()
{
this.InitializeComponent();
SettingsManager.InstallConfigFile();
this.Suspending += OnSuspending;
this.Resuming += App_Resuming;
}
private void App_Resuming(object sender, object e)
{
if (rootFrame.BackStack.Count > 0)
{
rootFrame.BackStack.Clear();
}
}
private void Back_requested(object sender, BackRequestedEventArgs e)
{
......@@ -78,7 +76,10 @@ namespace Linphone
{
// Launch the Dialer and remove the incall view from the backstack
rootFrame.Navigate(typeof(Views.Dialer), null);
//this.Page.NavigationService.RemoveBackEntry();
if (rootFrame.BackStack.Count > 0)
{
rootFrame.BackStack.Clear();
}
}
}
......
......@@ -21,9 +21,14 @@
x:Uid="AddressHint"
VerticalAlignment="Center"
AcceptsReturn="False"
TextChanged="address_TextChanged"
InputScope="EmailSmtpAddress"
CompositeMode="MinBlend">
TextChanged="address_TextChanged">
<TextBox.InputScope>
<InputScope>
<InputScope.Names>
<InputScopeName NameValue="EmailNameOrAddress" />
</InputScope.Names>
</InputScope>
</TextBox.InputScope>
</TextBox>
<Button
......
......@@ -54,8 +54,8 @@ namespace Linphone.Controls
{
InitializeComponent();
microphone.IsChecked = LinphoneManager.Instance.Core.IsMicEnabled;
video.IsEnabled = LinphoneManager.Instance.Core.IsVideoSupported;
camera.IsEnabled = LinphoneManager.Instance.Core.IsVideoSupported && LinphoneManager.Instance.NumberOfCameras > 1;
video.IsEnabled = LinphoneManager.Instance.IsVideoAvailable;
camera.IsEnabled = LinphoneManager.Instance.IsVideoAvailable && LinphoneManager.Instance.NumberOfCameras > 1;
}
#region Button enabled/disabled
......@@ -69,6 +69,11 @@ namespace Linphone.Controls
video.IsEnabled = isVideoEnabled;
}
public void checkedVideo(bool isVideoChecked)
{
video.IsChecked = isVideoChecked;
}
public void enabledPause(bool isPauseEnabled)
{
pause.IsEnabled = isPauseEnabled;
......
......@@ -93,7 +93,7 @@
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
<None Include="Assets\linphonerc" />
<Content Include="Assets\linphonerc" />
<Content Include="Assets\linphonerc-factory" />
<Content Include="Assets\avatar.png" />
<Content Include="Assets\avatar2.png" />
......
......@@ -15,8 +15,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
using System;
using System.Globalization;
using System.Windows;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
......
......@@ -17,13 +17,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
using BelledonneCommunications.Linphone.Native;
using Linphone.Model;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using Windows.UI.Xaml;
namespace Linphone.Views
......@@ -34,10 +28,6 @@ namespace Linphone.Views
public class InCallModel : BaseModel
{
//private MSWinRTVideo.SwapChainPanelSource _videoSource;
//private MSWinRTVideo.SwapChainPanelSource _previewSource;
/// <summary>
/// Public constructor.
/// </summary>
......@@ -46,15 +36,12 @@ namespace Linphone.Views
{
if (CurrentPage != null)
{
// PageOrientation = CurrentPage.Orientation;
//PageOrientation = CurrentPage.Orientation;
}
// if (LinphoneManager.Instance.isLinphoneRunning)
// {
bool isVideoAvailable = LinphoneManager.Instance.IsVideoAvailable;
videoButtonVisibility = isVideoAvailable ? Visibility.Visible : Visibility.Collapsed;
cameraButtonVisibility = isVideoAvailable && LinphoneManager.Instance.NumberOfCameras >= 2 ? Visibility.Visible : Visibility.Collapsed;
// }
bool isVideoAvailable = LinphoneManager.Instance.IsVideoAvailable;
videoButtonEnabled = isVideoAvailable;
cameraButtonEnabled = isVideoAvailable && LinphoneManager.Instance.NumberOfCameras >= 2;
}
/// <summary>
......@@ -140,14 +127,14 @@ namespace Linphone.Views
if (RemoteVideoVisibility == Visibility.Collapsed)
{
RemoteVideoProgressBarVisibility = Visibility.Visible;
//RemoteVideoProgressBarVisibility = Visibility.Visible;
}
}
public void RemoteVideoOpened()
{
RemoteVideoVisibility = Visibility.Visible;
RemoteVideoProgressBarVisibility = Visibility.Collapsed;
//RemoteVideoProgressBarVisibility = Visibility.Collapsed;
}
private void HideRemoteVideo()
......@@ -242,39 +229,33 @@ namespace Linphone.Views
}*/
#region Button properties
/// <summary>
/// Visibility of the video button.
/// </summary>
public Visibility VideoButtonVisibility
public bool VideoButtonVisibility
{
get
{
return this.videoButtonVisibility;
return this.videoButtonEnabled;
}
set
{
if (this.videoButtonVisibility != value)
if (this.videoButtonEnabled != value)
{
this.videoButtonVisibility = value;
this.videoButtonEnabled = value;
this.OnPropertyChanged();
}
}
}
/// <summary>
/// Visibility of the camera button.
/// </summary>
public Visibility CameraButtonVisibility
public bool CameraButtonEnabled
{
get
{
return this.cameraButtonVisibility;
return this.cameraButtonEnabled;
}
set
{
if (this.cameraButtonVisibility != value)
if (this.cameraButtonEnabled != value)
{
this.cameraButtonVisibility = value;
this.cameraButtonEnabled = value;
this.OnPropertyChanged();
}
}
......@@ -395,22 +376,6 @@ namespace Linphone.Views
}
}
public Visibility RemoteVideoProgressBarVisibility
{
get
{
return this.remoteVideoProgressBarVisibility;
}
set
{
if (this.RemoteVideoProgressBarVisibility != value)
{
this.remoteVideoProgressBarVisibility = value;
this.OnPropertyChanged();
}
}
}
/// <summary>
/// Uri of the local video stream.
/// </summary>
......@@ -609,8 +574,8 @@ namespace Linphone.Views
#region Private variables
// private Microsoft.Phone.Controls.PageOrientation pageOrientation = Microsoft.Phone.Controls.PageOrientation.Portrait;
private Visibility videoButtonVisibility = Visibility.Collapsed;
private Visibility cameraButtonVisibility = Visibility.Collapsed;
private bool videoButtonEnabled = false;
private bool cameraButtonEnabled = false;
private Visibility portraitButtonsVisibility = Visibility.Visible;
private Visibility landscapeButtonsVisibility = Visibility.Collapsed;
private Boolean isVideoActive = false;
......
......@@ -28,7 +28,6 @@ using Windows.System.Profile;
using Windows.Networking.PushNotifications;
using Windows.ApplicationModel.Calls;
using LinphoneTasks;
using Windows.UI.Notifications;
namespace Linphone.Model
{
......@@ -545,7 +544,7 @@ namespace Linphone.Model
{
}
public class CallEventArgs : EventArgs
public class CallEventArgs : EventArgs
{
public Call _call { get; set; }
public CallEventArgs(Call c)
......@@ -562,14 +561,15 @@ namespace Linphone.Model
State = state;
}
}
void CoreListener.CallStateChanged(Call call, CallState state, string message)
void CoreListener.CallStateChanged(Call call, CallState state, string message)
{
#pragma warning disable CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel
CoreDispatcher.RunAsync(CoreDispatcherPriority.High, () =>
{
if (CallStateChanged != null)
if(CallStateChangedEvent != null)
{
CallStateChanged(this, new CallStateEventArgs(state.ToString()));
CallStateChangedEvent(call, state);
}
});
#pragma warning restore CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel
......@@ -621,6 +621,20 @@ namespace Linphone.Model
#pragma warning restore CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel
}
else if (state == CallState.UpdatedByRemote)
{
Core.DeferCallUpdate(call);
#pragma warning disable CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel
CoreDispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
Debug.WriteLine("[LinphoneManager] Update call\r\n");
});
#pragma warning restore CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel
}
else if (state == CallState.End || state == CallState.Error)
{
#pragma warning disable CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel
......
......@@ -64,12 +64,14 @@ namespace Linphone.Model
/// <summary>
/// Install the default config file from the package to the Isolated Storage
/// </summary>
public static void InstallConfigFile()
public static async void InstallConfigFile()
{
/* if (!File.Exists(InitManager.GetConfigPath()))
FileInfo fInfo = new FileInfo(LinphoneManager.Instance.GetConfigPath());
if (!fInfo.Exists)
{
File.Copy(InitManager.GetDefaultConfigPath(), InitManager.GetConfigPath());
}*/
fInfo = new FileInfo(LinphoneManager.Instance.GetDefaultConfigPath());
fInfo.MoveTo(LinphoneManager.Instance.GetConfigPath());
}
}
/// <summary>
......@@ -421,7 +423,7 @@ namespace Linphone.Model
if (transport != null)
{
Address proxyAddr = LinphoneManager.Instance.Core.CreateAddress(cfg.Identity);
Address proxyAddr = LinphoneManager.Instance.Core.CreateAddress(proxy);
if (proxyAddr != null)
{
proxyAddr.Transport = TransportToEnum[transport];
......@@ -430,7 +432,7 @@ namespace Linphone.Model
}
if (outboundProxy)
{
Address proxyAddr = LinphoneManager.Instance.Core.CreateAddress(cfg.Identity);
Address proxyAddr = LinphoneManager.Instance.Core.CreateAddress(proxy);
cfg.Route = proxyAddr.AsStringUriOnly();
}
......@@ -993,7 +995,8 @@ namespace Linphone.Model
if (ValueChanged(VideoEnabledKeyName))
{
bool isVideoEnabled = Convert.ToBoolean(GetNew(VideoEnabledKeyName));
LinphoneManager.Instance.Core.IsSelfViewEnabled = isVideoEnabled;
LinphoneManager.Instance.Core.IsVideoCaptureEnabled = isVideoEnabled;
LinphoneManager.Instance.Core.IsVideoDisplayEnabled = isVideoEnabled;
}
if (ValueChanged(AutomaticallyInitiateVideoKeyName) || ValueChanged(AutomaticallyAcceptVideoKeyName))
{
......
......@@ -718,4 +718,10 @@ To enjoy the best experience with Linphone WP8, we recommend that you use the SI
<data name="ChatMessageHint.PlaceholderText" xml:space="preserve">
<value>Enter your message</value>
</data>
<data name="Accept" xml:space="preserve">
<value>Accept</value>
</data>
<data name="Dismiss" xml:space="preserve">
<value>Dismiss</value>
</data>
</root>
\ No newline at end of file
......@@ -11,33 +11,14 @@
mc:Ignorable="d">
<Grid x:Name="LayoutRoot" Tapped="LayoutRoot_Tap">
<MediaElement
x:Name="remoteVideo"
Visibility="{Binding RemoteVideoVisibility}"
MediaOpened="remoteVideo_MediaOpened_1"
MediaFailed="remoteVideo_MediaFailed_1"
Source="{Binding RemoteVideoUri}"
Width="{Binding ActualWidth, ElementName=LayoutRoot, Mode=OneWay}"
Height="{Binding ActualHeight, ElementName=LayoutRoot, Mode=OneWay}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
RenderTransformOrigin="0.5,0.5"/>
<ProgressBar x:Name="RemoteVideoProgressBar"
Visibility="{Binding RemoteVideoProgressBarVisibility}"
IsIndeterminate="True"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Width="{Binding ActualWidth, ElementName=LayoutRoot, Mode=OneWay}"
Height="{Binding ActualHeight, ElementName=LayoutRoot, Mode=OneWay}"/>
<Grid x:Name="HUD"
HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid x:Name="ContactHeader" Margin="10,50,10,10">
<Grid x:Name="ContactHeader" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
......@@ -47,16 +28,16 @@
<Image Source="/Assets/avatar2.png"
HorizontalAlignment="Center"
Width="50"/>
Width="60" Height="60" VerticalAlignment="Top"/>
<TextBlock
Grid.Row="1"
x:Name="Contact"
FontSize="20"
FontSize="18"
HorizontalAlignment="Center"
Style="{StaticResource TextStyle}"
TextWrapping="Wrap"
Margin="5"/>
Margin="5,10,5,10"/>
<TextBlock
Grid.Row="2"
......@@ -83,7 +64,7 @@
Grid.Row="1"/>
<!-- Local video media element -->
<Grid Grid.RowSpan="2" x:Name="VideoGrid" Canvas.ZIndex="-1" Background="Black" Visibility="Visible" Tapped="Video_Tapped">
<Grid Grid.RowSpan="2" x:Name="VideoGrid" Canvas.ZIndex="-1" Background="Black" Visibility="Collapsed" Tapped="Video_Tapped">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
......
This diff is collapsed.
......@@ -40,6 +40,7 @@
<ToggleSwitch
Margin="0,10,0,0"
x:Name="SelfViewEnabled"
Visibility="Collapsed"
x:Uid="SelfViewEnabledSetting">
</ToggleSwitch>
</StackPanel>
......
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