我如何在 xamarin 中制作我将点击智能手机并将结果显示在 winforms 上的内容?
How can i make in xamarin that i will click on the smartphone and it will display the results on winforms?
我在 visual studio 2013 年通过 xamarin 创建了一个新的 android 应用程序。
默认项目是这样的,当我点击我的 phone 屏幕时,它会计算我的 phone 我点击的次数。
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace App1
{
[Activity(Label = "App1", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.MyButton);
button.Click += delegate {
button.Text = string.Format("{0} clicks!", count++);
};
}
}
}
但我想知道当我点击我的 phone 屏幕时是否可以做到这一点,它会像现在一样在 phone 屏幕上显示点击次数,但也会显示点击次数单击 winforms 设计器?
我知道 xamarin 没有 winforms 但可能连接到另一个 winforms 项目?
我能想到的唯一方法是使用网络服务,或者——这是一种棘手的方法——通过蓝牙连接进行通信。没有任何构建可以满足您的需求。
我在 visual studio 2013 年通过 xamarin 创建了一个新的 android 应用程序。 默认项目是这样的,当我点击我的 phone 屏幕时,它会计算我的 phone 我点击的次数。
using System;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace App1
{
[Activity(Label = "App1", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.MyButton);
button.Click += delegate {
button.Text = string.Format("{0} clicks!", count++);
};
}
}
}
但我想知道当我点击我的 phone 屏幕时是否可以做到这一点,它会像现在一样在 phone 屏幕上显示点击次数,但也会显示点击次数单击 winforms 设计器?
我知道 xamarin 没有 winforms 但可能连接到另一个 winforms 项目?
我能想到的唯一方法是使用网络服务,或者——这是一种棘手的方法——通过蓝牙连接进行通信。没有任何构建可以满足您的需求。