private void PluginClicked(SC.Interfaces.IScPluginClient plugin) { int y = 0; pnlContent.Controls.Clear(); SC.GUI.Utility.PluginPanelBase[] panels = null; try { panels = pluginPanelLoader.GetPanels(plugin); } catch (Exception e) { SC.GUI.Utility.ErrorForm.ShowErrorForm(e); return; } foreach (SC.GUI.Utility.PluginPanelBase panel in panels) { try { panel.Name = plugin.ToString() + y; panel.Location = new Point(0, y); y += panel.Size.Height + 10; pnlContent.Controls.Add(panel); panel.Show(); } catch (Exception e) { SC.GUI.Utility.ErrorForm.ShowErrorForm(e); } } }
public void License(SC.Interfaces.ILicensee licensee) { if (RequiresLicense(licensee)) { Guid guid = Guid.NewGuid(); while (licenses.ContainsKey(guid) || guid == Guid.Empty) guid = Guid.NewGuid(); SC.Interfaces.LicenseRequest req = GetLicenseRequest(licensee.GetType()); string licName = req.LicenseName; bool valid = false; while (req != null) { if (licenseinfos.ContainsKey(req.LicenseName)) { LicenseInfo info = licenseinfos[req.LicenseName]; if (!(valid = info.Count > GetUsedLicenseCount(req.LicenseName))) { valid = false; break; } else if (info.IsValid) { req = null; } } else { valid = false; req = null; } } if (valid) { Logger.Info("Granting license " + licName + " to " + licensee.ToString()); License lic = new License(guid, licName); licensee.AssignLicense(lic); licenses.Add(guid, lic); } else { Logger.Info("No license " + licName + " available for " + licensee.ToString()); licensee.AssignLicense(new License(Guid.Empty, licName)); } } }