private void labelLicense_Click(object sender, System.EventArgs e) { using (var form = new LicenseForm(_work)) { form.ShowDialog(this); } }
private void m_LicenseInformationToolStripMenuItem_Click(object sender, EventArgs e) { using (LicenseForm dial = new LicenseForm(null, null, Assembly.GetEntryAssembly())) { Licenses cLicDial = new Licenses(); dial.SetAdditionalControl = cLicDial; dial.LicenceRequestMessageProvider = new LicenseForm.LicenceRequestMessageProviderDelegate(delegate() { return(cLicDial.GetLicenseMessageRequest()); }); dial.ShowDialog(this); } }
private void ShowLicenseDialog() { using (LicenseForm dial = new LicenseForm(null, null, Assembly.GetEntryAssembly())) { Licenses cLicDial = new Licenses(); dial.SetAdditionalControl = cLicDial; dial.LicenceRequestMessageProvider = new LicenseForm.LicenceRequestMessageProviderDelegate(() => cLicDial.GetLicenseMessageRequest()); dial.ShowDialog(this); } }
private void licenseInformationToolStripMenuItem_Click(object sender, EventArgs e) { using (LicenseForm dial = new LicenseForm(Properties.Resources.about_CommServer, "Free ware", Assembly.GetEntryAssembly())) { Licenses cLicDial = new Licenses(); dial.SetAdditionalControl = cLicDial; dial.LicenceRequestMessageProvider = new LicenseForm.LicenceRequestMessageProviderDelegate( delegate() { return(cLicDial.GetLicenseMessageRequest()); }); dial.ShowDialog(); } }
private void licenseInformationToolStripMenuItem_Click(object sender, EventArgs e) { string usr = ""; Assembly cMyAss = Assembly.GetEntryAssembly(); using (LicenseForm cAboutForm = new LicenseForm(null, usr, cMyAss)) { using (Licenses cLicDial = new Licenses()) { cAboutForm.SetAdditionalControl = cLicDial; cAboutForm.LicenceRequestMessageProvider = new LicenseForm.LicenceRequestMessageProviderDelegate(delegate() { return(cLicDial.GetLicenseMessageRequest()); }); cAboutForm.ShowDialog(); } } }
private static void ShowLicenseIfNeeded() { if (ShouldShowLicense()) { var frm = new LicenseForm() { StartPosition = FormStartPosition.CenterScreen }; frm.Init(); frm.ShowDialog(); if (!frm.Agreed) { Environment.Exit(0); } } }
public LicenseViewModel(LicenseExportFromDatabase l_exp) { License l = l_exp.license; Id = l.Id; LicenseNom = l.Nom; NomOfBook = l.NomOfBook; LicenseDateStart = l.DateStart.ToShortDateString(); LicenseDateExpired = l.DateExpired.ToShortDateString(); LicenseStatusRus = LicenseViewModelForCompany.GetRusLicenseStatus(l.Status); Company c = l_exp.company; CompanyId = c.Id; CompanyShortName = c.ShortName; CompanyINN = c.INN; CompanyKPP = c.KPP; CompanyOGRN = c.ORGN; CompanyAddress = c.ActualAddrStr; CompanyEmail = c.Email; ActionWithLicense a = l_exp.last_action; if (a != null) { LastActionDate = a.DateTimeAction.ToShortDateString(); LastActionReason = a.Reason; } else { LastActionDate = ""; LastActionReason = ""; } LicenseForm lf = l_exp.last_license_form; if (lf != null) { LastLicenseFormNom = lf.Nom; } else { LastLicenseFormNom = ""; } }
public ActionWithLicenseWithLicenseFormViewModel(ActionWithLicense awl) { IdAction = awl.Id; Reason = awl.Reason; DateAction = awl.DateTimeAction.ToShortDateString(); IsSelected = false; HasResolution = awl.Resolution != null; if (HasResolution) { ResolutionId = awl.Resolution.Id; ResolutionNom = awl.Resolution.RegNomAll; } HasLicenseForm = awl.LicenseForm != null; if (HasLicenseForm) { LicenseForm lf = awl.LicenseForm; IdLicenseForm = lf.Id; Nom = lf.Nom; CompanyName = lf.FullNameCompany; CompanyAddress = lf.AddressCompany; Email = lf.Email; DateExpired = lf.DateExpired.ToShortDateString(); Units = new List <UnitInLicenseFormViewModelShort>(); foreach (var u in lf.UnitsInLicenseForm.OrderBy(j => j.Address)) { Units.Add(new UnitInLicenseFormViewModelShort() { Id = u.Id, Address = u.Address }); } } else { Nom = ""; CompanyName = ""; CompanyAddress = ""; Email = ""; DateExpired = ""; Units = new List <UnitInLicenseFormViewModelShort>(); } }
private void licenseInformationToolStripMenuItem_Click(object sender, EventArgs e) { string usr = null; if (m_license != null) { usr = m_license.User.Organization + "[" + m_license.User.Email + "]"; } Assembly cMyAss = Assembly.GetEntryAssembly(); using (LicenseForm cAboutForm = new LicenseForm(null, usr, cMyAss)) { using (Licenses cLicDial = new Licenses()) { cAboutForm.SetAdditionalControl = cLicDial; cAboutForm.ShowDialog(this); } } }
public void AttemptLicense() { EncryptedLicenseProvider provider = new EncryptedLicenseProvider(); EncryptedLicense license = provider.GetLicense(LicenseBO.ValidationParameters, GetLicenseFile()); if (license != null) { MessageForm frm = new MessageForm(); frm.Msg = "Your license is installed properly. No further licensing is required."; frm.ShowDialog(); return; } else { LicenseForm licfrm = new LicenseForm(); license = licfrm.ShowDialog("Llama Carbon Copy", Properties.Settings.Default.Website, LicenseBO.GetLicenseFile()); if (licfrm.DialogResult == DialogResult.Cancel) { return; } if (license != null) { //congratulate OnLicensed(EventArgs.Empty); MessageForm frm = new MessageForm(); frm.Msg = "You have successfully installed your license."; frm.ShowDialog(); } else { //ask if they want to try again QuestionForm frm = new QuestionForm(); frm.Msg = "There was a problem creating your license. Would you like to try again?"; if (frm.ShowDialog() == DialogResult.OK) { AttemptLicense(); } } } }
public bool IsActive() { EncryptedLicenseProvider provider = new EncryptedLicenseProvider(); EncryptedLicense license = provider.GetLicense(LicenseBO.ValidationParameters, GetLicenseFile()); if (license == null) { EvaluationMonitor monitor = new EvaluationMonitor("SpittingImage"); if (monitor.DaysInUse > 15 || monitor.Invalid) { QuestionForm frm = new QuestionForm(); frm.Msg = "Your trial license has expired. Would you like to enter a license key to activate the software?"; if (frm.ShowDialog() == DialogResult.OK) { LicenseForm licfrm = new LicenseForm(); license = licfrm.ShowDialog("Llama Carbon Copy", Properties.Settings.Default.Website, LicenseBO.GetLicenseFile()); if (license != null) { OnLicensed(EventArgs.Empty); } } } else { MessageForm frm = new MessageForm(); frm.Msg = string.Format("You are on day {0} of your 15 day evaluation.", monitor.DaysInUse); frm.ShowDialog(); return(true); } } if (license == null) { return(false); } else { return(true); } }
public void ShowLicenses() { using LicenseForm form = new LicenseForm(); form.ShowDialog(); }
private static bool CheckLicense(string version, out string aboutLicense) { string trialLicensePath = AppDomain.CurrentDomain.BaseDirectory + "trial.license"; //string activatedLicensePath = AppDomain.CurrentDomain.BaseDirectory + "activated.license"; string oldActivatedLicensePath = AppDomain.CurrentDomain.BaseDirectory + "activated.license"; string newActivatedLicenseFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\Amphibian Software\VisualSail"; string newActivatedLicensePath = newActivatedLicenseFolder + @"\activated.license"; if (!Directory.Exists(newActivatedLicenseFolder)) { Directory.CreateDirectory(newActivatedLicenseFolder); } if (!File.Exists(newActivatedLicensePath) && File.Exists(oldActivatedLicensePath)) { File.Copy(oldActivatedLicensePath, newActivatedLicensePath); File.Delete(oldActivatedLicensePath); } if (File.Exists(newActivatedLicensePath)) { Status.LoadLicense(newActivatedLicensePath); if (Status.Licensed) { aboutLicense = "Activated"; return(true); } else { File.Delete(newActivatedLicensePath); } } if (File.Exists(trialLicensePath)) { Status.LoadLicense(trialLicensePath); if (!Status.Licensed || (Status.Licensed && Status.Evaluation_Lock_Enabled)) { LicenseForm lf = new LicenseForm(newActivatedLicensePath); if (lf.ShowDialog() == DialogResult.OK) { if (File.Exists(newActivatedLicensePath)) { Status.LoadLicense(newActivatedLicensePath); if (Status.Licensed) { MessageBox.Show("Activation Complete, Thank you"); aboutLicense = "Activated"; return(true); } else { MessageBox.Show("Activation Failed"); aboutLicense = "Invalid License Loaded"; return(false); } } else if (Status.Licensed && Status.Evaluation_Lock_Enabled && (Status.Evaluation_Time_Current <= Status.Evaluation_Time)) { aboutLicense = "Evaluation Day " + Status.Evaluation_Time_Current + " of " + Status.Evaluation_Time; return(true); } else { aboutLicense = "License Required"; return(false); } } else { aboutLicense = "Cancelled"; return(false); } } } else { aboutLicense = "Trial license was removed"; return(false); } aboutLicense = "Unreachable code reached"; return(false); }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { // may throw exception if its doesn' find a database voteAppEntities entities = DbUtils.AppEntities; } catch (Exception ex) { MessageBox.Show("NOT CONNECTED TO A DATABASE!", "MISSING DATA", MessageBoxButtons.OK, MessageBoxIcon.Warning); Trace.WriteLine(ex.Message); return; } bool isLicensed = RegistryUtils.IsLicensed(); if (!isLicensed) { // check if app is already activated through windows registry using (LicenseForm enterLicense = new LicenseForm()) { //enterLicense.ShowDialog(); Application.Run(enterLicense); isLicensed = enterLicense.DialogResult == DialogResult.OK; } } // invalid license if (!isLicensed) { return; } // if there is at least one user (superadmin) show the login form if (DbUtils.AppEntities.Users.Any(user => user.Type == TypeUser.SuperAdmin) == false) { CreateAdminConfigurations configs = new CreateAdminConfigurations { Title = "Create super admin!", TypeUser = TypeUser.SuperAdmin }; bool showLoginForm = false; //User loginUser = null; using (CreateAdminForm formCreateSuperAdmin = new CreateAdminForm(configs)) { if (formCreateSuperAdmin.ShowDialog() == DialogResult.OK) { showLoginForm = formCreateSuperAdmin.User != null; } } if (showLoginForm) { using (CustomForm customForm = new CustomForm()) { customForm.ShowDialog(); } } } Application.Run(new LoginForm()); }