private void btnSave_Click(object sender, EventArgs e) { try { LicenseClientManager.Stop(); Dns.GetHostAddresses(this.txtLicenseServerName.Text); UserProfileManager.UserProfile.LicenseServer_ServerName = this.txtLicenseServerName.Text; errorProvider.SetError(this.txtLicenseServerName, ""); LicenseClientManager.Start(); var licenseRequest = new DAL.Licenses.PendingClientLicenseRequest() { LicenseType = DAL.Licenses.PendingClientLicenseRequest.TypeOfClientLicenseRequest.Studio }; LicenseClientManager.AddPendingLicenseRequest(licenseRequest); } catch (Exception exc) { Debug.WriteLine(exc.Message); errorProvider.SetError(this.txtLicenseServerName, "Invalid hostname"); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { LoggingManager.Start(); //DEBUG trial license //OnlineCatalogLicenses.CreateTrialLicense(@"D:\Coding\Workspaces\Atum\OperatorStation\Atum.Studio\bin\Debug\Settings\Licenses.dat"); FontManager.LoadDefaultFonts(); //ConnectivityManager.Start(); MaterialManager.Start(true); UserProfileManager.Start(); LicenseClientManager.Start(); if (!UserProfileManager.UserProfile.Settings_Skip_Welcome_Screen_On_Next_Start || IsTrialLicenseExpired() || IsLicenseExpiring()) { Thread splashThread = new Thread(new ThreadStart( delegate { splashForm = new SplashFrm(); splashForm.ControlClosed += SplashForm_ControlClosed; splashForm.RecentFilesOpenExistsProject += SplashForm_OpenExistsProject; splashForm.RecentFilesOpenNewProject += SplashForm_OpenNewProject; splashForm.RecentFilesSelectedRecentFileChanged += SplashForm_OpenExistsProject; splashForm.UnLicensedProgramControlLicensedProgramControlOpenExistingProject += SplashForm_OpenExistsProject; splashForm.UnLicensedProgramControlLicensedProgramControlOpenNewProject += SplashForm_OpenNewProject; splashForm.SplashSkipWelcomClicked += SplashForm_OpenNewProject; Application.Run(splashForm); } )); splashThread.SetApartmentState(ApartmentState.STA); splashThread.Start(); splashThread.Join(); } else { var mainForm = InitializeMainForm(); Application.Run(mainForm); } } catch (Exception exc) { LicenseClientManager.Stop(); MessageBox.Show(exc.StackTrace.Replace("Atum.Studio", "OperatorStation")); DAL.Managers.LoggingManager.WriteToLog("Fatal error happened", "Main", exc); Debug.WriteLine(exc.Message); } }
public SplashFrm() { InitializeComponent(); //license request LicenseClientManager.Start(); this.StartPosition = FormStartPosition.CenterScreen; this.ShowIcon = false; this.Icon = BrandingManager.MainForm_Icon; this.ShowIcon = true; bool licenseActivated = true; IsTrailLicense = false; DaysLeft = 0; if (LicenseClientManager.CurrentLicenses != null && LicenseClientManager.CurrentLicenses.Count > 0 && (LicenseClientManager.CurrentLicenses[0].ExpirationDate < DateTime.Now || LicenseClientManager.CurrentLicenses[0].SystemID != SystemManager.GetUUID())) { licenseActivated = false; } else { if (LicenseClientManager.CurrentLicenses != null && LicenseClientManager.CurrentLicenses.Count > 0) { var license = LicenseClientManager.CurrentLicenses.First(); if (license.LicenseType == DAL.Licenses.AvailableLicense.TypeOfLicense.Trial) { IsTrailLicense = true; DaysLeft = (license.ExpirationDate - DateTime.Now).Days; if (DaysLeft < 0) { licenseActivated = false; } } else if (license.LicenseType == DAL.Licenses.AvailableLicense.TypeOfLicense.StudioStandard) { IsStandardLicense = true; DaysLeft = (license.ExpirationDate - DateTime.Now).Days; if (DaysLeft < 1) { licenseActivated = false; } } } } var splashControl = new SplashControl(this); splashControl.SplashSkipWelcomClicked += SplashControl_SkipWelcomClicked; var plTrail = (Panel)splashControl.Controls["plTrail"]; if (plTrail != null) { var lblLinkAuthorize = (LinkLabel)plTrail.Controls["lblLinkAuthorize"]; lblLinkAuthorize.Click += LblLinkAuthorize_Click; } spcSplashContainer.Panel1.Controls.Add(splashControl); if (!licenseActivated) { splashControl.HideSkipWelcomeScreen(); LoadUnAuthorisedControl(); } else { LoadRecentOpenedFileControl(); } }