本文整理汇总了C#中Menu.AddMenuItem方法的典型用法代码示例。如果您正苦于以下问题:C# Menu.AddMenuItem方法的具体用法?C# Menu.AddMenuItem怎么用?C# Menu.AddMenuItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu.AddMenuItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DisplaySubsiteMenu
/// <summary>
/// Displays the subsite menu.
/// </summary>
/// <param name="installOptionsToUse">The install options to use.</param>
private void DisplaySubsiteMenu(InstallOptions installOptionsToUse)
{
Menu rootSiteSelection = new Menu();
var iisManager = new ServerManager();
SiteCollection sites = iisManager.Sites;
for (int i = 0; i < sites.Count; i++)
{
int iVal = i;
var site = sites[iVal];
var firstBinding = site.Bindings.FirstOrDefault();
var hostname = firstBinding != null
? (!string.IsNullOrEmpty(firstBinding.Host) ? firstBinding.Host : Strings.DefaultBinding)
: Strings.DefaultBinding;
rootSiteSelection.AddMenuItem(
Convert.ToString(iVal + 1),
string.Format("{0} ({1})", site.Name, hostname),
(Action)delegate { installOptionsToUse.RootSite = sites[iVal]; },
new object[] { });
}
rootSiteSelection.DisplayMenu(true);
}
示例2: Update
protected override void Update(GameTime gameTime)
{
if (metaState == MetaState.InitialLoad)
{
splashScreen = new SplashScreen();
metaState = MetaState.SplashScreen;
}
// Controls
//if (GamePad.GetState(Game.playerIndex).Buttons.Back == ButtonState.Pressed)
// this.Exit();
if (HighScoreTracker.device!=null && Keyboard.GetState().IsKeyDown(Keys.Escape))
{
HighScoreData data = HighScoreTracker.LoadHighScores();
data.soundEffectsEnabled = gameSettings.soundEffectsEnabled;
data.musicEnabled = gameSettings.musicEnabled;
data.displayHelp = gameSettings.displayControls;
data.wideScreen = gameSettings.wideScreen;
data.keyboardControls = gameSettings.keyboardControls;
HighScoreTracker.SaveHighScores(data);
Logger.CloseLogger();
this.Exit();
}
if (metaState == MetaState.SplashScreen)
{
if (MenuResult.GoToMainMenu == splashScreen.Update(gameTime))
{
base.Initialize();
try
{
if (Guide.IsVisible == true)
splashScreen.stillActive = true;
else
StorageDevice.BeginShowSelector(this.GetDevice, "Select Storage Device");
}
catch
{
splashScreen.stillActive = true;
}
}
}
if (HighScoreTracker.device != null && HighScoreTracker.device.IsConnected == true)
{
showRetry = false;
}
if (backToRetry == true || (HighScoreTracker.device != null && showRetry == false && HighScoreTracker.device.IsConnected == false))
{
if (Guide.IsVisible == false)
{
try
{
StorageDevice.BeginShowSelector(this.RetryDevice, "Select Storage Device");
backToRetry = false;
showRetry = true;
}
catch
{
}
}
}
if (metaState == MetaState.SplashScreen && deviceSelected==true)
{
HighScoreData data = HighScoreTracker.LoadHighScores();
gameSettings = new GameSettings();
gameSettings.displayControls = data.displayHelp;
gameSettings.musicEnabled = data.musicEnabled;
gameSettings.soundEffectsEnabled = data.soundEffectsEnabled;
gameSettings.fullScreen = data.fullScreen;
gameSettings.wideScreen = data.wideScreen;
gameSettings.keyboardControls = data.keyboardControls;
currentSettings = new Settings();
p1engine = new Engine(-1);
mainMenu = new MainMenu();
pauseMenu = new PauseMenu();
summaryMenu = new SummaryMenu(false);
gameOverMenu = new GameOverMenu();
selectMenu = new LevelSelectMenu();
tutorialLauncher = new TutorialLauncher();
settingsMenu = new Menu(MenuClass.SettingsMenu);
currentSettings = new Settings();
p1engine = new Engine(-1);
mainMenu = new MainMenu();
pauseMenu = new PauseMenu();
summaryMenu = new SummaryMenu(false);
gameOverMenu = new GameOverMenu();
selectMenu = new LevelSelectMenu();
tutorialLauncher = new TutorialLauncher();
settingsMenu = new Menu(MenuClass.SettingsMenu);
if(Guide.IsTrialMode)
mainMenu.AddMenuItem(MenuResult.GoToTutorial, "Tutorial", "Learn to play Jellyfish, MD");
mainMenu.AddMenuItem(MenuResult.GoToTimeAttack, "Emergency Room", "Score as many points as you can within the \ntime limit.");
mainMenu.AddMenuItem(MenuResult.GoToMoveChallenge, "Operation", "Score as many points as you can with a \nlimited number of moves.");
mainMenu.AddMenuItem(MenuResult.GoToPuzzle, "Challenge", "Solve a series of unique challenges.");
if(Guide.IsTrialMode==false)
mainMenu.AddMenuItem(MenuResult.GoToTutorial, "Tutorial", "Learn to play Jellyfish, MD");
mainMenu.AddMenuItem(MenuResult.BuyFullGame, "Unlock Full Game", "Purchase the full version of Jellyfish, MD");
mainMenu.AddMenuItem(MenuResult.GoToJellyfishCity, "Jellyfish Parade", "Check in on your former patients!");
//.........这里部分代码省略.........
示例3: CheckParameters
/// <summary>
/// Checks all required parameters are supplied, and requests
/// them from the user when they are missing.
/// </summary>
/// <param name="installOptionsToUse">The install options.</param>
private void CheckParameters(InstallOptions installOptionsToUse)
{
if (installOptionsToUse.Quiet)
{
if (installOptionsToUse.Mode == InstallerMode.Unknown)
{
installOptionsToUse.Install = true;
}
return;
}
if (installOptionsToUse.Mode == InstallerMode.Unknown)
{
Menu menu = new Menu();
menu.AddMenuItem("I", "Install", (Action)delegate { installOptionsToUse.Install = true; }, new object[] { });
menu.AddMenuItem("R", "Repair / Upgrade Database", (Action)delegate { installOptionsToUse.Repair = true; }, new object[] { });
menu.AddMenuItem("U", "Uninstall", (Action)delegate { installOptionsToUse.Uninstall = true; }, new object[] { });
menu.AddMenuItem("Q", "Quit", (Action<int>)Environment.Exit, new object[] { 0 });
menu.DisplayMenu();
}
if (installOptionsToUse.Mode == InstallerMode.Install || installOptionsToUse.Mode == InstallerMode.Uninstall)
{
Menu menu = new Menu();
menu.AddMenuItem("S", string.Format("Standard {0}", installOptionsToUse.Mode), (Action)delegate { installOptionsToUse.Api = false; }, new object[] { });
menu.AddMenuItem("A", string.Format("API {0}", installOptionsToUse.Mode), (Action)delegate { installOptionsToUse.Api = true; }, new object[] { });
menu.AddMenuItem("Q", "Quit", (Action<int>)Environment.Exit, new object[] { 0 });
menu.DisplayMenu();
menu = new Menu();
menu.AddMenuItem("R", string.Format("Root {0}", installOptionsToUse.Mode), (Action)delegate { installOptionsToUse.RootSite = null; }, new object[] { });
menu.AddMenuItem("S", string.Format("Subsite {0}", installOptionsToUse.Mode), new Action<InstallOptions>(this.DisplaySubsiteMenu), new object[] { installOptionsToUse });
menu.AddMenuItem("Q", "Quit", (Action<int>)Environment.Exit, new object[] { 0 });
menu.DisplayMenu();
string descriptionText = installOptionsToUse.Api ? Strings.APIDescription : Strings.StandardDescription;
string exampleUrl = installOptionsToUse.Api ? Strings.APIExampleURL : Strings.StandardExampleURL;
if (installOptionsToUse.RootSite != null && string.IsNullOrEmpty(installOptionsToUse.WebsiteName))
{
var binding = installOptionsToUse.RootSite.Bindings.FirstOrDefault(b => !string.IsNullOrEmpty(b.Host));
var hostname = binding != null ? binding.Host : Strings.DefaultBinding;
installOptionsToUse.HostName = hostname;
if (binding == null)
{
// Show the user a warning if the default bindings Host value is blank.
installLogger.LogWarningLine(Strings.DefaultBindingWarning);
}
installLogger.LogLine(null);
installLogger.LogWarningLine(string.Format(Strings.SubsiteDescription, hostname));
installLogger.LogLine(null);
installOptionsToUse.WebsiteName = this.ReadValidSiteName("Subsite Path (no slashes)");
}
else if (string.IsNullOrEmpty(installOptionsToUse.WebsiteName))
{
installLogger.LogLine(null);
installLogger.LogWarningLine(descriptionText);
installLogger.LogLine(null);
installOptionsToUse.WebsiteName = this.ReadValidSiteName(string.Format("Website Name (eg. {0})", exampleUrl));
}
if (installOptionsToUse.Mode == InstallerMode.Install && installOptionsToUse.Api && string.IsNullOrEmpty(installOptionsToUse.IapplyWebsiteName))
{
installLogger.LogLine(null);
installLogger.LogWarningLine(Strings.BaseWebsiteDescription);
installLogger.LogLine(null);
installOptionsToUse.IapplyWebsiteName = this.ReadValidSitePath(string.Format("iApply Website Name (eg. {0} - blank for {1})", Strings.StandardExampleURL, installOptionsToUse.WebsiteName));
}
}
if (installOptionsToUse.Mode != InstallerMode.Install && installOptionsToUse.Mode != InstallerMode.Repair)
{
return;
}
bool connectionStringSpecified = !string.IsNullOrEmpty(installOptionsToUse.MongoHost) && !string.IsNullOrEmpty(installOptionsToUse.MongoDatabase);
if (string.IsNullOrEmpty(installOptionsToUse.MongoHost))
{
installOptionsToUse.MongoHost = this.ReadInput("MongoDB Host", "LOCALHOST");
}
if (!installOptionsToUse.MongoPort.HasValue)
{
installOptionsToUse.MongoPort = Convert.ToInt32(this.ReadInput("MongoDB Port ", "27017"));
}
if (string.IsNullOrEmpty(installOptionsToUse.MongoDatabase))
{
installOptionsToUse.MongoDatabase = this.ReadInput("MongoDB Database Name");
}
//.........这里部分代码省略.........