Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

[WIP] Bait and switch conversion for plugins #63

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
// <copyright file="IMvxSimpleAccelerometer.cs" company="Cirrious">
// (c) Copyright Cirrious. http://www.cirrious.com
// This source is subject to the Microsoft Public License (Ms-PL)
// Please see license.txt on http://opensource.org/licenses/ms-pl.html
// All other rights reserved.
// </copyright>
//
// Project Lead - Stuart Lodge, Cirrious. http://www.cirrious.com - Hire me - I'm worth it!
using MvvmCross.Platform.Core;
using System;
namespace MvvmCross.Plugins.Accelerometer
{
public interface IMvxAccelerometer
{
void Start();
void Stop();
bool Started { get; }
MvxAccelerometerReading LastReading { get; }
event EventHandler<MvxValueEventArgs<MvxAccelerometerReading>> ReadingAvailable;
}
// <copyright file="IMvxSimpleAccelerometer.cs" company="Cirrious">
// (c) Copyright Cirrious. http://www.cirrious.com
// This source is subject to the Microsoft Public License (Ms-PL)
// Please see license.txt on http://opensource.org/licenses/ms-pl.html
// All other rights reserved.
// </copyright>
//
// Project Lead - Stuart Lodge, Cirrious. http://www.cirrious.com - Hire me - I'm worth it!

using MvvmCross.Platform.Core;
using System;

namespace MvvmCross.Plugins.Accelerometer.Abstractions
{
public interface IMvxAccelerometer
{
void Start();

void Stop();

bool Started { get; }
MvxAccelerometerReading LastReading { get; }

event EventHandler<MvxValueEventArgs<MvxAccelerometerReading>> ReadingAvailable;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?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>
<MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{061CF78A-25B7-4089-9ACA-BA336739E731}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MvvmCross.Plugins.Accelerometer.Abstractions</RootNamespace>
<AssemblyName>MvvmCross.Plugins.Accelerometer.Abstractions</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="IMvxAccelerometer.cs" />
<Compile Include="MvxAccelerometerReading.cs" />
<Compile Include="PluginLoader.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="MvvmCross.Platform, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\MvvmCross.Platform.4.0.0\lib\portable-net45+win+wpa81+wp80\MvvmCross.Platform.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.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>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//
// Project Lead - Stuart Lodge, Cirrious. http://www.cirrious.com - Hire me - I'm worth it!

namespace MvvmCross.Plugins.Accelerometer
namespace MvvmCross.Plugins.Accelerometer.Abstractions
{
public class MvxAccelerometerReading
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using MvvmCross.Platform;
using MvvmCross.Platform.Plugins;

namespace MvvmCross.Plugins.Accelerometer
namespace MvvmCross.Plugins.Accelerometer.Abstractions
{
public class PluginLoader
: IMvxPluginLoader
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Resources;
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("MvvmCross.Plugins.Accelerometer.Abstractions")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MvvmCross.Plugins.Accelerometer.Abstractions")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]

// 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")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MvvmCross.Platform" version="4.0.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MvvmCross.Plugins.Accelerometer.Droid</RootNamespace>
<AssemblyName>MvvmCross.Plugins.Accelerometer.Droid</AssemblyName>
<RootNamespace>MvvmCross.Plugins.Accelerometer</RootNamespace>
<AssemblyName>MvvmCross.Plugins.Accelerometer</AssemblyName>
<FileAlignment>512</FileAlignment>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
Expand Down Expand Up @@ -53,10 +53,6 @@
<HintPath>..\..\packages\MvvmCross.Core.4.0.0\lib\MonoAndroid\MvvmCross.Droid.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MvvmCross.Localization, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\MvvmCross.Platform.4.0.0\lib\MonoAndroid\MvvmCross.Localization.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MvvmCross.Platform, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\MvvmCross.Platform.4.0.0\lib\MonoAndroid\MvvmCross.Platform.dll</HintPath>
<Private>True</Private>
Expand All @@ -76,9 +72,9 @@
<Compile Include="MvxAccelerometer.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MvvmCross.Plugins.Accelerometer\MvvmCross.Plugins.Accelerometer.csproj">
<Project>{B81C8F9A-FE2C-4807-90BA-D34CB25D8CE6}</Project>
<Name>MvvmCross.Plugins.Accelerometer</Name>
<ProjectReference Include="..\MvvmCross.Plugins.Accelerometer.Abstractions\MvvmCross.Plugins.Accelerometer.Abstractions.csproj">
<Project>{061cf78a-25b7-4089-9aca-ba336739e731}</Project>
<Name>MvvmCross.Plugins.Accelerometer.Abstractions</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@
using System;
using Android.Content;
using Android.Hardware;
using MvvmCross.Platform;
using MvvmCross.Platform.Core;
using MvvmCross.Platform.Droid;
using MvvmCross.Platform.Exceptions;
using MvvmCross.Platform;
using MvvmCross.Plugins.Accelerometer.Abstractions;

namespace MvvmCross.Plugins.Accelerometer.Droid
namespace MvvmCross.Plugins.Accelerometer
{
public class MvxAccelerometer
: Java.Lang.Object
, ISensorEventListener
, IMvxAccelerometer
, ISensorEventListener
, IMvxAccelerometer
{
private Sensor _accelerometer;
private SensorManager _sensorManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

using MvvmCross.Platform;
using MvvmCross.Platform.Plugins;
using MvvmCross.Plugins.Accelerometer.Abstractions;

namespace MvvmCross.Plugins.Accelerometer.Droid
namespace MvvmCross.Plugins.Accelerometer
{
public class Plugin
: IMvxPlugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<ProjectGuid>{BA60B7DF-9009-4FBD-B361-F7CFAEB96C7C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MvvmCross.Plugins.Accelerometer.WindowsCommon</RootNamespace>
<AssemblyName>MvvmCross.Plugins.Accelerometer.WindowsCommon</AssemblyName>
<RootNamespace>MvvmCross.Plugins.Accelerometer</RootNamespace>
<AssemblyName>MvvmCross.Plugins.Accelerometer</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Expand All @@ -36,17 +36,17 @@
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<ProjectReference Include="..\MvvmCross.Plugins.Accelerometer\MvvmCross.Plugins.Accelerometer.csproj">
<Project>{B81C8F9A-FE2C-4807-90BA-D34CB25D8CE6}</Project>
<Name>MvvmCross.Plugins.Accelerometer</Name>
<ProjectReference Include="..\MvvmCross.Plugins.Accelerometer.Abstractions\MvvmCross.Plugins.Accelerometer.Abstractions.csproj">
<Project>{061cf78a-25b7-4089-9aca-ba336739e731}</Project>
<Name>MvvmCross.Plugins.Accelerometer.Abstractions</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<TargetPlatform Include="WindowsPhoneApp, Version=8.1" />
<TargetPlatform Include="Windows, Version=8.1" />
</ItemGroup>
<ItemGroup>
<Compile Include="MvxWindowsCommonAccelerometer.cs" />
<Compile Include="MvxAccelerometer.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
Expand All @@ -59,10 +59,6 @@
<HintPath>..\..\packages\MvvmCross.Core.4.0.0\lib\portable-win81+wpa81\MvvmCross.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MvvmCross.Localization, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\MvvmCross.Platform.4.0.0\lib\portable-win81+wpa81\MvvmCross.Localization.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MvvmCross.Platform, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\MvvmCross.Platform.4.0.0\lib\portable-win81+wpa81\MvvmCross.Platform.dll</HintPath>
<Private>True</Private>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
//
// Project Lead - Stuart Lodge, Cirrious. http://www.cirrious.com - Hire me - I'm worth it!

using MvvmCross.Platform.Core;
using MvvmCross.Platform.Exceptions;
using System;
using Windows.Devices.Sensors;
using MvvmCross.Platform.Core;
using MvvmCross.Platform.Exceptions;
using MvvmCross.Plugins.Accelerometer.Abstractions;

namespace MvvmCross.Plugins.Accelerometer.WindowsStore
namespace MvvmCross.Plugins.Accelerometer
{
public class MvxStoreAccelerometer : IMvxAccelerometer
public class MvxAccelerometer
: IMvxAccelerometer
{
private bool _started;
private Windows.Devices.Sensors.Accelerometer _accelerometer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@

using MvvmCross.Platform;
using MvvmCross.Platform.Plugins;
using MvvmCross.Plugins.Accelerometer.Abstractions;

namespace MvvmCross.Plugins.Accelerometer.WindowsCommon
namespace MvvmCross.Plugins.Accelerometer
{
public class Plugin
: IMvxPlugin
{
public void Load()
{
Mvx.RegisterSingleton<IMvxAccelerometer>(new MvxWindowsCommonAccelerometer());
Mvx.RegisterSingleton<IMvxAccelerometer>(new MvxAccelerometer());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MvvmCross.Plugins.Accelerometer.WindowsPhone</RootNamespace>
<AssemblyName>MvvmCross.Plugins.Accelerometer.WindowsPhone</AssemblyName>
<RootNamespace>MvvmCross.Plugins.Accelerometer</RootNamespace>
<AssemblyName>MvvmCross.Plugins.Accelerometer</AssemblyName>
<TargetFrameworkIdentifier>WindowsPhone</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
Expand Down Expand Up @@ -56,9 +56,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MvvmCross.Plugins.Accelerometer\MvvmCross.Plugins.Accelerometer.csproj">
<Project>{B81C8F9A-FE2C-4807-90BA-D34CB25D8CE6}</Project>
<Name>MvvmCross.Plugins.Accelerometer</Name>
<ProjectReference Include="..\MvvmCross.Plugins.Accelerometer.Abstractions\MvvmCross.Plugins.Accelerometer.Abstractions.csproj">
<Project>{061cf78a-25b7-4089-9aca-ba336739e731}</Project>
<Name>MvvmCross.Plugins.Accelerometer.Abstractions</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
//
// Project Lead - Stuart Lodge, Cirrious. http://www.cirrious.com - Hire me - I'm worth it!

using System;
using Microsoft.Devices.Sensors;
using MvvmCross.Platform.Core;
using MvvmCross.Platform.Exceptions;
using Microsoft.Devices.Sensors;
using System;
using MvvmCross.Plugins.Accelerometer.Abstractions;

namespace MvvmCross.Plugins.Accelerometer.WindowsPhone
namespace MvvmCross.Plugins.Accelerometer
{
public class MvxAccelerometer : IMvxAccelerometer
public class MvxAccelerometer
: IMvxAccelerometer
{
private Microsoft.Devices.Sensors.Accelerometer _accelerometer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

using MvvmCross.Platform;
using MvvmCross.Platform.Plugins;
using MvvmCross.Plugins.Accelerometer.Abstractions;

namespace MvvmCross.Plugins.Accelerometer.WindowsPhone
namespace MvvmCross.Plugins.Accelerometer
{
public class Plugin
: IMvxPlugin
Expand Down
Loading