我正在学习Xamarin e我创建了一个计算Bhaskara(跨平台)的应用程序。它完美无缺,但当我决定更改应用名称by changing the Assembly Name和图标时,I get these errors。
我不使用任何Git,所以我只是粘贴我的代码:
MainPage.xaml中:
`<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:firstProject"
x:Class="firstProject.MainPage">
<StackLayout Margin="10,10,10,0">
<Label Text="Insira o valor 'a':"
FontFamily="Century Gothic"
FontSize="17"
TranslationY="40"
TranslationX="4"/>
<Entry x:Name="aEntry"
Keyboard="Numeric"
TranslationX="0"
TranslationY="25"
/>
<Label Text="Insira o valor 'b':"
FontFamily="Century Gothic"
FontSize="17"
TranslationY="40"
TranslationX="4"/>
<Entry x:Name="bEntry"
Keyboard="Numeric"
TranslationX="0"
TranslationY="25"/>
<Label Text="Insira o valor 'c':"
FontFamily="Century Gothic"
FontSize="17"
TranslationY="40"
TranslationX="4"/>
<Entry x:Name="cEntry"
Keyboard="Numeric"
TranslationX="0"
TranslationY="25"/>
<Button x:Name="btnCalcular"
Text="Calcular"
FontFamily="Century Gothic"
FontSize="17"
TranslationY="50"
Clicked="btnCalcular_Clicked"/>
</StackLayout>
`
MainPage.xaml.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace firstProject
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
public void Limpador()
{
aEntry.Text = "";
bEntry.Text = "";
cEntry.Text = "";
aEntry.Focus();
}
private void btnCalcular_Clicked(object sender, EventArgs e)
{
double a, b, c, delta, res1, res2;
a = Convert.ToDouble(aEntry.Text);
if (aEntry.Text == "0")
{
DisplayAlert("Oops!", "Eita! 'a' não pode ser igual a 0!", "Ah, ta...");
Limpador();
}
else
{
b = Convert.ToDouble(bEntry.Text);
c = Convert.ToDouble(cEntry.Text);
delta = b * b - 4 * a * c;
if (delta < 0)
{
DisplayAlert("Oops!", "Delta é menor que 0, não há raiz no conjunto dos reais", "Okay");
Limpador();
}
else
{
res1 = (-(b) + Math.Sqrt(delta)) / (2 * a);
res2 = (-(b) - Math.Sqrt(delta)) / (2 * a);
DisplayAlert("Resultados", "As raízes são: " + res1 + " e " + res2, "Legal!");
Limpador();
}
}
}
}
}
我没有触及任何其他“活动”,只写了上面的代码。有人能帮助我吗?
答案 0 :(得分:0)
之前我遇到过这个问题。
我做了什么来解决它:
bin
和obj
文件夹这通常为我自己解决了这种错误。