简体   繁体   English

我如何使用PCL项目在Xamarin中为Android和iOS开发应用程序?

[英]How do i Use a PCL project to develop an app for Android and iOS in Xamarin?

I have created a Xamarin PCL project, it has Android iOS and Portable. 我创建了一个Xamarin PCL项目,它有Android iOS和Portable。 I had a look at few examples, where in you can create a Login Page using Xaml and then validate those credentials using a CS file for it,but my question is lets say I validate those credentials, how do I jump from that UI page which is universal I suppose to the Android or the iOS part? 我看了几个例子,你可以在哪里使用Xaml创建一个登录页面,然后使用CS文件验证这些凭据,但我的问题是我可以说我验证了这些凭据,我如何从那个UI页面跳转是普遍的我想Android或iOS部分?

And where do I start ?? 我从哪里开始?

Sorry if I am being naive, I am new to Xamarin, any help would be appreciated. 对不起,如果我天真,我是Xamarin的新手,任何帮助将不胜感激。

This is the sample i'm referring for Portable, 这是我所说的便携式样品,

using System;
using Xamarin.Forms;

namespace StoreCredentials
{
    public class HomePageCS : ContentPage
    {
        public HomePageCS ()
        {
            var toolbarItem = new ToolbarItem {
                Text = "Logout"
            };
            toolbarItem.Clicked += OnLogoutButtonClicked;
            ToolbarItems.Add (toolbarItem);

            Title = "Home Page";
            Content = new StackLayout { 
                Children = {
                    new Label {
                        Text = "Main app content goes here",
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions = LayoutOptions.CenterAndExpand
                    }
                }
            };
        }

        async void OnLogoutButtonClicked (object sender, EventArgs e)
        {
            DependencyService.Get<ICredentialsService> ().DeleteCredentials ();
            Navigation.InsertPageBefore (new LoginPage (), this);
            await Navigation.PopAsync ();
        }
    }
}

I would recommend you to read this before diving into Xamarin. 在潜入Xamarin之前,我建议你阅读这篇文章 Also, this as it relates to something you are trying to do. 此外, 与你想要做的事情有关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Xamarin(iOS和Android)应用程序中使用Windows名称空间? - How do I use Windows namespaces in Xamarin (iOS and Android) app? 如何在Xamarin iOS项目中使用签名程序集(PCL)? - How to consume a signed assembly (PCL) in a Xamarin iOS project? 如何通过Nuget将Microsoft.Net.Http安装到Xamarin.Forms PCL项目? - How do I install Microsoft.Net.Http via Nuget to Xamarin.Forms PCL project? 应用程序崩溃 IOS 在 PCL 中启动 Xamarin - App Crashes On IOS Start Up In PCL Xamarin 在pcl中使用TcpClient进行Xamarin定位ios和android - Using TcpClient in pcl for xamarin targeting ios and android 如何在Windows上使用Xamarin Studio开发iOS应用程序? - How to develop iOS app using Xamarin Studio on Windows? 如何使用iOS共享扩展程序使用Xamarin Forms从Photos应用程序检索图像? - How do I use iOS Share Extension to retrieve an image from the Photos App using Xamarin Forms? 如何检查PCL项目xamarin中是否可以访问服务器? - How to check if server is reachable in PCL project xamarin? 无法将Xamarin.Android和Xamarin.iOS添加到PCL - Unable to add Xamarin.Android and Xamarin.iOS to PCL 我是否可以仅使用Xamarin PCL来定位iOS和Android并具有更多.NET功能? - Can I target iOS and Android only with a Xamarin PCL and have more .NET features?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM