本文整理汇总了C#中View.GetMenuSelection方法的典型用法代码示例。如果您正苦于以下问题:C# View.GetMenuSelection方法的具体用法?C# View.GetMenuSelection怎么用?C# View.GetMenuSelection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View.GetMenuSelection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleEventShowManageBoatsMenu
public void HandleEventShowManageBoatsMenu(Model.Member member, View.Console view, Model.MemberRegister register)
{
while (true)
{
view.ShowMenu(View.Console.MenuEvent.ManageBoatsMenu, member);
int boatId;
switch (view.GetMenuSelection())
{
case View.Console.MenuEvent.AddBoat:
HandleEventAddNewBoat(member, view, register);
break;
case View.Console.MenuEvent.EditBoatMenu:
if (member.GetBoatCount() == 1)
{
boatId = member.GetBoats().First().ID;
}
else
{
view.ShowInputInfo(View.Console.MenuEvent.EditBoatMenu, member);
boatId = view.InputBoatID();
}
try
{
Model.Boat b = member.GetBoat(boatId);
HandleEventShowEditBoatMenu(member, b, view, register);
}
catch (ArgumentException)
{
view.ShowErrorMessage(View.Console.Error.NoBoatWithId, boatId.ToString());
view.Wait();
}
break;
case View.Console.MenuEvent.DeleteBoat:
if (member.GetBoatCount() == 1)
{
boatId = member.GetBoats().First().ID;
}
else
{
view.ShowInputInfo(View.Console.MenuEvent.DeleteBoat, member);
boatId = view.InputBoatID();
}
try
{
member.DeleteBoat(boatId);
break;
}
catch (ArgumentException)
{
view.ShowErrorMessage(View.Console.Error.NoBoatWithId, boatId.ToString());
view.Wait();
}
break;
case View.Console.MenuEvent.Back:
// exit menu
return;
}
}
}
示例2: ShowMainMenu
private void ShowMainMenu(View.Console view, Model.MemberRegister register)
{
while (true)
{
view.ShowMenu(View.Console.MenuEvent.MainMenu, null);
switch (view.GetMenuSelection())
{
case View.Console.MenuEvent.AddNewMember:
HandleEventNewMember(view, register);
break;
case View.Console.MenuEvent.MemberListMenu:
HandleEventShowMemberListMenu(view, register);
break;
case View.Console.MenuEvent.MemberInfoMenu:
view.ShowInputInfo(View.Console.MenuEvent.MemberInfoMenu, null);
int id = view.InputMemberID();
if (id == 0)
break;
try
{
Model.Member m = register.GetMember(id);
HandleEventShowMemberInfoMenu(m, view, register);
}
catch (ArgumentException)
{
view.ShowErrorMessage(View.Console.Error.NoMemberWithId, id.ToString());
view.Wait();
}
break;
case View.Console.MenuEvent.DeleteMember:
view.ShowInputInfo(View.Console.MenuEvent.DeleteMember, null);
id = view.InputMemberID();
if (id == 0)
break;
try
{
register.DeleteMember(register.GetMember(id));
register.Save();
}
catch (ArgumentException)
{
view.ShowErrorMessage(View.Console.Error.NoMemberWithId, id.ToString());
view.Wait();
}
break;
case View.Console.MenuEvent.Exit:
return;
}
}
}
示例3: HandleEventShowMemberListMenu
public void HandleEventShowMemberListMenu(View.Console view, Model.MemberRegister register)
{
while (true)
{
view.ShowMenu(View.Console.MenuEvent.MemberListMenu, null);
switch (view.GetMenuSelection())
{
case View.Console.MenuEvent.MemberListSimple:
view.ShowMemberList(register.GetMemberList(), true);
view.Wait();
break;
case View.Console.MenuEvent.MemberListComplete:
view.ShowMemberList(register.GetMemberList(), false);
view.Wait();
break;
case View.Console.MenuEvent.Back:
// exit menu.
return;
}
}
}
示例4: HandleEventShowEditBoatMenu
private void HandleEventShowEditBoatMenu(Model.Member member, Model.Boat boat,
View.Console view, Model.MemberRegister register)
{
while (true)
{
view.ShowMenu(View.Console.MenuEvent.EditBoatMenu, member);
switch (view.GetMenuSelection())
{
case View.Console.MenuEvent.EditBoatModel:
view.ShowInputInfo(View.Console.MenuEvent.EditBoatModel, member);
try
{
boat.Model = (Model.Boat.BoatModel)view.InputBoatModel();
register.Save();
}
catch (ArgumentException)
{
view.ShowErrorMessage(View.Console.Error.InvalidBoatModel, null);
view.Wait();
return;
}
break;
case View.Console.MenuEvent.EditBoatLength:
view.ShowInputInfo(View.Console.MenuEvent.EditBoatLength, member);
try
{
boat.Length = view.InputBoatLenght();
register.Save();
break;
}
catch (ArgumentException)
{
view.ShowErrorMessage(View.Console.Error.InvalidBoatLenght, null);
view.Wait();
break;
}
case View.Console.MenuEvent.Back:
// exit menu
return;
}
}
}
示例5: HandleEventShowMemberInfoMenu
public void HandleEventShowMemberInfoMenu(Model.Member member, View.Console view, Model.MemberRegister register)
{
while (true)
{
view.ShowMenu(View.Console.MenuEvent.MemberInfoMenu, member);
switch (view.GetMenuSelection())
{
case View.Console.MenuEvent.EditMemberName:
view.ShowInputInfo(View.Console.MenuEvent.EditMemberName, member);
try
{
member.Name = view.InputMemberName();
register.Save();
}
catch (ArgumentException)
{
view.ShowErrorMessage(View.Console.Error.InvalidMemberName, null);
view.Wait();
}
break;
case View.Console.MenuEvent.EditMemberPersonalNumber:
view.ShowInputInfo(View.Console.MenuEvent.EditMemberPersonalNumber, member);
try
{
member.PersonalNumber = view.InputMemberPersonalNumber();
register.Save();
}
catch (ArgumentException)
{
view.ShowErrorMessage(View.Console.Error.InvalidPersonalNumber, null);
view.Wait();
}
break;
case View.Console.MenuEvent.ManageBoatsMenu:
HandleEventShowManageBoatsMenu(member, view, register);
register.Save();
break;
case View.Console.MenuEvent.Back:
// exit menu.
return;
}
}
}