12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace KeepScreenLight.Pages
- {
- /// <summary>
- /// base form
- /// </summary>
- public partial class BaseForm : Form
- {
- public BaseForm()
- {
- InitializeComponent();
- }
- private void BaseForm_Load(object sender, EventArgs e)
- {
- }
- /// <summary>
- /// Form之间跳转
- /// </summary>
- /// <param name="type"></param>
- /// <returns></returns>
- internal static Form Go(Type type)
- {
- Form currentForm = null;
- foreach (Form formItem in Program.formList)
- {
- if (formItem.GetType() == type)
- {
- currentForm = formItem;
- currentForm.Activate();
- break;
- }
- }
- if (currentForm == null)
- {
- object obj = Activator.CreateInstance(type);
- if (obj is Form)
- {
- currentForm = obj as Form;
- currentForm.Show();
- }
- }
- return currentForm;
- }
- }
- }
|