本文整理汇总了C#中MainMenu类的典型用法代码示例。如果您正苦于以下问题:C# MainMenu类的具体用法?C# MainMenu怎么用?C# MainMenu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MainMenu类属于命名空间,在下文中一共展示了MainMenu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: loginBT_Click
private void loginBT_Click(object sender, EventArgs e)
{
if (usernameTB.Text.Length > 0 && passwordTB.Text.Length > 0) // Έλεγχος
{
var userid = DB.DbQueries.AuthenticateAuthor(usernameTB.Text, passwordTB.Text);
if (userid > 0)
{
ActiveAuthor.SetCurrentAuthor(userid); // Θέτουμε τον ActiveAuthor
var mm = new MainMenu { Tag = this }; // Ανοίγουμε το Main Menu
mm.Show(this);
Hide();
}
else if (userid == 0)
{
MessageBox.Show("Invalid Username/Password!",
"Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
MessageBox.Show("You need to enter Username and Password!",
"Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
示例2: MyForm
public MyForm()
{
// Set the form's title
Text = "Image Viewer";
// Set the form's size
ClientSize = new Size (640, 480);
// Create a menu
MainMenu menu = new MainMenu ();
MenuItem item = menu.MenuItems.Add ("&Options");
item.Popup += new EventHandler (OnPopupOptionsMenu);
item.MenuItems.Add (new MenuItem ("&Open...",
new EventHandler (OnOpenImage), Shortcut.CtrlO));
item.MenuItems.Add ("-");
item.MenuItems.Add (_itemFitToWindow =
new MenuItem ("Size Image to &Fit Window",
new EventHandler (OnFitToWindow))
);
item.MenuItems.Add (_itemNativeSize =
new MenuItem ("Show Image in &Native Size",
new EventHandler (OnNativeSize))
);
item.MenuItems.Add ("-");
item.MenuItems.Add (new MenuItem ("E&xit",
new EventHandler (OnExit)));
// Attach the menu to the form
Menu = menu;
}
示例3: Main
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
LudusLatrunculorum = new MainMenu();
Application.Run(LudusLatrunculorum);
}
示例4: Start
// Use this for initialization
void Start()
{
mainMenu = (MainMenu)(GameObject.Find("Main Menu").GetComponent("MainMenu"));
CelebTextures = mainMenu.CelebTextures;
if (GameStateManager.CelebFriend != -1 )
FriendTexture = CelebTextures[GameStateManager.CelebFriend];
else if (GameStateManager.FriendTexture != null) FriendTexture = GameStateManager.FriendTexture;
float diceRoll = Random.value;
if (diceRoll <= FriendThreshold)
{
gameObject.tag = "Friend";
renderer.material.mainTexture = FriendTexture;
}
else
{
gameObject.tag = "Enemy";
int numValidCelebs = GameStateManager.CelebFriend == -1 ? CelebTextures.Length - 1 : CelebTextures.Length - 2;
int which = Random.Range(0,numValidCelebs);
if (GameStateManager.CelebFriend == which)
which = CelebTextures.Length - 1;
EnemyTexture = CelebTextures[which];
renderer.material.mainTexture = EnemyTexture;
}
}
示例5: MainForm
public MainForm ()
{
//
// _mainMenu
//
_mainMenu = new MainMenu ();
//
// _fileMenu
//
_fileMenu = new MenuItem ("&File");
_fileMenu.MenuItems.Add (new MenuItem ("New"));
_fileMenu.MenuItems.Add (new MenuItem ("Open"));
_fileMenu.MenuItems.Add (new MenuItem ("Save"));
_mainMenu.MenuItems.Add (_fileMenu);
//
// _editMenu
//
_editMenu = new MenuItem ("&Edit");
_editMenu.MenuItems.Add (new MenuItem ("Copy"));
_editMenu.MenuItems.Add (new MenuItem ("Cut"));
_editMenu.MenuItems.Add (new MenuItem ("Paste"));
_mainMenu.MenuItems.Add (_editMenu);
//
// MainForm
//
ClientSize = new Size (300, 50);
Location = new Point (250, 100);
Menu = _mainMenu;
StartPosition = FormStartPosition.Manual;
Text = "bug #333668";
Load += new EventHandler (MainForm_Load);
}
示例6: btnLogin_Click
private void btnLogin_Click(object sender, EventArgs e)
{
if (UsuarioBox.Text == null | PassBox.Text == null)
{
MessageBox.Show("Por favor llene ambos campos");
}
else
{
string user;
string pass;
user = UsuarioBox.Text;
pass = PassBox.Text;
if (ConfirmarLogin(user, pass))
{
MainMenu mm = new MainMenu();
mm.ShowDialog();
this.Hide();
}
else
{
MessageBox.Show("Credenciales inválidos");
UsuarioBox.Focus();
}
}
}
示例7: StartPage
public StartPage()
{
try
{
InitializeComponent();
_dbConnectionString = ConfigurationSettings.AppSettings["DBConStr"];
DataAccess.conStr = _dbConnectionString;
MainMenu _mainMenu = new MainMenu(_dbConnectionString);
_mainFrame.Navigate(_mainMenu);
dataAccess = new DataAccess();
lines = dataAccess.getLines();
lineQ = new Queue<int>();
foreach (line l in lines)
lineQ.Enqueue(l.ID);
reference = new Reference();
andonManager = new AndonManager(AndonManager.MODE.SLAVE);
andonManager.andonAlertEvent += new EventHandler<AndonAlertEventArgs>(andonManager_andonAlertEvent);
andonManager.start();
}
catch( Exception e)
{
tbMsg.Text+= e.Message;
}
}
示例8: Create
public void Create()
{
//menuObjects.Add(CreateObject("SpaceSceneMenu", "Menu/SpaceSceneMenu"));
GameObject root = new GameObject ();
GameObject cam = CreateObject ("MenuCamera", "Menu/MenuCamera");
GameObject newObj;
menuCam = cam;
root.transform.position = cam.transform.position;
root.transform.rotation = cam.transform.rotation;
cam.transform.parent = root.transform;
root.name = "MenuRoot";
menuObjects.Add(root);
menuObjects.Add(cam);
newObj = CreateObject ("NewGame", "Menu/NewGame"); newObj.transform.parent = root.transform;
menuObjects.Add(newObj);
newObj = CreateObject ("Continue", "Menu/Continue"); newObj.transform.parent = root.transform;
menuObjects.Add(newObj);
newObj = CreateObject ("SaveQuit", "Menu/SaveQuit"); newObj.transform.parent = root.transform;
menuObjects.Add(newObj);
newObj = CreateObject ("SpaceSceneMenu", "Menu/SpaceSceneMenu"); newObj.transform.parent = root.transform;
menuObjects.Add(newObj);
//Set up the menu instance
newObj = CreateObject ("SRLName", "Menu/SRLName"); newObj.transform.parent = root.transform;
menuObjects.Add(newObj);
menuSystem = newObj.GetComponent<MainMenu>();
isShown = true;
}
示例9: MenuDialog
public MenuDialog()
{
Size = new Size(500,200);
text.Size = new Size(490,190);
text.Multiline = true;
text.ScrollBars = ScrollBars.Both;
text.WordWrap = false;
text.Location = new Point(5,5);
MenuItem fileMenu = new MenuItem("File");
MenuItem open = new MenuItem("Open");
open.Shortcut = Shortcut.CtrlO;
MenuItem save = new MenuItem("Save");
save.Shortcut = Shortcut.CtrlS;
fileMenu.MenuItems.Add(open);
fileMenu.MenuItems.Add(save);
MenuItem formatMenu = new MenuItem("Format");
MenuItem font = new MenuItem("Font");
font.Shortcut = Shortcut.CtrlF;
formatMenu.MenuItems.Add(font);
MainMenu bar = new MainMenu();
Menu = bar;
bar.MenuItems.Add(fileMenu);
bar.MenuItems.Add(formatMenu);
Controls.Add(text);
open.Click += new EventHandler(Open_Click);
save.Click += new EventHandler(Save_Click);
font.Click += new EventHandler(Font_Click);
}
示例10: Main
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
mainForm = new MainMenu();
Application.Run(mainForm);
}
示例11: RulesBackButton_Click
private void RulesBackButton_Click(object sender, EventArgs e)
{
this.Hide();
var myForm = new MainMenu();
myForm.Closed += (send, args) => this.Close();
myForm.Show();
}
示例12: Open
public static void Open(Pinball Pinball, Form Owner=null)
{
foreach (Form F in Application.OpenForms)
{
if (F.GetType() == typeof(MainMenu))
{
F.BringToFront();
F.Focus();
return;
}
}
MainMenu M = new MainMenu(Pinball);
if (Owner == null)
{
M.Show();
}
else
{
M.StartPosition = FormStartPosition.CenterParent;
M.Show(Owner);
}
}
示例13: MainForm_Load
private void MainForm_Load(object sender, EventArgs e)
{
//
// appMenu
//
UserControl_MainMenu = new MainMenu(this);
/*
this.appMenu = UserControl_MainMenu;
this.appMenu.Location = new System.Drawing.Point(0, 0);
this.appMenu.Name = "appMenu";
this.appMenu.Size = new System.Drawing.Size(640, 23);
this.appMenu.TabIndex = 0;
this.Controls.Add(this.appMenu);
*/
this.appMenu = UserControl_MainMenu;
UserControl_MainMenu.Location = new System.Drawing.Point(0, 0);
UserControl_MainMenu.Name = "UserControl_MainMenu";
UserControl_MainMenu.Size = new System.Drawing.Size(640, 23);
this.Controls.Add(UserControl_MainMenu);
this.CenterToScreen();
this.FormBorderStyle = FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
}
示例14: debugLogin_Click
private void debugLogin_Click(object sender, EventArgs e)
{
MainMenu mainPage = new MainMenu();
mainPage.loginPage = this;
mainPage.Show();
Hide();
}
示例15: LoginButton_Click
private void LoginButton_Click(object sender, EventArgs e)
{
try
{
var username = this.UsernameField.Text;
var password = this.PasswordField.Text;
Program.infoController.LoginPlayer(username, password);
this.Hide();
var mainPage = new MainMenu();
mainPage.ShowDialog();
}
catch (FaultException<InvalidUsernameFault>)
{
MessageBox.Show("Invalid username.");
}
catch (FaultException<InvalidPasswordFault>)
{
MessageBox.Show("Invalid password.");
}
catch (CommunicationException)
{
MessageBox.Show("Unable to connect to server!\nPlease try again Later.");
}
catch (Exception ex)
{
MessageBox.Show("Unforseen error!, " + ex.Message);
}
}