public Form1() { //this.mLicense = LicenseManager.Validate(typeof(Form1), this); license = (LocalLicense)LicenseManager.Validate(typeof(Form1), this); if (license.LicenseData == null) { //MessageBox.Show("license data is null"); new RegistForm("No license file found").ShowDialog(); return; } /* * if (license.LicenseData.UsedCount >= license.LicenseData.MaxCount) * { * MessageBox.Show("use count error " + license.LicenseData.MaxCount + " " + license.LicenseData.UsedCount); * * new RegistForm().ShowDialog(); * return; * } */ if (license.LicenseData.HardwareId != LocalInformation.HardwareId) { //MessageBox.Show("hardwareid is error"); new RegistForm("The license file is not for this device").ShowDialog(); return; } DateTime now = LocalLicenseUtil.GetNetDateTime(); if (now == new DateTime(0)) { now = DateTime.Now; } if (now > license.LicenseData.ExpiredDate) { //MessageBox.Show("expired date error " + now + " " + license.LicenseData.ExpiredDate); new RegistForm("The license expires, and the final use period is " + license.LicenseData.ExpiredDate).ShowDialog(); return; } InitializeComponent(); }
public MainWindow(string fileName = "") { /* * license = LicenseManager.Validate(typeof(MainWindow), this); * if (!(license as WebLicense).LicenseResult.Result.IsOK) * { * MessageBox.Show(@"Unable to communicate with license server, please check your network", "License error", MessageBoxButtons.OK, MessageBoxIcon.Error); * return; * } * if ((license as WebLicense).LicenseResult.Data.state == LicenseState.NotRegisted) * { * //MessageBox.Show("Software is not registered!", "License error", MessageBoxButtons.OK, MessageBoxIcon.Error); * new RegistForm().ShowDialog(); * return; * } * if ((license as WebLicense).LicenseResult.Data.state == LicenseState.Expired) * { * //MessageBox.Show("License is expired!", "License error", MessageBoxButtons.OK, MessageBoxIcon.Error); * new RegistForm().ShowDialog(); * return; * } */ license = (LocalLicense)LicenseManager.Validate(typeof(MainWindow), this); if (license.LicenseData == null) { //MessageBox.Show("license data is null"); new RegistForm("No license file found").ShowDialog(); return; } /* * if (license.LicenseData.UsedCount >= license.LicenseData.MaxCount) * { * MessageBox.Show("use count error " + license.LicenseData.MaxCount + " " + license.LicenseData.UsedCount); * * new RegistForm().ShowDialog(); * return; * } */ if (license.LicenseData.HardwareId != LocalInformation.HardwareId) { //MessageBox.Show("hardwareid is error"); new RegistForm("The license file is not for this device").ShowDialog(); return; } DateTime now = LocalLicenseUtil.GetNetDateTime(); if (now == new DateTime(0)) { now = DateTime.Now; } if (now > license.LicenseData.ExpiredDate) { //MessageBox.Show("expired date error " + now + " " + license.LicenseData.ExpiredDate); new RegistForm("The license expires, and the final use period is " + license.LicenseData.ExpiredDate).ShowDialog(); return; } GlobalParameters.FieldNames.Clear(); GlobalParameters.FieldNames.AddRange(new string[] { "p", "U", "k", "epsilon" }); caseReader = new TplcCaseReader(this); readCaseTask = new FoamTask <bool>(); readCaseTask.OnTaskFinished += OnReadCaseFinished; InitializeComponent(); tsimMain = new ToolStripItemManager(ts_main); tsimMain.Add("case_open", new List <ToolStripItem>() { mi_opencase, tsb_opencase }); tsimMain.Add("state_open", new List <ToolStripItem>() { mi_openstate, tsb_openstate }); tsimMain.Add("state_saveas", new List <ToolStripItem>() { mi_savestateas, tsb_savestateas }); tsimMain.Add("export", new List <ToolStripItem>() { mi_export, tsb_export }); tsimMain.Add("field", new List <ToolStripItem>() { tscb_field }); tsimMain.Add("range", new List <ToolStripItem>() { tstb_max, tstb_min }); tsimMain.Add("stop", new List <ToolStripItem>() { tsb_stop }); fdvMain.OnReadMeshFinished += OnLoadDataFinished; ptvMain.SelectedImageIndex = 0; ptvMain.IndexCutList = 3; ptvMain.IndexPatchList = 4; ptvMain.IndexPatch = 2; ptvMain.IndexCutter = 1; foreach (string f in GlobalParameters.FieldNames) { tscb_field.Items.Add(f); } tscb_field.SelectedIndex = 0; StateModified = false; if (fileName != "") { if (String.Compare(Path.GetExtension(fileName), ".tcs", true) == 0) { currentDesc = new PostDesc(); currentDesc.CaseFileName = fileName; ptvMain.PostDesc = currentDesc; ReadCase(fileName); StateModified = true; } else if (String.Compare(Path.GetExtension(fileName), ".tsf", true) == 0) { StateModified = false; OpenStateFile(fileName); } } }