Tag: xamarin

Xamarin部署不适用于Android

我已经建立了一个新的 Xamarin.Forms项目。 我想构建它并将其部署到模拟器或Android设备,但它无法正常工作。 在Visual Studio的Outputwindow中,显示以下错误: 该应用程序无法启动。 确保已将应用程序安装到目标设备并具有可启动活动(MainLauncher = true)。 更新: 如果我查看构建日志,我可以找到以下内容: 2> Mono.AndroidTools.InstallFailedException:意外的安装输出:错误:无法访问包管理器。 系统在运行吗? 2> bei Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output,String packageName) 2> bei Mono.AndroidTools.AndroidDevice.c__AnonStoreyD。 m__0(任务`1 t) 2> bei System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke() 2> bei System.Threading.Tasks.Task.Execute() 2>由于内部错误导致部署失败:意外安装输出:错误:无法访问程序包管理器。 系统在运行吗?

条目Xamarin表格PCL上的边界半径

有没有办法在Xamarin的XAML中的Entry上设置边框半径,或者使用自定义渲染器或其他东西? 我到目前为止所做的一切都没有效果,但对于我的应用,如果我有圆形边框会更好。 提前谢谢你的回答! PS:我已经查过这篇文章,但我没有找到答案:)

如何设置Xamarin MonoMac项目,使其构建输出.app包而不是.exe?

我正在尝试在Xamarin中构建MonoMac项目时将Mac包(.app)作为构建输出。 该项目实际上是一个默认项目 – 它只显示一个空窗口,可以通过以下方式在Xamarin中创建: 添加新项目… ,选择Mac(开源) ,然后选择MonoMac项目(C#) 。 项目构建没有错误,但构建输出是.exe文件。 如何设置项目构建,以便输出.app包而不是.exe? 我查看了Project Options – > Build – > General ,其中可以选择Compile Target为* Executable / Executable with GUI /…*但这不是我需要的。 还看了Xamarin工作室首选项 – >项目 – >构建,但它也没有帮助。 我的设置: – Xamarin studio 4.0.3 (build 13) which includes free MonoMac – Xcode 4.6.1 (2067, build 4H512); gcc installed – Mono frameworks 2.10.9 and […]

xamarin形成清晰的选择器

我是Xamarin以及c#和xaml的新手,所以这是一次非常学习的经历。 我正在尝试做我认为简单的任务(明确挑选者选择),但事实certificate它已成为一项挑战。 期望的function:具有选择器选择的页面,进行选择,将选择保存到变量,移动到不同的页面然后清除所做的选择,因此当返回到第一页时没有进行选择。 我尝试使用picker.Items.Clear()并设置SelectedIndex = -1,但我一直得到OutOfRangeException。 我尝试过这篇文章,但无法使用任何选项: 如果在xamarin表单中选择它,如何清除选择器? 我不想将选择器设置为第一个选项,我希望它为空,因此显示选择器标题,这是它在第一次运行时的工作方式,但是当我进行选择并移动到下一页,当我回去,我的初步选择仍在进行中。 希望一切都有意义,我正在努力实现。 以下是我的基本代码,任何帮助或方向将不胜感激。 MainPage.xaml中: MainPage.xaml.cs中: public MainPage() { InitializeComponent(); OptionSelect.Items.Add(“Option 1”); OptionSelect.Items.Add(“Option 2”); OptionSelect.Items.Add(“Option 3”); } public void OptionSelect_OnSelectedIndexChanged(object sender, EventArgs e) { var option = OptionSelect.Items[OptionSelect.SelectedIndex]; //OptionSelect.Items.Clear(); //OptionSelect.Items.Add(“Option 1”); //OptionSelect.Items.Add(“Option 2”); //OptionSelect.Items.Add(“Option 3”); //OptionSelect.SelectedIndex = -1; Navigation.PushAsync(new Page1()); }

从服务器xamarin.android收到的证书无效

所以这让我疯狂了一天。 我正在尝试与xamarin.android上的REST API交谈但由于某种原因我收到此错误: InnerException {Mono.Security.Protocol.Tls.TlsException:从服务器收到的证书无效。 错误代码:0xoffffffff.Handshake.Client.TlsServerCertificate.RemoteValidation(Mono.Security.Protocol.Tls.ClientContext上下文,AlertDescription描述)[0x00000]中的错误代码:0xffffffff800b010a:0:Mono.Security.Protocol.Tls。 Handshake.Client.TlsServerCertificate.validateCertificates(Mono.Security.X509.X509CertificateCollection证书)[0x00000] in:0 at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1()[0x00000] in:0 at Mono。 Security.Protocol.Tls.Handshake.HandshakeMessage.Process()[0x00000] in:0 at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage(Mono.Security.Protocol.Tls.TlsStream handMsg)[0x00000] in:0 at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback(IAsyncResult asyncResult)[0x00000] in:0} Mono.Security.Protocol.Tls.TlsException 经过一些研究后,我发现这与我正在谈论的服务器丢失的证书有关(如果我错了,请纠正我)。 所以我将SSL证书添加到Mac上的钥匙串中。 我还运行了Mozilla命令来安装默认证书。 不幸的是,这仍然无效。 在Windows上,与API的连接就像魅力一样。 从我读到的这是因为Windows有自己的CA商店和一些默认证书。

ListView中有比我需要的空间更多的空间

我正在使用StackLayout和ListView来显示视图的某些部分,但ListView占用的空间比我需要的多,并且在列表的最后一行和配置文件延续之间留下了空白。 看来我的ListView有比真实列表的长度更多的行,或者它有一个固定的高度,我不知道……这是我的XAML: 我该如何解决? 我看到人们使用HasUnevenRows=”True”但它对我不起作用。

无法将Linq2Twitter包添加到Xamarin Studio

尝试将Linq2Twitter NuGet包添加到Xamarin Studio时,出现以下错误: 找不到路径“(..)/ packages / linqtotwitter.3.1.1 / linqtotwitter.3.1.1.nupkg”的一部分。 以前该软件包已安装但无法从我的代码中引用。 经过一番研究后,我发现可能与缺少对PCL的支持有关( http://lastexitcode.com/blog/2014/11/16/InstallingPortableClassLibrariesForXamarinStudio/ ) 在http://www.mono-project.com/download/安装单声道MDK(Mono开发套件)后,我无法再将软件包添加到我的项目中。 有任何想法吗 :-)

Xamarin Resource.designer.cs没有为新添加文件生成引用

当我将ImageView的src属性设置为@ drawable / citybase时,我在设计视图中没有显示图像时,我将一个名为citybase.png的文件添加到我的drawable文件夹中。 检查Resource.designer.cs类我意识到没有为我添加到drawable文件夹的任何文件生成引用(当然除了默认的Icon)。 public partial class Drawable { // aapt resource value: 0x7f020000 public const int Icon = 2130837504; static Drawable() { global::Android.Runtime.ResourceIdManager.UpdateIdValues(); } private Drawable() { } } 我尝试重建和清理项目,但这不起作用。 我该如何解决这个问题? (Xamarin Studio 4.2.3)

如何在Xamarin Android中运行时执行C#代码?

我在Xamarin Studio中有一个Android应用程序。 我想执行文本中的代码(字符串)。 例如, 这个问题在Visual Studio Windows应用程序中帮助我。 但是我不能在Xamarin Android中使用这个答案。 这是我在C#Windows应用程序中的示例: public class CodeLuncher { public static void LunchCSCode(string site, string typeName, string methosName) { try { var provider = CSharpCodeProvider.CreateProvider(“c#”); var options = new CompilerParameters(); string text = new System.Net.WebClient().DownloadString(site); foreach (var item in GetRefrences(text)) { options.ReferencedAssemblies.Add(item); } string code = GetCode(text); var results = […]

如何从Microsoft Azure Mobile Services中的表中读取数据并将其放入我的应用程序中?

我正在使用Xamarin Studio和Microsoft Azure Mobile Services。 我正在尝试读取我放入Microsoft Azure Mobile Service中的表中的数据并将其显示在我的应用程序中。 我按照Azure网站上的所有教程进行了操作,但我似乎无法找到如何从表中获取数据。 我想向用户显示他们输入表格的内容。 这是我在表格中输入数据的代码: //this just sets up the connection and table private static readonly MobileServiceClient MobileService = new MobileServiceClient (UsersConstants.ApplicationURL, UsersConstants.ApplicationKey); private readonly IMobileServiceTable usersTable = MobileService.GetTable(); //this creates a new item var NewItem = new UsersTable (); NewItem.Name = NameTextBox.Text; NewItem.Email = EmailTextBox.Text; NewItem.Password = […]