我是 Xamarin 的新手,我正在学习 Xamarin 大学教程。一切正常,直到我开始遇到错误core does not exist
。我查看了发布的一个旧问题并按照说明进行操作,但这对我没有任何帮助。我已经发布了下面旧问题的链接。
MainPage.xml.cs 的代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace MyTelephone
{
public partial class MainPage : ContentPage
{
Entry phoneNumberText;
Button translateButton;
Button callButton;
string translatedNumber;
public MainPage()
{
this.Padding = new Thickness(20, 20, 20, 20);
StackLayout panel = new StackLayout
{
Spacing = 15
};
panel.Children.Add(new Label
{
Text = "Enter a password:",
FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label))
});
panel.Children.Add(phoneNumberText = new Entry
{
Text = "1-855-XAMARIN",
});
panel.Children.Add(translateButton = new Button
{
Text = "Translate"
});
panel.Children.Add(callButton = new Button
{
Text = "Call",
IsEnabled = false,
});
translateButton.Clicked += OnTranslate;
this.Content = panel;
//InitializeComponent();
}
private void OnTranslate(object sender, EventArgs e)
{
translatedNumber =
Core.PhonewordTranslator.ToNumber(phoneNumberText.Text);
if (!string.IsNullOrEmpty(translatedNumber))
{
callButton.IsEnabled = true;
callButton.Text = "Call" + translatedNumber;
}
else
{
callButton.IsEnabled = false;
callButton.Text = "Call";
}
}
}
}
相关分类