pickrole.cs

来自「微软的行业应用解决方案示例」· CS 代码 · 共 117 行

CS
117
字号
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace HardwareDistributor.UI
{
	public partial class PickRole : Form
	{		
		public PickRole()
		{
			InitializeComponent();

			// We are removing both the Control Box and the Minimize Box, so that we don't
			// have to handle these in our code. This is not necessary in Windows Mobile Standard,
			// but we are writing this code so that it works on all platforms without any changes
			// or any recompiling.
			this.ControlBox = false;
			this.MinimizeBox = false;
		}

		/// <summary>
		/// Go back to the last state
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void menuItem1_Click(object sender, EventArgs e)
		{
			// Using the state machine go back to the Logon screen
			this.Close();			
		}

		/// <summary>
		/// Go to the currently selected role
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void menuItem2_Click(object sender, EventArgs e)
		{
			//Take user to appropriate screen based on Role
			if (customerServiceGradientButton.Pressed)					
				customerServiceGradientButton_Click(sender, e);
			else if (warehouseGradientButton.Pressed)	
				warehouseGradientButton_Click(sender, e);
			else if (deliveryGradientButton.Pressed)
				deliveryGradientButton_Click(sender, e);
		}

		/// <summary>
		/// The Customer Service Role was clicked
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void customerServiceGradientButton_Click(object sender, EventArgs e)
		{
			//Launch Customer Service screen
			CustomerService cs = new CustomerService();
			cs.ShowDialog();
			cs.Dispose();

            //bring back focus
            this.Activate();
		}

		/// <summary>
		/// The Warehouse role was clicked
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void warehouseGradientButton_Click(object sender, EventArgs e)
		{
			//Launch Warehouse screen
			Warehouse warehouse = new Warehouse();
			warehouse.ShowDialog();
			warehouse.Dispose();

            //bring back focus
            this.Activate();
		}

		/// <summary>
		/// The Delivery Role was clicked
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void deliveryGradientButton_Click(object sender, EventArgs e)
		{
			//Launch Deliveries screen
			Deliveries deliveries = new Deliveries();
			deliveries.ShowDialog();
			deliveries.Dispose();

            //bring back focus
            this.Activate();
		}

		// <summary>
		/// Custom Handling for the back key
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void BackKeyDown(object sender, KeyEventArgs e)
		{
			if ((e.KeyCode == System.Windows.Forms.Keys.Back))
			{
				// Back

				// if the back key is hit, close this dialog
				this.Close();
			}
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?