void OnOpenLicense(object sender, OpenLicenseEventArgs e) { try { if (ServerState.Instance.License != null) { ServerState.Instance.License.Load(e.FileName); if (ServerState.Instance.License.IsValid()) { ServerState.Instance.ServerService.Settings.LicenseFile = e.FileName; ServerState.Instance.ServerService.Settings = ServerState.Instance.ServerService.Settings; _View.SetLicense(e.FileName, ServerState.Instance.License); ServerState.Instance.OnLicenseChanged(); } else { Messager.ShowError(Application.OpenForms[0], "Invalid License File: " + e.FileName); } } } catch (Exception exception) { Messager.ShowError(Application.OpenForms[0], exception); } }
public void RunView(LicenseView view) { ServerState.Instance.ServerServiceChanged += new EventHandler(OnConfigureView); ServerState.Instance.ServiceAdminChanged += new EventHandler(OnConfigureView); ServerState.Instance.IsRemoteServerChanged += new EventHandler(OnConfigureView); _View = view; if (ServerState.Instance.License != null) { _View.SetLicense(ServerState.Instance.ServerService.Settings.LicenseFile, ServerState.Instance.License); } SetHardwareCodes(); ConfigureView(); _View.OpenLicense += new EventHandler <OpenLicenseEventArgs>(OnOpenLicense); _View.RemoveLicense += new EventHandler <EventArgs>(OnRemoveLicense); }