private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (loginForm != null) { loginForm.Close(); loginForm = null; } if (homeForm != null) { homeForm.Close(); homeForm = null; } if (webViewForm != null) { webViewForm.Close(); webViewForm = null; } }
public MainForm() { InitializeComponent(); FormBorderStyle = FormBorderStyle.None; WindowState = FormWindowState.Maximized; EventEmitter.Instance.Subscribe(Common.Constants.EVENT_APP_CLOSE_APPLICATION, (arguments) => { Close(); }); EventEmitter.Instance.Subscribe(Common.Constants.EVENT_APP_SHOW_LOGIN_FORM, (arguments) => { if (homeForm != null) { homeForm.Close(); homeForm = null; } ShowForm(loginForm); }); EventEmitter.Instance.Subscribe(Common.Constants.EVENT_APP_SHOW_HOME_FORM, (arguments) => { if (homeForm == null) { homeForm = new HomeForm(); ShowForm(homeForm); } else { homeForm.RefreshChildForm(); } }); EventEmitter.Instance.Subscribe(Common.Constants.EVENT_APP_SHOW_WEBVIEW_FORM, (arguments) => { var configuration = Repository.Repository.LoadConfiguation(); System.Diagnostics.Process.Start(configuration.information.serverUrl); }); }