Initial commit
|
@ -0,0 +1,63 @@
|
|||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
|
@ -0,0 +1,204 @@
|
|||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
build/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# Visual Studo 2015 cache/options directory
|
||||
.vs/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding addin-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
+project.lock.json
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
*.[Cc]ache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
*.mp3
|
||||
*.opendb
|
||||
CDPPingPong/CDPPingPong.Core/Properties/CDPPingPong.Core.rd.xml
|
||||
CDPPingPong/CDPPingPong.sln.DotSettings
|
||||
/OfficeProtocolHandler/appx/office365cent.cer
|
||||
/OfficeProtocolHandler/appx/office365cent.pvk
|
||||
/OfficeProtocolHandler/appx/office365cent.appx
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0"?>
|
||||
<package >
|
||||
<metadata>
|
||||
<id>$id$</id>
|
||||
<version>$version$</version>
|
||||
<title>$title$</title>
|
||||
<authors>Microsoft</authors>
|
||||
<owners>Shawn Henry</owners>
|
||||
<licenseUrl>http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE</licenseUrl>
|
||||
<projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl>
|
||||
<!--<iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>-->
|
||||
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||
<description>This package contains the Project Rome Connected Devices SDK for Xamarin on Android. </description>
|
||||
<releaseNotes>Initial release. </releaseNotes>
|
||||
<copyright>Copyright 2017</copyright>
|
||||
<tags>Microsoft Rome Connected Devices Xamarin</tags>
|
||||
</metadata>
|
||||
</package>
|
|
@ -0,0 +1,65 @@
|
|||
## Project Rome Connected Devices Plugin for Xamarin on Android
|
||||
|
||||
Xamarin plugin to allow access to the Project Rome Connected Device APIs on Android. Discover, launch and message from Android application to Windows devices and applications.
|
||||
|
||||
### Blog Post Walkthrough
|
||||
|
||||
[Connected Apps and Devices](https://msdn.microsoft.com/windows/uwp/launch-resume/connected-apps-and-devices)
|
||||
|
||||
|
||||
### Setup
|
||||
* Available on NuGet: http://www.nuget.org/packages/Microsoft.ConnectedDevices [![NuGet](https://img.shields.io/nuget/v/Microsoft.ConnectedDevices.svg?label=NuGet)](https://www.nuget.org/packages/Microsoft.ConnectedDevices/)
|
||||
|
||||
**Platform Support**
|
||||
|
||||
|Platform|Supported|Version|
|
||||
| ------------------- | :-----------: | :------------------: |
|
||||
|Xamarin.Android|Yes|API 14+|
|
||||
|
||||
|
||||
### API Usage
|
||||
|
||||
#### Pre-requisites
|
||||
1. Visual Studio 2015 or 2017 RC with Xamarin or Xamarin Studio
|
||||
2. Register your applciation and obtain an MSA client ID from
|
||||
[https://apps.dev.microsoft.com](https://apps.dev.microsoft.com)
|
||||
|
||||
#### Getting Started
|
||||
1. Initialize the Connected Devices Platform
|
||||
```csharp
|
||||
Platform.FetchAuthCode += Platform_FetchAuthCode;
|
||||
var result = await Platform.InitializeAsync(this.ApplicationContext, CLIENT_ID);
|
||||
```
|
||||
|
||||
2. The FetchAuthCode handler is used when the platform needs an authorization code from the user (i.e. form OAuth with Microsoft Account). See the sample for more details.
|
||||
```csharp
|
||||
private async void Platform_FetchAuthCode(string oauthUrl)
|
||||
{
|
||||
var authCode = await AuthenticateWithOAuth(oauthUrl);
|
||||
Platform.SetAuthCode(token);
|
||||
}
|
||||
```
|
||||
|
||||
3. Now, discover devices
|
||||
```csharp
|
||||
private RemoteSystemWatcher _remoteSystemWatcher;
|
||||
private void DiscoverDevices()
|
||||
{
|
||||
_remoteSystemWatcher = RemoteSystem.CreateWatcher();
|
||||
_remoteSystemWatcher.RemoteSystemAdded += (sender, args) =>
|
||||
{
|
||||
Console.WriteLine("Discovered Device: " + args.P0.DisplayName);
|
||||
};
|
||||
_remoteSystemWatcher.Start();
|
||||
}
|
||||
```
|
||||
|
||||
4. Finally, connect and launch URIs using LaunchUriAsync
|
||||
```csharp
|
||||
private async void RemoteLaunchUri(RemoteSystem remoteSystem, Uri uri)
|
||||
{
|
||||
var launchUriStatus = await RemoteLauncher.LaunchUriAsync(new RemoteSystemConnectionRequest(remoteSystem), uri);
|
||||
}
|
||||
```
|
||||
|
||||
#### License
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.25914.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectedDevices.Xamarin.Droid.Sample", "ConnectedDevices.Xamarin.Droid.Sample\ConnectedDevices.Xamarin.Droid.Sample.csproj", "{DC3ACE32-65E8-4348-A4E2-B5ED08E5932C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{DC3ACE32-65E8-4348-A4E2-B5ED08E5932C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DC3ACE32-65E8-4348-A4E2-B5ED08E5932C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DC3ACE32-65E8-4348-A4E2-B5ED08E5932C}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{DC3ACE32-65E8-4348-A4E2-B5ED08E5932C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DC3ACE32-65E8-4348-A4E2-B5ED08E5932C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DC3ACE32-65E8-4348-A4E2-B5ED08E5932C}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,19 @@
|
|||
Any raw assets you want to be deployed with your application can be placed in
|
||||
this directory (and child directories) and given a Build Action of "AndroidAsset".
|
||||
|
||||
These files will be deployed with you package and will be accessible using Android's
|
||||
AssetManager, like this:
|
||||
|
||||
public class ReadAsset : Activity
|
||||
{
|
||||
protected override void OnCreate (Bundle bundle)
|
||||
{
|
||||
base.OnCreate (bundle);
|
||||
|
||||
InputStream input = Assets.Open ("my_asset.txt");
|
||||
}
|
||||
}
|
||||
|
||||
Additionally, some Android functions will automatically load asset files:
|
||||
|
||||
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
|
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{DC3ACE32-65E8-4348-A4E2-B5ED08E5932C}</ProjectGuid>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ConnectedDevices.Xamarin.Droid.Sample</RootNamespace>
|
||||
<AssemblyName>ConnectedDevices.Xamarin.Droid.Sample</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AndroidApplication>True</AndroidApplication>
|
||||
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
|
||||
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
</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>
|
||||
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
<EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>PdbOnly</DebugType>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<Optimize>True</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
|
||||
<AndroidLinkMode>Full</AndroidLinkMode>
|
||||
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
|
||||
<BundleAssemblies>False</BundleAssemblies>
|
||||
<AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi>
|
||||
<Debugger>Xamarin</Debugger>
|
||||
<AotAssemblies>False</AotAssemblies>
|
||||
<EnableLLVM>False</EnableLLVM>
|
||||
<AndroidEnableMultiDex>False</AndroidEnableMultiDex>
|
||||
<EnableProguard>False</EnableProguard>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ConnectedDevices.Xamarin.Droid, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\src\ConnectedDevices.Xamarin.Droid\bin\Release\ConnectedDevices.Xamarin.Droid.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mono.Android" />
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="RemoteSystemActivity.cs" />
|
||||
<Compile Include="Resources\Resource.Designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="GettingStarted.Xamarin" />
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<None Include="Assets\AboutAssets.txt" />
|
||||
<AndroidResource Include="Resources\layout\RemoteSystemView.axml" />
|
||||
<AndroidResource Include="Resources\layout\RemoteSystem.axml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\Main.axml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\values\Strings.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\Icon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\AndroidManifest.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\detail_border.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\Hololens.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\Phone.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\SurfaceHub.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\Unknown.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\Xbox.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\Desktop.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.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,4 @@
|
|||
<GettingStarted>
|
||||
<LocalContent>GS\Android\CS\AndroidApp\GettingStarted.html</LocalContent>
|
||||
<EmbeddedNavigation>false</EmbeddedNavigation>
|
||||
</GettingStarted>
|
|
@ -0,0 +1,218 @@
|
|||
//*********************************************************
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
|
||||
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
|
||||
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
|
||||
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
|
||||
//
|
||||
//*********************************************************
|
||||
|
||||
using System;
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Widget;
|
||||
using Android.OS;
|
||||
using Android.Webkit;
|
||||
using Microsoft.ConnectedDevices;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Android.Views;
|
||||
|
||||
namespace ConnectedDevices.Xamarin.Droid.Sample
|
||||
{
|
||||
[Activity(Label = "Connected Devices", MainLauncher = true, Icon = "@drawable/icon")]
|
||||
public class MainActivity : ListActivity
|
||||
{
|
||||
// Use your own client id
|
||||
private const string CLIENT_ID = "";
|
||||
|
||||
private WebView _webView;
|
||||
internal Dialog _authDialog;
|
||||
RemoteSystemAdapter _adapter;
|
||||
|
||||
private RemoteSystemWatcher _remoteSystemWatcher;
|
||||
|
||||
protected override void OnCreate(Bundle bundle)
|
||||
{
|
||||
base.OnCreate(bundle);
|
||||
|
||||
// Set our view from the "main" layout resource
|
||||
SetContentView(Resource.Layout.Main);
|
||||
|
||||
Button callButton = FindViewById<Button>(Resource.Id.RefreshButton);
|
||||
callButton.Click += (object sender, EventArgs e) =>
|
||||
{
|
||||
RefreshDevices();
|
||||
};
|
||||
|
||||
InitializeAsync();
|
||||
|
||||
_adapter = new RemoteSystemAdapter(this, new List<RemoteSystem>());
|
||||
this.ListAdapter = _adapter;
|
||||
}
|
||||
|
||||
internal async void InitializeAsync()
|
||||
{
|
||||
Platform.FetchAuthCode += Platform_FetchAuthCode;
|
||||
var result = await Platform.InitializeAsync(this.ApplicationContext, CLIENT_ID);
|
||||
|
||||
if (result == true)
|
||||
{
|
||||
Console.WriteLine("Initialized platform successfully");
|
||||
RefreshDevices();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("ConnectedDevices Platform initialization failed");
|
||||
}
|
||||
}
|
||||
|
||||
private void Platform_FetchAuthCode(string oauthUrl)
|
||||
{
|
||||
_authDialog = new Dialog(this);
|
||||
|
||||
var linearLayout = new LinearLayout(_authDialog.Context);
|
||||
_webView = new WebView(_authDialog.Context);
|
||||
linearLayout.AddView(_webView);
|
||||
_authDialog.SetContentView(linearLayout);
|
||||
|
||||
_webView.SetWebChromeClient(new WebChromeClient());
|
||||
_webView.Settings.JavaScriptEnabled = true;
|
||||
_webView.Settings.DomStorageEnabled = true;
|
||||
_webView.LoadUrl(oauthUrl);
|
||||
|
||||
_webView.SetWebViewClient(new MsaWebViewClient(this));
|
||||
_authDialog.Show();
|
||||
_authDialog.SetCancelable(true);
|
||||
}
|
||||
|
||||
internal void RefreshDevices()
|
||||
{
|
||||
_adapter.Clear();
|
||||
DiscoverDevices();
|
||||
}
|
||||
|
||||
private void DiscoverDevices()
|
||||
{
|
||||
_remoteSystemWatcher = RemoteSystem.CreateWatcher();
|
||||
|
||||
_remoteSystemWatcher.RemoteSystemAdded += RemoteSystemWatcherOnRemoteSystemAdded;
|
||||
_remoteSystemWatcher.RemoteSystemRemoved += RemoteSystemWatcher_RemoteSystemRemoved;
|
||||
_remoteSystemWatcher.RemoteSystemUpdated += RemoteSystemWatcher_RemoteSystemUpdated;
|
||||
|
||||
_remoteSystemWatcher.Start();
|
||||
}
|
||||
|
||||
private void RemoteSystemWatcher_RemoteSystemUpdated(RemoteSystemWatcher watcher, RemoteSystemUpdatedEventArgs args)
|
||||
{
|
||||
RunOnUiThread(() =>
|
||||
{
|
||||
_adapter.Remove(_adapter.Items.FirstOrDefault(system => system.Id == args.P0.Id));
|
||||
_adapter.Add(args.P0);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void RemoteSystemWatcher_RemoteSystemRemoved(RemoteSystemWatcher watcher, RemoteSystemRemovedEventArgs args)
|
||||
{
|
||||
RunOnUiThread(() =>
|
||||
_adapter.Remove(_adapter.Items.FirstOrDefault(system => system.Id == args.P0))
|
||||
);
|
||||
}
|
||||
|
||||
private void RemoteSystemWatcherOnRemoteSystemAdded(RemoteSystemWatcher watcher, RemoteSystemAddedEventArgs args)
|
||||
{
|
||||
RunOnUiThread(() => _adapter.Add(args.P0));
|
||||
}
|
||||
|
||||
protected override void OnListItemClick(ListView l, View v, int position, long id)
|
||||
{
|
||||
var detailsActivity = new Intent(this, typeof(RemoteSystemActivity));
|
||||
|
||||
RemoteSystem selectedDevice = _adapter.GetItem(position);
|
||||
|
||||
ConnectedDevicesApplication.SelectedRemoteSystem = selectedDevice;
|
||||
|
||||
StartActivity(detailsActivity);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public class RemoteSystemAdapter : ArrayAdapter<RemoteSystem>
|
||||
{
|
||||
private static readonly Dictionary<RemoteSystemKind, int> RemoteSystemKindImages = new Dictionary<RemoteSystemKind, int>
|
||||
{
|
||||
{ RemoteSystemKind.Desktop, Resource.Drawable.Desktop },
|
||||
{ RemoteSystemKind.Phone, Resource.Drawable.Phone },
|
||||
{ RemoteSystemKind.Xbox, Resource.Drawable.Xbox },
|
||||
{ RemoteSystemKind.Holographic, Resource.Drawable.Hololens },
|
||||
{ RemoteSystemKind.Hub, Resource.Drawable.SurfaceHub },
|
||||
{ RemoteSystemKind.Unknown, Resource.Drawable.Unknown}
|
||||
};
|
||||
|
||||
public List<RemoteSystem> Items { get; }
|
||||
Activity context;
|
||||
public RemoteSystemAdapter(Activity context, List<RemoteSystem> items)
|
||||
: base(context, Resource.Layout.RemoteSystemView, items)
|
||||
{
|
||||
this.context = context;
|
||||
this.Items = items;
|
||||
}
|
||||
|
||||
public override View GetView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
var item = this.GetItem(position);
|
||||
|
||||
View view = convertView;
|
||||
if (view == null) // no view to re-use, create new
|
||||
view = context.LayoutInflater.Inflate(Resource.Layout.RemoteSystemView, null);
|
||||
view.FindViewById<TextView>(Resource.Id.Text1).Text = item.DisplayName;
|
||||
view.FindViewById<TextView>(Resource.Id.Text2).Text = item.IsAvailableByProximity ? "Proximal" : "Cloud";
|
||||
int id = RemoteSystemKindImages.ContainsKey(item.Kind) ? RemoteSystemKindImages[item.Kind] : RemoteSystemKindImages[RemoteSystemKind.Unknown];
|
||||
view.FindViewById<ImageView>(Resource.Id.Image).SetImageResource(id);
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
||||
internal class MsaWebViewClient : WebViewClient
|
||||
{
|
||||
bool authComplete = false;
|
||||
|
||||
private readonly MainActivity _parentActivity;
|
||||
public MsaWebViewClient(MainActivity activity)
|
||||
{
|
||||
_parentActivity = activity;
|
||||
}
|
||||
|
||||
public override void OnPageFinished(WebView view, string url)
|
||||
{
|
||||
base.OnPageFinished(view, url);
|
||||
if (url.Contains("?code=") && !authComplete)
|
||||
{
|
||||
authComplete = true;
|
||||
Console.WriteLine("Page finished successfully");
|
||||
|
||||
var uri = Android.Net.Uri.Parse(url);
|
||||
string token = uri.GetQueryParameter("code");
|
||||
_parentActivity._authDialog.Dismiss();
|
||||
Platform.SetAuthCode(token);
|
||||
}
|
||||
else if (url.Contains("error=access_denied"))
|
||||
{
|
||||
authComplete = true;
|
||||
Console.WriteLine("Page finished failed with ACCESS_DENIED_HERE");
|
||||
Intent resultIntent = new Intent();
|
||||
_parentActivity.SetResult(0, resultIntent);
|
||||
_parentActivity._authDialog.Dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
internal class ConnectedDevicesApplication
|
||||
{
|
||||
public static RemoteSystem SelectedRemoteSystem { get; internal set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ConnectedDevices.Xamarin" android:versionCode="2" android:versionName="1.0.2">
|
||||
<uses-sdk android:minSdkVersion="16" />
|
||||
<application android:label="ConnectedDevices.Xamarin"></application>
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
</manifest>
|
|
@ -0,0 +1,30 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Android.App;
|
||||
|
||||
// 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("ConnectedDevices.Xamarin.Droid.Sample")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ConnectedDevices.Xamarin.Droid.Sample")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 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.1.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.0")]
|
|
@ -0,0 +1,59 @@
|
|||
//*********************************************************
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
|
||||
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
|
||||
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
|
||||
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
|
||||
//
|
||||
//*********************************************************
|
||||
|
||||
using System;
|
||||
using Android.App;
|
||||
using Android.OS;
|
||||
using Android.Widget;
|
||||
using Microsoft.ConnectedDevices;
|
||||
|
||||
namespace ConnectedDevices.Xamarin.Droid.Sample
|
||||
{
|
||||
[Activity(Label = "Remote System Details")]
|
||||
public class RemoteSystemActivity : Activity
|
||||
{
|
||||
protected override void OnCreate(Bundle savedInstanceState)
|
||||
{
|
||||
base.OnCreate(savedInstanceState);
|
||||
|
||||
SetContentView(Resource.Layout.RemoteSystem);
|
||||
|
||||
var remoteSystem = ConnectedDevicesApplication.SelectedRemoteSystem;
|
||||
if (remoteSystem != null)
|
||||
{
|
||||
FindViewById<TextView>(Resource.Id.detailed_name_text).Text = remoteSystem.DisplayName;
|
||||
FindViewById<TextView>(Resource.Id.detailed_id_text).Text = remoteSystem.Id;
|
||||
FindViewById<TextView>(Resource.Id.detailed_kind_text).Text = (string)remoteSystem.Kind;
|
||||
FindViewById<TextView>(Resource.Id.detailed_proximity_text).Text = remoteSystem.IsAvailableByProximity ? "True" : "False";
|
||||
|
||||
Button button = FindViewById<Button>(Resource.Id.detailed_launch_button);
|
||||
button.Click += delegate
|
||||
{
|
||||
EditText textBox = (EditText)FindViewById(Resource.Id.detailed_url_text);
|
||||
string uri = textBox.Text;
|
||||
|
||||
Console.WriteLine("Launching URI");
|
||||
RemoteLaunchUriAsync(ConnectedDevicesApplication.SelectedRemoteSystem, new Uri(uri));
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private async void RemoteLaunchUriAsync(RemoteSystem remoteSystem, Uri uri)
|
||||
{
|
||||
var launchUriStatus = await RemoteLauncher.LaunchUriAsync(new RemoteSystemConnectionRequest(remoteSystem), uri);
|
||||
|
||||
if (launchUriStatus != RemoteLaunchUriStatus.Success)
|
||||
{
|
||||
Console.WriteLine("Failed to Launch!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
Images, layout descriptions, binary blobs and string dictionaries can be included
|
||||
in your application as resource files. Various Android APIs are designed to
|
||||
operate on the resource IDs instead of dealing with images, strings or binary blobs
|
||||
directly.
|
||||
|
||||
For example, a sample Android app that contains a user interface layout (main.axml),
|
||||
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
|
||||
would keep its resources in the "Resources" directory of the application:
|
||||
|
||||
Resources/
|
||||
drawable/
|
||||
icon.png
|
||||
|
||||
layout/
|
||||
main.axml
|
||||
|
||||
values/
|
||||
strings.xml
|
||||
|
||||
In order to get the build system to recognize Android resources, set the build action to
|
||||
"AndroidResource". The native Android APIs do not operate directly with filenames, but
|
||||
instead operate on resource IDs. When you compile an Android application that uses resources,
|
||||
the build system will package the resources for distribution and generate a class called "R"
|
||||
(this is an Android convention) that contains the tokens for each one of the resources
|
||||
included. For example, for the above Resources layout, this is what the R class would expose:
|
||||
|
||||
public class R {
|
||||
public class drawable {
|
||||
public const int icon = 0x123;
|
||||
}
|
||||
|
||||
public class layout {
|
||||
public const int main = 0x456;
|
||||
}
|
||||
|
||||
public class strings {
|
||||
public const int first_string = 0xabc;
|
||||
public const int second_string = 0xbcd;
|
||||
}
|
||||
}
|
||||
|
||||
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
|
||||
to reference the layout/main.axml file, or R.strings.first_string to reference the first
|
||||
string in the dictionary file values/strings.xml.
|
166
xamarin/samples/ConnectedDevices.Xamarin.Droid.Sample/ConnectedDevices.Xamarin.Droid.Sample/Resources/Resource.Designer.cs
сгенерированный
Normal file
|
@ -0,0 +1,166 @@
|
|||
#pragma warning disable 1591
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
[assembly: global::Android.Runtime.ResourceDesignerAttribute("ConnectedDevices.Xamarin.Droid.Sample.Resource", IsApplication=true)]
|
||||
|
||||
namespace ConnectedDevices.Xamarin.Droid.Sample
|
||||
{
|
||||
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
|
||||
public partial class Resource
|
||||
{
|
||||
|
||||
static Resource()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
public static void UpdateIdValues()
|
||||
{
|
||||
}
|
||||
|
||||
public partial class Attribute
|
||||
{
|
||||
|
||||
static Attribute()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Attribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Drawable
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f020000
|
||||
public const int Desktop = 2130837504;
|
||||
|
||||
// aapt resource value: 0x7f020001
|
||||
public const int detail_border = 2130837505;
|
||||
|
||||
// aapt resource value: 0x7f020002
|
||||
public const int Hololens = 2130837506;
|
||||
|
||||
// aapt resource value: 0x7f020003
|
||||
public const int Icon = 2130837507;
|
||||
|
||||
// aapt resource value: 0x7f020004
|
||||
public const int Phone = 2130837508;
|
||||
|
||||
// aapt resource value: 0x7f020005
|
||||
public const int SurfaceHub = 2130837509;
|
||||
|
||||
// aapt resource value: 0x7f020006
|
||||
public const int Unknown = 2130837510;
|
||||
|
||||
// aapt resource value: 0x7f020007
|
||||
public const int Xbox = 2130837511;
|
||||
|
||||
static Drawable()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Drawable()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Id
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f050007
|
||||
public const int Image = 2131034119;
|
||||
|
||||
// aapt resource value: 0x7f050000
|
||||
public const int RefreshButton = 2131034112;
|
||||
|
||||
// aapt resource value: 0x7f050008
|
||||
public const int Text = 2131034120;
|
||||
|
||||
// aapt resource value: 0x7f050009
|
||||
public const int Text1 = 2131034121;
|
||||
|
||||
// aapt resource value: 0x7f05000a
|
||||
public const int Text2 = 2131034122;
|
||||
|
||||
// aapt resource value: 0x7f050002
|
||||
public const int detailed_id_text = 2131034114;
|
||||
|
||||
// aapt resource value: 0x7f050003
|
||||
public const int detailed_kind_text = 2131034115;
|
||||
|
||||
// aapt resource value: 0x7f050006
|
||||
public const int detailed_launch_button = 2131034118;
|
||||
|
||||
// aapt resource value: 0x7f050001
|
||||
public const int detailed_name_text = 2131034113;
|
||||
|
||||
// aapt resource value: 0x7f050004
|
||||
public const int detailed_proximity_text = 2131034116;
|
||||
|
||||
// aapt resource value: 0x7f050005
|
||||
public const int detailed_url_text = 2131034117;
|
||||
|
||||
static Id()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Id()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Layout
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f030000
|
||||
public const int Main = 2130903040;
|
||||
|
||||
// aapt resource value: 0x7f030001
|
||||
public const int RemoteSystem = 2130903041;
|
||||
|
||||
// aapt resource value: 0x7f030002
|
||||
public const int RemoteSystemView = 2130903042;
|
||||
|
||||
static Layout()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Layout()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class String
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f040000
|
||||
public const int ApplicationName = 2130968576;
|
||||
|
||||
static String()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private String()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
После Ширина: | Высота: | Размер: 1.6 KiB |
После Ширина: | Высота: | Размер: 7.1 KiB |
После Ширина: | Высота: | Размер: 4.0 KiB |
После Ширина: | Высота: | Размер: 595 B |
После Ширина: | Высота: | Размер: 432 B |
После Ширина: | Высота: | Размер: 3.1 KiB |
После Ширина: | Высота: | Размер: 772 B |
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
|
||||
<stroke
|
||||
android:width="1dip"
|
||||
android:color="@android:color/black" />
|
||||
|
||||
</shape>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="Devices" />
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
<Button
|
||||
android:id="@+id/RefreshButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Refresh" />
|
||||
</LinearLayout>
|
|
@ -0,0 +1,106 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="16dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingTop="16dp">
|
||||
<!-- Dummy view -->
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"/>
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<!-- First Box -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/detail_border"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp">
|
||||
<TextView
|
||||
android:id="@+id/detailed_name_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="25sp" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Id: "
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:id="@+id/detailed_id_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Kind: "
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:id="@+id/detailed_kind_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:text="Proximal: "
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:id="@+id/detailed_proximity_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@drawable/detail_border"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Launcher"
|
||||
android:textSize="25sp" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<EditText
|
||||
android:id="@+id/detailed_url_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:inputType="textUri"
|
||||
android:text="http://bing.com/" />
|
||||
<Button
|
||||
android:id="@+id/detailed_launch_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Launch Uri" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="8dp">
|
||||
<ImageView
|
||||
android:id="@+id/Image"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="5dp"
|
||||
android:src="@drawable/icon"
|
||||
android:layout_alignParentLeft="true" />
|
||||
<LinearLayout
|
||||
android:id="@+id/Text"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="60dip">
|
||||
<TextView
|
||||
android:id="@+id/Text1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18dip"/>
|
||||
<TextView
|
||||
android:id="@+id/Text2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14dip" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="ApplicationName">Connected Devices</string>
|
||||
</resources>
|
|
@ -0,0 +1,48 @@
|
|||
Additions allow you to add arbitrary C# to the generated classes
|
||||
before they are compiled. This can be helpful for providing convenience
|
||||
methods or adding pure C# classes.
|
||||
|
||||
== Adding Methods to Generated Classes ==
|
||||
|
||||
Let's say the library being bound has a Rectangle class with a constructor
|
||||
that takes an x and y position, and a width and length size. It will look like
|
||||
this:
|
||||
|
||||
public partial class Rectangle
|
||||
{
|
||||
public Rectangle (int x, int y, int width, int height)
|
||||
{
|
||||
// JNI bindings
|
||||
}
|
||||
}
|
||||
|
||||
Imagine we want to add a constructor to this class that takes a Point and
|
||||
Size structure instead of 4 ints. We can add a new file called Rectangle.cs
|
||||
with a partial class containing our new method:
|
||||
|
||||
public partial class Rectangle
|
||||
{
|
||||
public Rectangle (Point location, Size size) :
|
||||
this (location.X, location.Y, size.Width, size.Height)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
At compile time, the additions class will be added to the generated class
|
||||
and the final assembly will a Rectangle class with both constructors.
|
||||
|
||||
|
||||
== Adding C# Classes ==
|
||||
|
||||
Another thing that can be done is adding fully C# managed classes to the
|
||||
generated library. In the above example, let's assume that there isn't a
|
||||
Point class available in Java or our library. The one we create doesn't need
|
||||
to interact with Java, so we'll create it like a normal class in C#.
|
||||
|
||||
By adding a Point.cs file with this class, it will end up in the binding library:
|
||||
|
||||
public class Point
|
||||
{
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
//*********************************************************
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
|
||||
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
|
||||
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
|
||||
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
|
||||
//
|
||||
//*********************************************************
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Android.Content;
|
||||
|
||||
namespace Microsoft.ConnectedDevices
|
||||
{
|
||||
public partial class Platform
|
||||
{
|
||||
|
||||
public static event Action<string> FetchAuthCode;
|
||||
private static Platform.IAuthCodeHandler _handler;
|
||||
|
||||
public static Task<bool> InitializeAsync(Context context, string clientID)
|
||||
{
|
||||
var tcs = new TaskCompletionSource<bool>();
|
||||
|
||||
var platformInitializer = new PlatformInitializer();
|
||||
var _authCodeProvider = new AuthCodeProvider(clientID);
|
||||
|
||||
platformInitializer.InitializationCompleted += (r) =>
|
||||
{
|
||||
tcs.TrySetResult(r);
|
||||
};
|
||||
Platform.Initialize(context, _authCodeProvider, platformInitializer);
|
||||
|
||||
return tcs.Task;
|
||||
}
|
||||
|
||||
internal static void InvokeFetchAuthCode(string oauthUrl, Platform.IAuthCodeHandler handler)
|
||||
{
|
||||
_handler = handler;
|
||||
FetchAuthCode?.Invoke(oauthUrl);
|
||||
}
|
||||
|
||||
public static void SetAuthCode(string authCode)
|
||||
{
|
||||
_handler?.OnAuthCodeFetched(authCode);
|
||||
}
|
||||
}
|
||||
|
||||
internal class PlatformInitializer : Java.Lang.Object, IPlatformInitializationHandler
|
||||
{
|
||||
public void OnDone(bool p0)
|
||||
{
|
||||
InitializationCompleted?.Invoke(p0);
|
||||
}
|
||||
|
||||
public event Action<bool> InitializationCompleted;
|
||||
}
|
||||
|
||||
internal class AuthCodeProvider : Java.Lang.Object, IAuthCodeProvider
|
||||
{
|
||||
public AuthCodeProvider(string clientId)
|
||||
{
|
||||
ClientId = clientId;
|
||||
}
|
||||
|
||||
public string ClientId { get; private set; }
|
||||
|
||||
public void FetchAuthCodeAsync(string oauthUrl, Platform.IAuthCodeHandler handler)
|
||||
{
|
||||
// Platform needs app to get an MSA auth_code.
|
||||
// Need to sign in user via OAuth for given url.
|
||||
Platform.InvokeFetchAuthCode(oauthUrl, handler);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
//*********************************************************
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
|
||||
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
|
||||
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
|
||||
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
|
||||
//
|
||||
//*********************************************************
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.ConnectedDevices
|
||||
{
|
||||
public partial class RemoteLauncher
|
||||
{
|
||||
public static Task<RemoteLaunchUriStatus> LaunchUriAsync(RemoteSystemConnectionRequest connectionRequest, Uri uri)
|
||||
{
|
||||
var tcs = new TaskCompletionSource<RemoteLaunchUriStatus>();
|
||||
|
||||
RemoteLauncher _launcher = new RemoteLauncher();
|
||||
|
||||
try
|
||||
{
|
||||
var launchUriListener = new LaunchURIListener();
|
||||
launchUriListener.LaunchCompleted += (r) =>
|
||||
{
|
||||
tcs.TrySetResult(r);
|
||||
};
|
||||
_launcher.LaunchUriAsync(connectionRequest, uri.OriginalString, launchUriListener);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
tcs.TrySetException(e);
|
||||
}
|
||||
|
||||
return tcs.Task;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
internal class LaunchURIListener : Java.Lang.Object, IRemoteLauncherListener
|
||||
{
|
||||
public void OnCompleted(RemoteLaunchUriStatus p0)
|
||||
{
|
||||
LaunchCompleted?.Invoke(p0);
|
||||
}
|
||||
|
||||
public event Action<RemoteLaunchUriStatus> LaunchCompleted;
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
//*********************************************************
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
|
||||
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
|
||||
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
|
||||
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
|
||||
//
|
||||
//*********************************************************
|
||||
|
||||
namespace Microsoft.ConnectedDevices
|
||||
{
|
||||
|
||||
public partial class RemoteSystem
|
||||
{
|
||||
public static void RequestAccessAsync()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static RemoteSystemWatcher CreateWatcher()
|
||||
{
|
||||
return new RemoteSystemWatcher();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
//*********************************************************
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
|
||||
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
|
||||
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
|
||||
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
|
||||
//
|
||||
//*********************************************************
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.ConnectedDevices
|
||||
{
|
||||
|
||||
public partial class RemoteSystemWatcher
|
||||
{
|
||||
|
||||
private RemoteSystemDiscovery.Builder _builder = new RemoteSystemDiscovery.Builder();
|
||||
private RemoteSystemDiscoveryListener _listener;
|
||||
private RemoteSystemDiscovery _watcher;
|
||||
|
||||
//
|
||||
// Summary:
|
||||
// The event that is raised when a new remote system (device) is discovered.
|
||||
public event OnRemoteSystemAdded RemoteSystemAdded;
|
||||
public delegate void OnRemoteSystemAdded(RemoteSystemWatcher watcher, RemoteSystemAddedEventArgs args);
|
||||
internal void InvokeRemoteSystemAdded(RemoteSystem remoteSystem)
|
||||
{
|
||||
RemoteSystemAdded?.Invoke(this, new RemoteSystemAddedEventArgs(remoteSystem));
|
||||
}
|
||||
|
||||
//
|
||||
// Summary:
|
||||
// The event that is raised when a previously discovered remote system (device)
|
||||
// is no longer visible.
|
||||
public event OnRemoteSystemRemoved RemoteSystemRemoved;
|
||||
public delegate void OnRemoteSystemRemoved(RemoteSystemWatcher watcher, RemoteSystemRemovedEventArgs args);
|
||||
internal void InvokeRemoteSystemRemoved(string remoteSystemId)
|
||||
{
|
||||
RemoteSystemRemoved?.Invoke(this, new RemoteSystemRemovedEventArgs(remoteSystemId));
|
||||
}
|
||||
//
|
||||
// Summary:
|
||||
// The event that is raised when a previously discovered remote system (device)
|
||||
// changes one of its monitored properties (see the properties of the RemoteSystem
|
||||
// class).
|
||||
public event OnRemoteSystemUpdated RemoteSystemUpdated;
|
||||
public delegate void OnRemoteSystemUpdated(RemoteSystemWatcher watcher, RemoteSystemUpdatedEventArgs args);
|
||||
internal void InvokeRemoteSystemUpdated(RemoteSystem remoteSystem)
|
||||
{
|
||||
RemoteSystemUpdated?(this, new RemoteSystemUpdatedEventArgs(remoteSystem));
|
||||
}
|
||||
//
|
||||
// Summary:
|
||||
// Starts watching for discoverable remote systems.
|
||||
public void Start()
|
||||
{
|
||||
_listener = new RemoteSystemDiscoveryListener(this);
|
||||
_watcher = _builder.SetListener(_listener).Result;
|
||||
_watcher.Start();
|
||||
}
|
||||
|
||||
//
|
||||
// Summary:
|
||||
// Stops watching for discoverable remote systems.
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
_watcher.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal class RemoteSystemDiscoveryListener : Java.Lang.Object, IRemoteSystemDiscoveryListener
|
||||
{
|
||||
private RemoteSystemWatcher watcher;
|
||||
|
||||
public RemoteSystemDiscoveryListener(RemoteSystemWatcher w)
|
||||
{
|
||||
watcher = w;
|
||||
}
|
||||
public void OnRemoteSystemAdded(Microsoft.ConnectedDevices.RemoteSystem remoteSystem)
|
||||
{
|
||||
watcher.InvokeRemoteSystemAdded(remoteSystem);
|
||||
}
|
||||
|
||||
public void OnRemoteSystemRemoved(string remoteSystemId)
|
||||
{
|
||||
watcher.InvokeRemoteSystemRemoved(remoteSystemId);
|
||||
}
|
||||
|
||||
public void OnRemoteSystemUpdated(Microsoft.ConnectedDevices.RemoteSystem remoteSystem)
|
||||
{
|
||||
watcher.InvokeRemoteSystemUpdated(remoteSystem);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{56EC46C7-3A80-46A1-86F0-652D2D8AD461}</ProjectGuid>
|
||||
<ProjectTypeGuids>{10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ConnectedDevices.Xamarin.Droid</RootNamespace>
|
||||
<AssemblyName>ConnectedDevices.Xamarin.Droid</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
|
||||
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
|
||||
<AndroidClassParser>class-parse</AndroidClassParser>
|
||||
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
|
||||
</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>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Android" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Additions\Platform.cs" />
|
||||
<Compile Include="Additions\RemoteLauncher.cs" />
|
||||
<Compile Include="Additions\RemoteSystem.cs" />
|
||||
<Compile Include="Additions\RemoteSystemWatcher.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Additions\AboutAdditions.txt" />
|
||||
<None Include="Jars\AboutJars.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<TransformFile Include="Transforms\EnumFields.xml" />
|
||||
<TransformFile Include="Transforms\EnumMethods.xml" />
|
||||
<TransformFile Include="Transforms\Metadata.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</TransformFile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<LibraryProjectZip Include="Jars\connecteddevices-sdk-armv7-external-release.aar" />
|
||||
<LibraryProjectZip Include="Jars\connecteddevices-core-armv7-external-release.aar" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedReferenceJar Include="Jars\org.apache.http.legacy.jar" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.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,24 @@
|
|||
This directory is for Android .jars.
|
||||
|
||||
There are 2 types of jars that are supported:
|
||||
|
||||
== Input Jar ==
|
||||
|
||||
This is the jar that bindings should be generated for.
|
||||
|
||||
For example, if you were binding the Google Maps library, this would
|
||||
be Google's "maps.jar".
|
||||
|
||||
Set the build action for these jars in the properties page to "InputJar".
|
||||
|
||||
|
||||
== Reference Jars ==
|
||||
|
||||
These are jars that are referenced by the input jar. C# bindings will
|
||||
not be created for these jars. These jars will be used to resolve
|
||||
types used by the input jar.
|
||||
|
||||
NOTE: Do not add "android.jar" as a reference jar. It will be added automatically
|
||||
based on the Target Framework selected.
|
||||
|
||||
Set the build action for these jars in the properties page to "ReferenceJar".
|
|
@ -0,0 +1,29 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Android.App;
|
||||
|
||||
// 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("ConnectedDevices.Xamarin.Droid")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ConnectedDevices.Xamarin.Droid")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[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("0.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.1.0.0")]
|
|
@ -0,0 +1,14 @@
|
|||
<enum-field-mappings>
|
||||
<!--
|
||||
This example converts the constants Fragment_id, Fragment_name,
|
||||
and Fragment_tag from android.support.v4.app.FragmentActivity.FragmentTag
|
||||
to an enum called Android.Support.V4.App.FragmentTagType with values
|
||||
Id, Name, and Tag.
|
||||
|
||||
<mapping jni-class="android/support/v4/app/FragmentActivity$FragmentTag" clr-enum-type="Android.Support.V4.App.FragmentTagType">
|
||||
<field jni-name="Fragment_name" clr-name="Name" value="0" />
|
||||
<field jni-name="Fragment_id" clr-name="Id" value="1" />
|
||||
<field jni-name="Fragment_tag" clr-name="Tag" value="2" />
|
||||
</mapping>
|
||||
-->
|
||||
</enum-field-mappings>
|
|
@ -0,0 +1,13 @@
|
|||
<enum-method-mappings>
|
||||
<!--
|
||||
This example changes the Java method:
|
||||
android.support.v4.app.Fragment.SavedState.writeToParcel (int flags)
|
||||
to be:
|
||||
android.support.v4.app.Fragment.SavedState.writeToParcel (Android.OS.ParcelableWriteFlags flags)
|
||||
when bound in C#.
|
||||
|
||||
<mapping jni-class="android/support/v4/app/Fragment.SavedState">
|
||||
<method jni-name="writeToParcel" parameter="flags" clr-enum-type="Android.OS.ParcelableWriteFlags" />
|
||||
</mapping>
|
||||
-->
|
||||
</enum-method-mappings>
|
|
@ -0,0 +1,42 @@
|
|||
<metadata>
|
||||
<!--
|
||||
This sample removes the class: android.support.v4.content.AsyncTaskLoader.LoadTask:
|
||||
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='AsyncTaskLoader.LoadTask']" />
|
||||
|
||||
This sample removes the method: android.support.v4.content.CursorLoader.loadInBackground:
|
||||
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='CursorLoader']/method[@name='loadInBackground']" />
|
||||
-->
|
||||
<!-- Change the visibility of a class -->
|
||||
<attr path="/api/package[@name='com.microsoft.connecteddevices']" name="managedName">Microsoft.ConnectedDevices</attr>
|
||||
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='Listenable']" name="visibility">public</attr>
|
||||
<attr path="/api/package[@name='com.microsoft.connecteddevices']/interface[@name='IRemoteSystemListener']/method[@name='onError' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" name="argsType">RemoteListenerErrorEventArgs</attr>
|
||||
|
||||
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientClosedStatus']" name="visibility">internal</attr>
|
||||
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientConnection']" name="visibility">internal</attr>
|
||||
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientConnection.BinaryClientListener']" name="visibility">internal</attr>
|
||||
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientConnection.DeviceListener']" name="visibility">internal</attr>
|
||||
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientConnection.RemoteLauncherListener']" name="visibility">internal</attr>
|
||||
<!--<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientConnectionStatus']" name="visibility">internal</attr>-->
|
||||
<!--<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientResponse']" name="visibility">internal</attr>-->
|
||||
<attr path="/api/package[@name='com.microsoft.connecteddevices']/interface[@name='IAppServiceClientConnectionListener']" name="visibility">internal</attr>
|
||||
<attr path="/api/package[@name='com.microsoft.connecteddevices']/interface[@name='IAppServiceResponseListener']" name="visibility">internal</attr>
|
||||
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceResponseEventArgs']" name="visibility">internal</attr>
|
||||
<attr path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='ErrorEventArgs']" name="visibility">internal</attr>
|
||||
<attr path="/api/package[@name='com.microsoft.connecteddevices']/interface[@name='IBinaryClientListenerInternal']" name="visibility">internal</attr>
|
||||
<attr path="/api/package[@name='com.microsoft.connecteddevices']/interface[@name='IDeviceListenerInternal']" name="visibility">internal</attr>
|
||||
<attr path="/api/package[@name='com.microsoft.connecteddevices']/interface[@name='IPlatformInitializionHandler']" name="visibility">internal</attr>
|
||||
<attr path="/api/package[@name='com.microsoft.connecteddevices']/interface[@name='IRemoteLaunchListener']" name="visibility">internal</attr>
|
||||
|
||||
|
||||
|
||||
<!--<remove-node path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientClosedStatus']" />-->
|
||||
<!--<remove-node path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientConnection.BinaryClientListener']" />
|
||||
<remove-node path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientConnection.DeviceListener']" />
|
||||
<remove-node path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientConnection.RemoteLauncherListener']" />
|
||||
<remove-node path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientConnectionStatus']" />
|
||||
<remove-node path="/api/package[@name='com.microsoft.connecteddevices']/class[@name='AppServiceClientResponse']" />-->
|
||||
|
||||
|
||||
|
||||
|
||||
</metadata>
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectedDevices.Xamarin.Droid", "ConnectedDevices.Xamarin.Droid\ConnectedDevices.Xamarin.Droid.csproj", "{56EC46C7-3A80-46A1-86F0-652D2D8AD461}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{56EC46C7-3A80-46A1-86F0-652D2D8AD461}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{56EC46C7-3A80-46A1-86F0-652D2D8AD461}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{56EC46C7-3A80-46A1-86F0-652D2D8AD461}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{56EC46C7-3A80-46A1-86F0-652D2D8AD461}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|