ProjectionManager Sample
Двоичные данные
MultipleViews/.vs/MultipleViews/v14/.suo
|
@ -1,21 +0,0 @@
|
|||
<base:PageBase
|
||||
x:Class="MultipleViews.Views.MainView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:MultipleViews"
|
||||
xmlns:base="using:MultipleViews.Views.Base"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
DataContext="{Binding MainViewModel, Source={StaticResource Locator}}">
|
||||
<Grid Background="LightBlue">
|
||||
<StackPanel
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<Button
|
||||
Content="Create Secondary View"
|
||||
Command="{Binding CreateSecondaryViewCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</base:PageBase>
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
<base:PageBase
|
||||
x:Class="MultipleViews.Views.SecondaryView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:MultipleViews.Views"
|
||||
xmlns:base="using:MultipleViews.Views.Base"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
DataContext="{Binding SecondaryViewModel, Source={StaticResource Locator}}">
|
||||
<Grid Background="LightPink">
|
||||
<StackPanel
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<Button
|
||||
Content="Switch to Main View"
|
||||
Command="{Binding SwitchViewCommand}"/>
|
||||
<Button
|
||||
Content="Switch to Main View and Hide"
|
||||
Command="{Binding HideViewCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</base:PageBase>
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.24720.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Projection", "Projection\Projection.csproj", "{3B98DB73-049E-4180-A054-D3EB6D47173C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|ARM = Release|ARM
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Debug|x64.Build.0 = Debug|x64
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Debug|x86.Build.0 = Debug|x86
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Debug|x86.Deploy.0 = Debug|x86
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Release|ARM.Build.0 = Release|ARM
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Release|x64.ActiveCfg = Release|x64
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Release|x64.Build.0 = Release|x64
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Release|x64.Deploy.0 = Release|x64
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Release|x86.ActiveCfg = Release|x86
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Release|x86.Build.0 = Release|x86
|
||||
{3B98DB73-049E-4180-A054-D3EB6D47173C}.Release|x86.Deploy.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,20 @@
|
|||
<Application
|
||||
x:Class="Projection.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Projection"
|
||||
xmlns:converters="using:Projection.Converters"
|
||||
RequestedTheme="Light"
|
||||
xmlns:locator="using:Projection.ViewModels.Base">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
<!-- ViewModelLocator -->
|
||||
<locator:ViewModelLocator x:Key="Locator" />
|
||||
|
||||
<!-- Converters -->
|
||||
<converters:BoolToStringConverter x:Key="BoolToStringConverter" />
|
||||
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
|
@ -0,0 +1,104 @@
|
|||
using Projection.Views;
|
||||
using System;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.ApplicationModel.Activation;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace Projection
|
||||
{
|
||||
/// <summary>
|
||||
/// Proporciona un comportamiento específico de la aplicación para complementar la clase Application predeterminada.
|
||||
/// </summary>
|
||||
sealed partial class App : Application
|
||||
{
|
||||
private static int _mainViewId;
|
||||
|
||||
public static int MainViewId
|
||||
{
|
||||
get { return _mainViewId; }
|
||||
set { _mainViewId = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inicializa el objeto de aplicación Singleton. Esta es la primera línea de código creado
|
||||
/// ejecutado y, como tal, es el equivalente lógico de main() o WinMain().
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.Suspending += OnSuspending;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Se invoca cuando el usuario final inicia la aplicación normalmente. Se usarán otros puntos
|
||||
/// de entrada cuando la aplicación se inicie para abrir un archivo específico, por ejemplo.
|
||||
/// </summary>
|
||||
/// <param name="e">Información detallada acerca de la solicitud y el proceso de inicio.</param>
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs e)
|
||||
{
|
||||
|
||||
#if DEBUG
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
this.DebugSettings.EnableFrameRateCounter = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
Frame rootFrame = Window.Current.Content as Frame;
|
||||
|
||||
// No repetir la inicialización de la aplicación si la ventana tiene contenido todavía,
|
||||
// solo asegurarse de que la ventana está activa.
|
||||
if (rootFrame == null)
|
||||
{
|
||||
// Crear un marco para que actúe como contexto de navegación y navegar a la primera página.
|
||||
rootFrame = new Frame();
|
||||
|
||||
rootFrame.NavigationFailed += OnNavigationFailed;
|
||||
|
||||
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
|
||||
{
|
||||
//TODO: Cargar el estado de la aplicación suspendida previamente
|
||||
}
|
||||
|
||||
// Poner el marco en la ventana actual.
|
||||
Window.Current.Content = rootFrame;
|
||||
}
|
||||
|
||||
if (rootFrame.Content == null)
|
||||
{
|
||||
// Cuando no se restaura la pila de navegación, navegar a la primera página,
|
||||
// configurando la nueva página pasándole la información requerida como
|
||||
//parámetro de navegación
|
||||
rootFrame.Navigate(typeof(MainView), e.Arguments);
|
||||
}
|
||||
// Asegurarse de que la ventana actual está activa.
|
||||
Window.Current.Activate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Se invoca cuando la aplicación la inicia normalmente el usuario final. Se usarán otros puntos
|
||||
/// </summary>
|
||||
/// <param name="sender">Marco que produjo el error de navegación</param>
|
||||
/// <param name="e">Detalles sobre el error de navegación</param>
|
||||
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
|
||||
{
|
||||
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Se invoca al suspender la ejecución de la aplicación. El estado de la aplicación se guarda
|
||||
/// sin saber si la aplicación se terminará o se reanudará con el contenido
|
||||
/// de la memoria aún intacto.
|
||||
/// </summary>
|
||||
/// <param name="sender">Origen de la solicitud de suspensión.</param>
|
||||
/// <param name="e">Detalles sobre la solicitud de suspensión.</param>
|
||||
private void OnSuspending(object sender, SuspendingEventArgs e)
|
||||
{
|
||||
var deferral = e.SuspendingOperation.GetDeferral();
|
||||
//TODO: Guardar el estado de la aplicación y detener toda actividad en segundo plano
|
||||
deferral.Complete();
|
||||
}
|
||||
}
|
||||
}
|
После Ширина: | Высота: | Размер: 1.4 KiB |
После Ширина: | Высота: | Размер: 7.5 KiB |
После Ширина: | Высота: | Размер: 2.9 KiB |
После Ширина: | Высота: | Размер: 1.6 KiB |
Двоичные данные
Projection/Projection/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 1.2 KiB |
После Ширина: | Высота: | Размер: 1.4 KiB |
После Ширина: | Высота: | Размер: 3.1 KiB |
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
namespace Projection.Converters
|
||||
{
|
||||
public class BoolToStringConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if (value is bool)
|
||||
if ((bool)value)
|
||||
return "Yes";
|
||||
|
||||
return "No";
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
IgnorableNamespaces="uap mp">
|
||||
|
||||
<Identity
|
||||
Name="2b5aaacf-949b-45cc-ae4b-005441b4862d"
|
||||
Publisher="CN=javie"
|
||||
Version="1.0.0.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="2b5aaacf-949b-45cc-ae4b-005441b4862d" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Properties>
|
||||
<DisplayName>Projection</DisplayName>
|
||||
<PublisherDisplayName>javie</PublisherDisplayName>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate"/>
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="App"
|
||||
Executable="$targetnametoken$.exe"
|
||||
EntryPoint="Projection.App">
|
||||
<uap:VisualElements
|
||||
DisplayName="Projection"
|
||||
Square150x150Logo="Assets\Square150x150Logo.png"
|
||||
Square44x44Logo="Assets\Square44x44Logo.png"
|
||||
Description="Projection"
|
||||
BackgroundColor="transparent">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
</Capabilities>
|
||||
</Package>
|
|
@ -0,0 +1,161 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProjectGuid>{3B98DB73-049E-4180-A054-D3EB6D47173C}</ProjectGuid>
|
||||
<OutputType>AppContainerExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Projection</RootNamespace>
|
||||
<AssemblyName>Projection</AssemblyName>
|
||||
<DefaultLanguage>es-ES</DefaultLanguage>
|
||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion>10.0.10586.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
|
||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<PackageCertificateKeyFile>Projection_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\ARM\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
|
||||
<OutputPath>bin\ARM\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
|
||||
<None Include="project.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Converters\BoolToStringConverter.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\Projection\IProjectionService.cs" />
|
||||
<Compile Include="Services\Projection\ProjectionService.cs" />
|
||||
<Compile Include="ViewModels\Base\DelegateCommand.cs" />
|
||||
<Compile Include="ViewModels\Base\DelegateCommandAsync.cs" />
|
||||
<Compile Include="ViewModels\Base\ViewModelBase.cs" />
|
||||
<Compile Include="ViewModels\Base\ViewModelLocator.cs" />
|
||||
<Compile Include="ViewModels\IProjectionServices.cs" />
|
||||
<Compile Include="ViewModels\MainViewModel.cs" />
|
||||
<Compile Include="ViewModels\ProjectionViewModel.cs" />
|
||||
<Compile Include="Views\Base\PageBase.cs" />
|
||||
<Compile Include="Views\MainView.xaml.cs">
|
||||
<DependentUpon>MainView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\ProjectionView.xaml.cs">
|
||||
<DependentUpon>ProjectionView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
<None Include="Projection_TemporaryKey.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Properties\Default.rd.xml" />
|
||||
<Content Include="Assets\LockScreenLogo.scale-200.png" />
|
||||
<Content Include="Assets\SplashScreen.scale-200.png" />
|
||||
<Content Include="Assets\Square150x150Logo.scale-200.png" />
|
||||
<Content Include="Assets\Square44x44Logo.scale-200.png" />
|
||||
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
|
||||
<Content Include="Assets\StoreLogo.png" />
|
||||
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Page Include="Views\MainView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ProjectionView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,29 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Projection")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Projection")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: ComVisible(false)]
|
|
@ -0,0 +1,30 @@
|
|||
<!--
|
||||
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
|
||||
developers. However, you can modify these parameters to modify the behavior of the .NET Native
|
||||
optimizer.
|
||||
|
||||
Runtime Directives are documented at http://go.microsoft.com/fwlink/?LinkID=391919
|
||||
|
||||
To fully enable reflection for App1.MyClass and all of its public/private members
|
||||
<Type Name="App1.MyClass" Dynamic="Required All"/>
|
||||
|
||||
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
|
||||
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
|
||||
|
||||
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
|
||||
<Namespace Name="DataClasses.ViewModels" Seralize="All" />
|
||||
-->
|
||||
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
|
||||
<Application>
|
||||
<!--
|
||||
An Assembly element with Name="*Application*" applies to all assemblies in
|
||||
the application package. The asterisks are not wildcards.
|
||||
-->
|
||||
<Assembly Name="*Application*" Dynamic="Required All"/>
|
||||
|
||||
|
||||
<!-- Add your application specific runtime directives here. -->
|
||||
|
||||
|
||||
</Application>
|
||||
</Directives>
|
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Devices.Enumeration;
|
||||
using Windows.Foundation;
|
||||
|
||||
namespace Projection.Services.Projection
|
||||
{
|
||||
public interface IProjectionService
|
||||
{
|
||||
Task<IEnumerable<DeviceInformation>> GetProjectionDevices();
|
||||
Task<int> ProjectAsync(Type viewType, DeviceInformation device = null);
|
||||
Task<int> RequestProjectAsync(Type viewType, Rect? position = null);
|
||||
Task SwitchProjection(int mainViewId);
|
||||
Task StopProjection(int mainViewId);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.ApplicationModel.Core;
|
||||
using Windows.Devices.Enumeration;
|
||||
using Windows.Foundation;
|
||||
using Windows.UI.Core;
|
||||
using Windows.UI.ViewManagement;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Projection.Services.Projection
|
||||
{
|
||||
public class ProjectionService : IProjectionService
|
||||
{
|
||||
public async Task<IEnumerable<DeviceInformation>> GetProjectionDevices()
|
||||
{
|
||||
// List wired/wireless displays
|
||||
String projectorSelectorQuery = ProjectionManager.GetDeviceSelector();
|
||||
|
||||
// Use device API to find devices based on the query
|
||||
var projectionDevices = await DeviceInformation.FindAllAsync(projectorSelectorQuery);
|
||||
|
||||
var devices = new ObservableCollection<DeviceInformation>();
|
||||
foreach (var device in projectionDevices)
|
||||
devices.Add(device);
|
||||
|
||||
return devices;
|
||||
}
|
||||
|
||||
public async Task<int> ProjectAsync(Type viewType, DeviceInformation device = null)
|
||||
{
|
||||
int mainViewId = ApplicationView.GetForCurrentView().Id;
|
||||
int? secondViewId = null;
|
||||
|
||||
var view = CoreApplication.CreateNewView();
|
||||
await view.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
|
||||
{
|
||||
secondViewId = ApplicationView.GetForCurrentView().Id;
|
||||
var rootFrame = new Frame();
|
||||
rootFrame.Navigate(viewType, null);
|
||||
Window.Current.Content = rootFrame;
|
||||
Window.Current.Activate();
|
||||
});
|
||||
|
||||
if (secondViewId.HasValue)
|
||||
{
|
||||
if(device == null)
|
||||
await ProjectionManager.StartProjectingAsync(secondViewId.Value, mainViewId);
|
||||
else
|
||||
await ProjectionManager.StartProjectingAsync(secondViewId.Value, mainViewId, device);
|
||||
}
|
||||
|
||||
return mainViewId;
|
||||
}
|
||||
|
||||
public async Task<int> RequestProjectAsync(Type viewType, Rect? position = null)
|
||||
{
|
||||
int mainViewId = ApplicationView.GetForCurrentView().Id;
|
||||
int? secondViewId = null;
|
||||
|
||||
var view = CoreApplication.CreateNewView();
|
||||
await view.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
|
||||
{
|
||||
secondViewId = ApplicationView.GetForCurrentView().Id;
|
||||
var rootFrame = new Frame();
|
||||
rootFrame.Navigate(viewType, mainViewId);
|
||||
Window.Current.Content = rootFrame;
|
||||
Window.Current.Activate();
|
||||
});
|
||||
|
||||
if (secondViewId.HasValue)
|
||||
{
|
||||
var defaultPosition = new Rect(0.0, 0.0, 200.0, 200.0);
|
||||
await ProjectionManager.RequestStartProjectingAsync(secondViewId.Value, mainViewId, position.HasValue ? position.Value : defaultPosition);
|
||||
}
|
||||
|
||||
return mainViewId;
|
||||
}
|
||||
|
||||
public async Task SwitchProjection(int mainViewId)
|
||||
{
|
||||
await ProjectionManager.StopProjectingAsync(
|
||||
ApplicationView.GetForCurrentView().Id,
|
||||
mainViewId);
|
||||
}
|
||||
|
||||
public async Task StopProjection(int mainViewId)
|
||||
{
|
||||
await ProjectionManager.SwapDisplaysForViewsAsync(
|
||||
ApplicationView.GetForCurrentView().Id,
|
||||
mainViewId);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
namespace Projection.ViewModels.Base
|
||||
{
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
/// <summary>
|
||||
/// This class allows us to delegate command execution to viewmodels.
|
||||
/// </summary>
|
||||
public class DelegateCommand : ICommand
|
||||
{
|
||||
private readonly Action _execute;
|
||||
private readonly Func<bool> _canExecute;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor not using canExecute.
|
||||
/// </summary>
|
||||
/// <param name="execute"></param>
|
||||
public DelegateCommand(Action execute) : this(execute, null) { }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor using both execute and canExecute.
|
||||
/// </summary>
|
||||
/// <param name="execute"></param>
|
||||
/// <param name="canExecute"></param>
|
||||
public DelegateCommand(Action execute, Func<bool> canExecute)
|
||||
{
|
||||
_execute = execute;
|
||||
_canExecute = canExecute;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is called from XAML to evaluate if the command can be executed.
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
/// <returns></returns>
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
if (_canExecute != null)
|
||||
return _canExecute();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is called from XAML to execute the command.
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
_execute();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method allow us to force the execution of CanExecute method to reevaluate execution.
|
||||
/// </summary>
|
||||
public void RaiseCanExecuteChanged()
|
||||
{
|
||||
var tmpHandle = CanExecuteChanged;
|
||||
if (tmpHandle != null)
|
||||
tmpHandle(this, new EventArgs());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This event notify XAML controls using the command to reevaluate the CanExecute of it.
|
||||
/// </summary>
|
||||
public event EventHandler CanExecuteChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This class allows us to delegate command execution to viewmodels using a T type as parameter.
|
||||
/// </summary>
|
||||
public class DelegateCommand<T> : ICommand
|
||||
{
|
||||
private readonly Action<T> _execute;
|
||||
private readonly Func<T, bool> _canExecute;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor not using canExecute.
|
||||
/// </summary>
|
||||
/// <param name="execute"></param>
|
||||
public DelegateCommand(Action<T> execute) : this(execute, null) { }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor using both execute and canExecute.
|
||||
/// </summary>
|
||||
/// <param name="execute"></param>
|
||||
/// <param name="canExecute"></param>
|
||||
public DelegateCommand(Action<T> execute, Func<T, bool> canExecute)
|
||||
{
|
||||
_execute = execute;
|
||||
_canExecute = canExecute;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is called from XAML to evaluate if the command can be executed.
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
/// <returns></returns>
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
if (_canExecute != null)
|
||||
return _canExecute((T)parameter);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is called from XAML to execute the command.
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
_execute((T)parameter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method allow us to force the execution of CanExecute method to reevaluate execution.
|
||||
/// </summary>
|
||||
public void RaiseCanExecuteChanged()
|
||||
{
|
||||
var tmpHandle = CanExecuteChanged;
|
||||
if (tmpHandle != null)
|
||||
tmpHandle(this, new EventArgs());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This event notify XAML controls using the command to reevaluate the CanExecute of it.
|
||||
/// </summary>
|
||||
public event EventHandler CanExecuteChanged;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,137 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Projection.ViewModels.Base
|
||||
{
|
||||
/// <summary>
|
||||
/// This class allows us to delegate command execution to viewmodels.
|
||||
/// This version of the command allow to use async/await.
|
||||
/// </summary>
|
||||
public class DelegateCommandAsync : ICommand
|
||||
{
|
||||
private readonly Func<Task<bool>> _canExecute;
|
||||
private readonly Func<Task> _execute;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor not using canExecute.
|
||||
/// </summary>
|
||||
/// <param name="execute"></param>
|
||||
public DelegateCommandAsync(Func<Task> execute) : this(execute, null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor using both execute and canExecute.
|
||||
/// </summary>
|
||||
/// <param name="execute"></param>
|
||||
/// <param name="canExecute"></param>
|
||||
public DelegateCommandAsync(Func<Task> execute, Func<Task<bool>> canExecute)
|
||||
{
|
||||
_execute = execute;
|
||||
_canExecute = canExecute;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is called from XAML to evaluate if the command can be executed.
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
/// <returns></returns>
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
if (_canExecute != null)
|
||||
return _canExecute().Result;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is called from XAML to execute the command.
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
_execute();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This event notify XAML controls using the command to reevaluate the CanExecute of it.
|
||||
/// </summary>
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
/// <summary>
|
||||
/// This method allow us to force the execution of CanExecute method to reevaluate execution.
|
||||
/// </summary>
|
||||
public void RaiseCanExecuteChanged()
|
||||
{
|
||||
EventHandler tmpHandle = CanExecuteChanged;
|
||||
if (tmpHandle != null)
|
||||
tmpHandle(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This class allows us to delegate command execution to viewmodels using a T type as parameter.
|
||||
/// </summary>
|
||||
public class DelegateCommandAsync<T> : ICommand
|
||||
{
|
||||
private readonly Func<T, Task<bool>> _canExecute;
|
||||
private readonly Func<T, Task> _execute;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor not using canExecute.
|
||||
/// </summary>
|
||||
/// <param name="execute"></param>
|
||||
public DelegateCommandAsync(Func<T, Task> execute) : this(execute, null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor using both execute and canExecute.
|
||||
/// </summary>
|
||||
/// <param name="execute"></param>
|
||||
/// <param name="canExecute"></param>
|
||||
public DelegateCommandAsync(Func<T, Task> execute, Func<T, Task<bool>> canExecute)
|
||||
{
|
||||
_execute = execute;
|
||||
_canExecute = canExecute;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is called from XAML to evaluate if the command can be executed.
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
/// <returns></returns>
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
if (_canExecute != null)
|
||||
return _canExecute((T) parameter).Result;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is called from XAML to execute the command.
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
_execute((T) parameter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This event notify XAML controls using the command to reevaluate the CanExecute of it.
|
||||
/// </summary>
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
/// <summary>
|
||||
/// This method allow us to force the execution of CanExecute method to reevaluate execution.
|
||||
/// </summary>
|
||||
public void RaiseCanExecuteChanged()
|
||||
{
|
||||
EventHandler tmpHandle = CanExecuteChanged;
|
||||
if (tmpHandle != null)
|
||||
tmpHandle(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
namespace Projection.ViewModels.Base
|
||||
{
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
public abstract class ViewModelBase : INotifyPropertyChanged
|
||||
{
|
||||
private Frame appFrame;
|
||||
private bool isBusy;
|
||||
|
||||
public Frame AppFrame
|
||||
{
|
||||
get { return appFrame; }
|
||||
}
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
get { return isBusy; }
|
||||
set
|
||||
{
|
||||
isBusy = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public abstract Task OnNavigatedFrom(NavigationEventArgs args);
|
||||
|
||||
public abstract Task OnNavigatedTo(NavigationEventArgs args);
|
||||
|
||||
public void RaisePropertyChanged([CallerMemberName]string propertyName = "")
|
||||
{
|
||||
var Handler = PropertyChanged;
|
||||
if (Handler != null)
|
||||
Handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
internal void SetAppFrame(Frame viewFrame)
|
||||
{
|
||||
appFrame = viewFrame;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
namespace Projection.ViewModels.Base
|
||||
{
|
||||
using Microsoft.Practices.Unity;
|
||||
using Services.Projection;
|
||||
|
||||
public class ViewModelLocator
|
||||
{
|
||||
readonly IUnityContainer _container;
|
||||
|
||||
public ViewModelLocator()
|
||||
{
|
||||
_container = new UnityContainer();
|
||||
|
||||
// ViewModels
|
||||
_container.RegisterType<MainViewModel>();
|
||||
_container.RegisterType<ProjectionViewModel>();
|
||||
|
||||
// Services
|
||||
_container.RegisterType<IProjectionService, ProjectionService>(new ContainerControlledLifetimeManager());
|
||||
}
|
||||
|
||||
public MainViewModel MainViewModel
|
||||
{
|
||||
get { return _container.Resolve<MainViewModel>(); }
|
||||
}
|
||||
|
||||
public ProjectionViewModel ProjectionViewModel
|
||||
{
|
||||
get { return _container.Resolve<ProjectionViewModel>(); }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
namespace Projection.ViewModels
|
||||
{
|
||||
internal interface IProjectionServices
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
using System;
|
||||
using Projection.ViewModels.Base;
|
||||
using Projection.Views;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Windows.UI.ViewManagement;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using System.Diagnostics;
|
||||
using Windows.Devices.Enumeration;
|
||||
using System.Collections.ObjectModel;
|
||||
using Projection.Services.Projection;
|
||||
|
||||
namespace Projection.ViewModels
|
||||
{
|
||||
public class MainViewModel : ViewModelBase
|
||||
{
|
||||
// Variables
|
||||
private bool _isProjectionDisplayAvailable;
|
||||
private ObservableCollection<DeviceInformation> _devices;
|
||||
private DeviceInformation _selectedDevice;
|
||||
|
||||
// Commands
|
||||
private ICommand _projectCommand;
|
||||
private ICommand _selectTargetCommand;
|
||||
|
||||
// Services
|
||||
private IProjectionService _projectionService;
|
||||
|
||||
public MainViewModel(IProjectionService projectionService)
|
||||
{
|
||||
_projectionService = projectionService;
|
||||
}
|
||||
|
||||
public bool IsProjectionDisplayAvailable
|
||||
{
|
||||
get { return _isProjectionDisplayAvailable; }
|
||||
set
|
||||
{
|
||||
_isProjectionDisplayAvailable = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<DeviceInformation> Devices
|
||||
{
|
||||
get { return _devices; }
|
||||
set
|
||||
{
|
||||
_devices = value;
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public DeviceInformation SelectedDevice
|
||||
{
|
||||
get { return _selectedDevice; }
|
||||
set
|
||||
{
|
||||
_selectedDevice = value;
|
||||
if (_selectedDevice != null)
|
||||
Project(_selectedDevice);
|
||||
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand ProjectCommand
|
||||
{
|
||||
get { return _projectCommand = _projectCommand ?? new DelegateCommandAsync(ProjectCommandExecute); }
|
||||
}
|
||||
|
||||
public ICommand SelectTargetCommand
|
||||
{
|
||||
get { return _selectTargetCommand = _selectTargetCommand ?? new DelegateCommandAsync(SelectTargetCommandExecute); }
|
||||
}
|
||||
|
||||
public override Task OnNavigatedFrom(NavigationEventArgs args)
|
||||
{
|
||||
ProjectionManager.ProjectionDisplayAvailableChanged -= ProjectionManager_ProjectionDisplayAvailableChanged;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override Task OnNavigatedTo(NavigationEventArgs args)
|
||||
{
|
||||
ProjectionManager.ProjectionDisplayAvailableChanged += ProjectionManager_ProjectionDisplayAvailableChanged;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void ProjectionManager_ProjectionDisplayAvailableChanged(object sender, object e)
|
||||
{
|
||||
// Occurs when a projector or other secondary display becomes available or unavailable.
|
||||
IsProjectionDisplayAvailable = ProjectionManager.ProjectionDisplayAvailable;
|
||||
}
|
||||
|
||||
public async Task ProjectCommandExecute()
|
||||
{
|
||||
App.MainViewId = await _projectionService.ProjectAsync(typeof(ProjectionView));
|
||||
}
|
||||
|
||||
public async Task SelectTargetCommandExecute()
|
||||
{
|
||||
try
|
||||
{
|
||||
Devices = new ObservableCollection<DeviceInformation>(await _projectionService.GetProjectionDevices());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task Project(DeviceInformation device)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Show the view on a second display (if available)
|
||||
App.MainViewId = await _projectionService.ProjectAsync(typeof(ProjectionView), device);
|
||||
|
||||
Debug.WriteLine("Projection started in {0} successfully!", device.Name);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using Projection.ViewModels.Base;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using System.Diagnostics;
|
||||
using Projection.Services.Projection;
|
||||
|
||||
namespace Projection.ViewModels
|
||||
{
|
||||
public class ProjectionViewModel : ViewModelBase
|
||||
{
|
||||
// Commands
|
||||
private ICommand _switchViewCommand;
|
||||
private ICommand _stopCommand;
|
||||
|
||||
// Services
|
||||
private IProjectionService _projectionService;
|
||||
|
||||
public ProjectionViewModel(IProjectionService projectionService)
|
||||
{
|
||||
_projectionService = projectionService;
|
||||
}
|
||||
|
||||
public ICommand SwitchViewCommand
|
||||
{
|
||||
get { return _switchViewCommand = _switchViewCommand ?? new DelegateCommandAsync(SwitchViewCommandExecute); }
|
||||
}
|
||||
|
||||
public ICommand StopCommand
|
||||
{
|
||||
get { return _stopCommand = _stopCommand ?? new DelegateCommandAsync(StopCommandExecute); }
|
||||
}
|
||||
|
||||
public override Task OnNavigatedFrom(NavigationEventArgs args)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override Task OnNavigatedTo(NavigationEventArgs args)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public async Task SwitchViewCommandExecute()
|
||||
{
|
||||
try
|
||||
{
|
||||
await _projectionService.SwitchProjection(App.MainViewId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task StopCommandExecute()
|
||||
{
|
||||
try
|
||||
{
|
||||
await _projectionService.StopProjection(App.MainViewId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
namespace Projection.Views.Base
|
||||
{
|
||||
using ViewModels.Base;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
public class PageBase : Page
|
||||
{
|
||||
private ViewModelBase _vm;
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
|
||||
_vm = (ViewModelBase)DataContext;
|
||||
_vm.SetAppFrame(Frame);
|
||||
_vm.OnNavigatedTo(e);
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedFrom(e);
|
||||
_vm.OnNavigatedFrom(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
<base:PageBase
|
||||
x:Class="Projection.Views.MainView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Projection.Views"
|
||||
xmlns:base="using:Projection.Views.Base"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
DataContext="{Binding MainViewModel, Source={StaticResource Locator}}">
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<StackPanel>
|
||||
<TextBlock Text="ProjectionManager"
|
||||
FontWeight="SemiBold"/>
|
||||
<StackPanel
|
||||
Orientation="Horizontal">
|
||||
<TextBlock Text="Is ProjectionDisplay available" />
|
||||
<TextBlock Text="{Binding IsProjectionDisplayAvailable, Converter={StaticResource BoolToStringConverter}}"
|
||||
Margin="12,0,0,0"/>
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Text="Start directly the projection of multiple views. If there is no active display connection, the second view will be displayed on the same monitor."
|
||||
TextWrapping="Wrap"/>
|
||||
<Button Content="Project"
|
||||
Command="{Binding ProjectCommand}"/>
|
||||
<TextBlock
|
||||
Text="Select the target display. When a display is selected, projection will start."/>
|
||||
<Button Content="Select Target and Project"
|
||||
Command="{Binding SelectTargetCommand}"/>
|
||||
<ListView
|
||||
ItemsSource="{Binding Devices}"
|
||||
SelectedItem="{Binding SelectedDevice, Mode=TwoWay}"
|
||||
Height="300"
|
||||
Width="300"
|
||||
HorizontalAlignment="Left">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}" />
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</base:PageBase>
|
|
@ -0,0 +1,12 @@
|
|||
using Projection.Views.Base;
|
||||
|
||||
namespace Projection.Views
|
||||
{
|
||||
public sealed partial class MainView : PageBase
|
||||
{
|
||||
public MainView()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<base:PageBase
|
||||
x:Class="Projection.Views.ProjectionView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Projection.Views"
|
||||
xmlns:base="using:Projection.Views.Base"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Background="LightBlue"
|
||||
DataContext="{Binding ProjectionViewModel, Source={StaticResource Locator}}">
|
||||
<Grid>
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
Text="Projection View"
|
||||
FontWeight="SemiBold"/>
|
||||
<Button
|
||||
Content="Swap"
|
||||
Command="{Binding SwitchViewCommand}"/>
|
||||
<Button
|
||||
Content="Stop"
|
||||
Command="{Binding StopCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</base:PageBase>
|
|
@ -0,0 +1,12 @@
|
|||
using Projection.Views.Base;
|
||||
|
||||
namespace Projection.Views
|
||||
{
|
||||
public sealed partial class ProjectionView : PageBase
|
||||
{
|
||||
public ProjectionView()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp build" xmlns:build="http://schemas.microsoft.com/developer/appx/2015/build">
|
||||
<!--
|
||||
ESTE ARCHIVO DE MANIFIESTO DEL PAQUETE SE GENERA MEDIANTE EL PROCESO DE COMPILACIÓN.
|
||||
|
||||
Los cambios realizados en el archivo se perderán al regenerarlo. Para corregir los errores de este archivo, edite el archivo de origen .appxmanifest.
|
||||
|
||||
Para obtener más información acerca de los archivos de manifiesto del paquete, vea http://go.microsoft.com/fwlink/?LinkID=241727
|
||||
-->
|
||||
<Identity Name="2b5aaacf-949b-45cc-ae4b-005441b4862d" Publisher="CN=javie" Version="1.0.0.0" ProcessorArchitecture="x86" />
|
||||
<mp:PhoneIdentity PhoneProductId="2b5aaacf-949b-45cc-ae4b-005441b4862d" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||
<Properties>
|
||||
<DisplayName>Projection</DisplayName>
|
||||
<PublisherDisplayName>javie</PublisherDisplayName>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.10240.0" MaxVersionTested="10.0.10586.0" />
|
||||
<PackageDependency Name="Microsoft.NET.CoreRuntime.1.0" MinVersion="1.0.23430.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
|
||||
<PackageDependency Name="Microsoft.VCLibs.140.00.Debug" MinVersion="14.0.22929.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
|
||||
</Dependencies>
|
||||
<Resources>
|
||||
<Resource Language="ES-ES" />
|
||||
<Resource Language="EN" />
|
||||
<Resource Language="EN-US" />
|
||||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="App" Executable="Projection.exe" EntryPoint="Projection.App">
|
||||
<uap:VisualElements DisplayName="Projection" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Projection" BackgroundColor="transparent">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" />
|
||||
<uap:SplashScreen Image="Assets\SplashScreen.png" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
</Capabilities>
|
||||
<build:Metadata>
|
||||
<build:Item Name="TargetFrameworkMoniker" Value=".NETCore,Version=v5.0" />
|
||||
<build:Item Name="VisualStudio" Version="14.0" />
|
||||
<build:Item Name="VisualStudioEdition" Value="Microsoft Visual Studio Enterprise 2015" />
|
||||
<build:Item Name="OperatingSystem" Version="10.0.10586.0 (th2_release.151029-1700)" />
|
||||
<build:Item Name="Microsoft.Build.AppxPackage.dll" Version="14.0.24720.0" />
|
||||
<build:Item Name="ProjectGUID" Value="{3B98DB73-049E-4180-A054-D3EB6D47173C}" />
|
||||
<build:Item Name="OptimizingToolset" Value="None" />
|
||||
<build:Item Name="TargetRuntime" Value="Managed" />
|
||||
<build:Item Name="Microsoft.Windows.UI.Xaml.Build.Tasks.dll" Version="14.0.24720.0" />
|
||||
<build:Item Name="MakePri.exe" Version="10.0.10586.15 (th2_release.151119-1817)" />
|
||||
</build:Metadata>
|
||||
</Package>
|
Двоичные данные
Projection/Projection/bin/x86/Debug/AppX/Assets/LockScreenLogo.scale-200.png
Normal file
После Ширина: | Высота: | Размер: 1.4 KiB |
Двоичные данные
Projection/Projection/bin/x86/Debug/AppX/Assets/SplashScreen.scale-200.png
Normal file
После Ширина: | Высота: | Размер: 7.5 KiB |
Двоичные данные
Projection/Projection/bin/x86/Debug/AppX/Assets/Square150x150Logo.scale-200.png
Normal file
После Ширина: | Высота: | Размер: 2.9 KiB |
Двоичные данные
Projection/Projection/bin/x86/Debug/AppX/Assets/Square44x44Logo.scale-200.png
Normal file
После Ширина: | Высота: | Размер: 1.6 KiB |
Двоичные данные
Projection/Projection/bin/x86/Debug/AppX/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 1.2 KiB |
После Ширина: | Высота: | Размер: 1.4 KiB |
Двоичные данные
Projection/Projection/bin/x86/Debug/AppX/Assets/Wide310x150Logo.scale-200.png
Normal file
После Ширина: | Высота: | Размер: 3.1 KiB |
Двоичные данные
Projection/Projection/bin/x86/Debug/AppX/Microsoft.Practices.ServiceLocation.dll
Normal file
Двоичные данные
Projection/Projection/bin/x86/Debug/AppX/Microsoft.Practices.Unity.RegistrationByConvention.dll
Normal file
|
@ -0,0 +1,70 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Roots >
|
||||
<Roots.Interfaces>
|
||||
<RootInterface FullName="Windows.UI.Xaml.Data.IValueConverter" />
|
||||
</Roots.Interfaces>
|
||||
<Roots.PropertyPathNames>
|
||||
<RootPropertyPathName Name="MainViewModel" />
|
||||
<RootPropertyPathName Name="Devices" />
|
||||
<RootPropertyPathName Name="SelectedDevice" />
|
||||
<RootPropertyPathName Name="Name" />
|
||||
<RootPropertyPathName Name="SelectTargetCommand" />
|
||||
<RootPropertyPathName Name="ProjectCommand" />
|
||||
<RootPropertyPathName Name="IsProjectionDisplayAvailable" />
|
||||
<RootPropertyPathName Name="ProjectionViewModel" />
|
||||
<RootPropertyPathName Name="StopCommand" />
|
||||
<RootPropertyPathName Name="SwitchViewCommand" />
|
||||
</Roots.PropertyPathNames>
|
||||
<Roots.RootTypes>
|
||||
<RootType FullName="Windows.UI.Xaml.Application">
|
||||
<RootProperty Name="RequestedTheme" />
|
||||
<RootProperty Name="Resources" />
|
||||
</RootType>
|
||||
<RootType FullName="Windows.UI.Xaml.ResourceDictionary" />
|
||||
<RootType FullName="Projection.ViewModels.Base.ViewModelLocator" />
|
||||
<RootType FullName="Projection.Converters.BoolToStringConverter" />
|
||||
<RootType FullName="Projection.Views.Base.PageBase">
|
||||
<RootProperty Name="DataContext" />
|
||||
<RootProperty Name="Content" />
|
||||
<RootProperty Name="Background" />
|
||||
</RootType>
|
||||
<RootType FullName="Windows.UI.Xaml.Data.Binding">
|
||||
<RootProperty Name="Source" />
|
||||
<RootProperty Name="Mode" />
|
||||
<RootProperty Name="Converter" />
|
||||
</RootType>
|
||||
<RootType FullName="Microsoft.Xaml.DirectUI.ProxyTypes.StaticResourceExtension" />
|
||||
<RootType FullName="Windows.UI.Xaml.Controls.Grid">
|
||||
<RootProperty Name="Background" />
|
||||
<RootProperty Name="Children" />
|
||||
</RootType>
|
||||
<RootType FullName="Microsoft.Xaml.DirectUI.ProxyTypes.ThemeResourceExtension" />
|
||||
<RootType FullName="Windows.UI.Xaml.Controls.StackPanel">
|
||||
<RootProperty Name="Children" />
|
||||
<RootProperty Name="Orientation" />
|
||||
</RootType>
|
||||
<RootType FullName="Windows.UI.Xaml.Controls.TextBlock">
|
||||
<RootProperty Name="Text" />
|
||||
<RootProperty Name="FontWeight" />
|
||||
<RootProperty Name="TextWrapping" />
|
||||
<RootProperty Name="Margin" />
|
||||
</RootType>
|
||||
<RootType FullName="Windows.UI.Xaml.Controls.Button">
|
||||
<RootProperty Name="Content" />
|
||||
<RootProperty Name="Command" />
|
||||
</RootType>
|
||||
<RootType FullName="Windows.UI.Xaml.Controls.ListView">
|
||||
<RootProperty Name="ItemsSource" />
|
||||
<RootProperty Name="SelectedItem" />
|
||||
<RootProperty Name="Height" />
|
||||
<RootProperty Name="Width" />
|
||||
<RootProperty Name="HorizontalAlignment" />
|
||||
<RootProperty Name="ItemTemplate" />
|
||||
</RootType>
|
||||
<RootType FullName="Windows.UI.Xaml.DataTemplate">
|
||||
<RootProperty Name="Template" />
|
||||
</RootType>
|
||||
<RootType FullName="Projection.Views.MainView" />
|
||||
<RootType FullName="Projection.Views.ProjectionView" />
|
||||
</Roots.RootTypes>
|
||||
</Roots>
|
|
@ -0,0 +1,30 @@
|
|||
<!--
|
||||
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
|
||||
developers. However, you can modify these parameters to modify the behavior of the .NET Native
|
||||
optimizer.
|
||||
|
||||
Runtime Directives are documented at http://go.microsoft.com/fwlink/?LinkID=391919
|
||||
|
||||
To fully enable reflection for App1.MyClass and all of its public/private members
|
||||
<Type Name="App1.MyClass" Dynamic="Required All"/>
|
||||
|
||||
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
|
||||
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
|
||||
|
||||
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
|
||||
<Namespace Name="DataClasses.ViewModels" Seralize="All" />
|
||||
-->
|
||||
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
|
||||
<Application>
|
||||
<!--
|
||||
An Assembly element with Name="*Application*" applies to all assemblies in
|
||||
the application package. The asterisks are not wildcards.
|
||||
-->
|
||||
<Assembly Name="*Application*" Dynamic="Required All"/>
|
||||
|
||||
|
||||
<!-- Add your application specific runtime directives here. -->
|
||||
|
||||
|
||||
</Application>
|
||||
</Directives>
|