我编写的代码没有编译器错误,但是每次我尝试运行该程序时,都会收到上述错误消息。当我单击编译器错误时,它将带我到“ MainPage”代码。我没有触及此页面上的任何内容,也无法理解为什么我编写的没有编译器错误的代码会强制将其标记为错误。
我的代码:
using SnapsLibrary;
class Order
{
public void StartProgram()
{
SnapsEngine.SetTitleString("Select Type of Product");
int TrophyCount = 0;
int MedalCount = 0;
while (true)
{
string ProductChoice = SnapsEngine.SelectFrom3Buttons(
"Trophy",
"Medal",
"Order Total");
if (ProductChoice == "Trophy")
SnapsEngine.ClearTextDisplay();
SnapsEngine.AddLineToTextDisplay("Trophy Type");
string TrophyChoiceType = SnapsEngine.SelectFrom3Buttons(
"Football",
"Rugby",
"Hockey");
TrophyCount = TrophyCount + 1;
if (ProductChoice == "Medal")
SnapsEngine.ClearTextDisplay();
SnapsEngine.AddLineToTextDisplay("Medal Type");
string MedalChoiceType = SnapsEngine.SelectFrom3Buttons(
"1st",
"2nd",
"3rd");
MedalCount = MedalCount + 1;
if (ProductChoice == "Order Total")
{
SnapsEngine.ClearTextDisplay();
SnapsEngine.AddLineToTextDisplay("Order Totals");
SnapsEngine.AddLineToTextDisplay(TrophyCount.ToString() + "Trophy");
if (TrophyCount > 1)
{
SnapsEngine.AddLineToTextDisplay(TrophyCount.ToString() + "Trophies");
}
SnapsEngine.AddLineToTextDisplay(TrophyChoiceType.ToString() + "");
SnapsEngine.AddLineToTextDisplay(MedalCount.ToString() + " Medal(s)");
SnapsEngine.AddLineToTextDisplay(MedalChoiceType.ToString() + "");
string reply = SnapsEngine.SelectFrom2Buttons(item1: "Done", item2: "Reset");
if (reply == "Reset")
{
TrophyCount = 0;
MedalCount = 0;
}
SnapsEngine.ClearTextDisplay();
}
}
}
}
将其引导到的代码:
SnapsManager.ActiveSnapsManager.StartProgram(typeof(MyProgram), "StartProgram");
这是一个非常基本的程序,但是我打算进行扩展和改进。
答案 0 :(得分:1)
多亏了Rup我已经解决了。
SnapsManager可以用于整个学习系统,而不仅仅是我对程序的program脚尝试,
我已经将我的班级从Order更改为MyProgram,并且它现在正在运行,它无法按我的预期工作,所以回到了绘图板上。