// TODO: Add bool to getX methods to allow the remaining count to be updated. private void ManageProgram_Load(object sender, EventArgs e) { var currentProgram = Variables.MyProgramsSelected; _isAdmin = currentProgram.IsAdmin; // Resets the IsFirstTime variable to true. Licenses.Initialize(); Programs.Initialize(); Tasks.Licensing.Variables.Initialize(); pbStorePurchased.BackColor = Color.FromArgb(40, 95, 125); // Allow the static methods access to the variables. // Licenses Controls. Licenses.IsAdmin = _isAdmin; Licenses.LicensesRemaining = LabelLicensesRemaining; Licenses.CreateLicenseButton = ButtonCreateLicense; Licenses.ListViewLicenses = ListViewLicenses; // Variables Controls. Tasks.Licensing.Variables.IsAdmin = _isAdmin; Tasks.Licensing.Variables.VariablesRemaining = LabelVariablesRemaining; Tasks.Licensing.Variables.CreateVariableButton = ButtonAddVariable; Tasks.Licensing.Variables.ListViewVariables = ListViewVariables; // Options/Administrator Controls. Programs.IsAdmin = _isAdmin; Programs.AdminsRemaining = LabelAdministratorsRemaining; Programs.ButtonAddAdministrator = ButtonAddAdministrator; Programs.ListViewAdministrators = ListViewAdministrators; // Options/Limit Controls. Programs.ButtonSaveLockChanges = ButtonSaveLockChanges; Programs.BanLicenseIfLimitReached = CheckBoxBanLicenseLimitReached; Programs.HwidLimit = TextBoxHWidLimit; Programs.HWidExpiration = TextBoxHWidExpiration; Programs.IpLimit = TextBoxIPLimit; Programs.IpExpiration = TextBoxIPExpiration; string programid = currentProgram.Programid; Thread getLicensesThread = new Thread(GetLicenses); getLicensesThread.Start(programid); Thread getAdminsThread = new Thread(GetAdministrators); getAdminsThread.Start(programid); Thread getLimitsThread = new Thread(GetLockLimits); getLimitsThread.Start(programid); Thread getVariablesThread = new Thread(GetVariables); getVariablesThread.Start(programid); // TODO: If not marketplace registered, show a different tab as upload tab isn't required. TabPageUpload.Controls.Add(new UploadProgram(this)); TabPageAnalytics.Controls.Add(new Analytics()); // Adds the relevant marketplace user control to the marketplace tab. if (currentProgram.MarketplaceFeePaid && currentProgram.DistributionModel == 1) // Marketplace. { // TODO: Show marketplace controls/options, user has been approved and has paid. TabPageMarketplace.Controls.Add(new MyLibrary.MarketplaceDefault()); } else if (currentProgram.DistributionModel == 2) // Self Distribution. { // TODO: Show marketplace registration, user needs to pay here. TabPageMarketplace.Controls.Add(new MyLibrary.MarketplaceApplication()); } if (!_isAdmin) { // User owns program. LabelLicensesRemaining.Text = String.Format("Your account can create {0} more license(s).", Variables.Users.Current.LicensesRemaining); LabelVariablesRemaining.Text = String.Format("Your account can support {0} more variable(s).", Variables.Users.Current.VariablesRemaining); LabelAdministratorsRemaining.Text = String.Format( "This program can support {0} more administrator(s).", Variables.Users.Current.ProgramAdministratorsRemaining); } else { // User is a program administrator. Thread getOwnerInfoThread = new Thread(GetProgramOwnerInformation); getOwnerInfoThread.Start( Variables.MyProgramsSelected.CreatorUsername); } ComboBoxLockType.SelectedIndex = 0; }