Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
public class FormsManager
{
#region Private Members
private static object _lockObject = new object();
private static FormsManager _instance = null;
private List<Form> _formList = null;
#endregion
#region ctor
private FormsManager() { }
#endregion
#region Public Methods
public static FormsManager GetInstance()
{
lock (_lockObject)
{
if (_instance == null)
{
_instance = new FormsManager();
_instance._formList = new List<Form>();
}
return _instance;
}
}
public Form Show(Form form)
{
this._formList.Add(form);
form.Show();
return form;
}
public void ShowDialog(Form form, Form parent)
{
this._formList.Add(form);
form.ShowDialog(parent);
}
public void Close(Form form)
{
if (this._formList.Contains(form))
this._formList.Remove(form);
form.Close();
}
public void RefreshAll()
{
foreach (Form f in this._formList)
f.Refresh();
}
#endregion
}
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
FormsManager manager = FormsManager.GetInstance();
Application.Run(manager.Show(new FormMain()));
}
private void CloseButton_Click(object sender, EventArgs e)
{
FormsManager manager = FormsManager.GetInstance();
manager.Close(this);
}
private void RefreshButton_Click(object sender, EventArgs e)
{
FormsManager manager = FormsManager.GetInstance();
manager.RefreshAll();
}