private void tsmiSave_Click(object sender, EventArgs e) { try { using (var session = App.CreateSession()) { if (session.IsValid == false) { LicenseSession.ShowLicenseDialog(session, this); return; } using (new ProgressHelper(this, "Saving ...")) { _SvfDb.Save(); } MessageBox.Show(this, @"Save Success!", Text); } } catch (Exception ex) { MessageBox.Show(this, ex.Message, Text); } }
public static void ShowDialog(IWin32Window parent) { var info = LicenseSession.GetLicenseInfo(CLIENT_ID, PRODUCT_NAME, LICENSE_KEY); LicenseSession.ShowLicenseDialog(CLIENT_ID, PRODUCT_NAME, parent); }
public static void ShowDialog(LicenseSession session, IWin32Window parent) { var info = LicenseSession.GetLicenseInfo(CLIENT_ID, PRODUCT_NAME, LICENSE_KEY); LicenseSession.ShowLicenseDialog(session.ClientId, session.AppName, parent); }
public static void ShowLicenseDialog(IWin32Window parent = null) { LicenseSession.ShowLicenseDialog(CLIENT_ID, PRODUCT_NAME, parent); }
private void btnGenerate_Click(object sender, EventArgs e) { using (var session = App.CreateSession()) { if (session.IsValid == false) { LicenseSession.ShowLicenseDialog(session, this); return; } using (new ProgressHelper(this, @"Generating Diff Model ...")) { try { var sw = Stopwatch.StartNew(); #region setup materials var matUnmodified = new Material { Color = Vector3D.FromColor(0xffffff), //Darker: Vector3D.FromColor(0x101010) Transparent = 0.95, Reflectivity = 0 }; var matAdd = new Material { Color = Vector3D.FromColor(Color.GreenYellow) }; var matDelete = new Material { Color = Vector3D.FromColor(Color.Red) }; var matModifiedBefore = new Material { Color = Vector3D.FromColor(Color.Orange), Transparent = 0.5 }; var matModifiedAfter = new Material { Color = Vector3D.FromColor(Color.Aqua), }; #endregion var baseModelPath = txtBaseModel.Text; var incrModelPath = txtIncrementModel.Text; var diffModelPath = txtDiffModel.Text; var svfbase = baseModelPath.EndsWith(@"zip") ? SvfDocument.LoadFromZipFile(baseModelPath) : SvfDocument.LoadFromSvfFile(baseModelPath); var svfincr = incrModelPath.EndsWith(@"zip") ? SvfDocument.LoadFromZipFile(incrModelPath) : SvfDocument.LoadFromSvfFile(incrModelPath); var compareResult = CompareModel(svfbase, svfincr); var svfdiff = new SvfDocument(); svfdiff.Model.Name = @"Diff Model"; svfdiff.Metadata = svfbase.Metadata; var nodeUnmodified = svfdiff.Model.Children.CreateNode(); nodeUnmodified.Name = @"Unmodified"; var nodeAdded = svfdiff.Model.Children.CreateNode(); nodeAdded.Name = @"Added"; var nodeDeleted = svfdiff.Model.Children.CreateNode(); nodeDeleted.Name = @"Deleted"; var nodeModifiedBefore = svfdiff.Model.Children.CreateNode(); nodeModifiedBefore.Name = @"Modified Before"; var nodeModifiedAfter = svfdiff.Model.Children.CreateNode(); nodeModifiedAfter.Name = @"Modified After"; svfbase.EnumerateNodes(node => { if (node.Children?.Count == 0 && node.Fragments?.Count > 0 && string.IsNullOrEmpty(node.ExternalId) == false) { if (compareResult.Unmodified.Remove(node.ExternalId)) { ImportNodeWithPath(nodeUnmodified, node, svfbase.Model, matUnmodified); } else if (compareResult.Deleted.Remove(node.ExternalId)) { ImportNodeWithPath(nodeDeleted, node, svfbase.Model, matDelete); } else if (compareResult.Modified.Contains(node.ExternalId)) { var targetNode = ImportNodeWithPath(nodeModifiedBefore, node, svfbase.Model, matModifiedBefore); targetNode.ExternalId += @"_Before"; } } }, svfbase.Model); svfincr.EnumerateNodes(node => { if (node.Children?.Count == 0 && node.Fragments?.Count > 0 && string.IsNullOrEmpty(node.ExternalId) == false) { if (compareResult.Added.Remove(node.ExternalId)) { ImportNodeWithPath(nodeAdded, node, svfincr.Model, matAdd); } else if (compareResult.Modified.Remove(node.ExternalId)) { ImportNodeWithPath(nodeModifiedAfter, node, svfincr.Model, matModifiedAfter); } } }, svfincr.Model); svfdiff.SaveToFolder(diffModelPath, true); svfdiff.Dispose(); svfbase.Dispose(); svfincr.Dispose(); ProgressHelper.Close(); var message = $@"Generate Diff Model Success! (duration: {sw.Elapsed})"; MessageBox.Show(this, message, Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { ProgressHelper.Close(); MessageBox.Show(this, ex.ToString(), Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
public static void ShowDialog(IWin32Window parent) { var info = LicenseSession.GetLicenseInfo(CLIENT_ID, PRODUCT_NAME, GetLicenseKey()); LicenseSession.ShowLicenseDialog(CLIENT_ID, PRODUCT_NAME, parent, DeployLicenseFileAction); }
private void btnMerge_Click(object sender, EventArgs e) { var models = new List <SvfModel>(); foreach (SvfModel item in svfModelBindingSource) { if (item == null) { continue; } models.Add(item); } if (models.Count < 1) { MessageBox.Show(this, @"The source model list is empty!", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (string.IsNullOrEmpty(txtOutput.Text)) { MessageBox.Show(this, @"Please Select Output Path!", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } using (var session = App.CreateSession()) { if (session.IsValid == false) { LicenseSession.ShowLicenseDialog(session, this); return; } using (new ProgressHelper(this, @"Merging ...")) { try { var sw = Stopwatch.StartNew(); var targetDoc = new SvfDocument(); var docs = new List <SvfDocument>(); foreach (var model in models) { var doc = model.ModelPath.EndsWith(@"zip") ? SvfDocument.LoadFromZipFile(model.ModelPath) : SvfDocument.LoadFromSvfFile(model.ModelPath); doc.Model.Name = model.ModelTitle; targetDoc.Model.Children.ImportNode(doc.Model); if (targetDoc.Metadata?.DefaultCamera == null) { targetDoc.Metadata = doc.Metadata.Clone(); } doc.Reset(); docs.Add(doc); } targetDoc.SaveToFolder(txtOutput.Text, true); targetDoc.Dispose(); foreach (var doc in docs) { doc.Dispose(); } docs.Clear(); ProgressHelper.Close(); var message = $@"Merge Success! (duration: {sw.Elapsed})"; MessageBox.Show(this, message, Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { ProgressHelper.Close(); MessageBox.Show(this, ex.ToString(), Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
public static void ShowLicenseDialog(IWin32Window parent = null) { LicenseSession.ShowLicenseDialog(GetClientId(), PRODUCT_NAME, parent); }
public static void ShowLicenseDialog(IWin32Window parent) { LicenseSession.ShowLicenseDialog(CLIENT_ID, APP_NAME, parent); }
public static void ShowLicenseDialog(LicenseSession session, IWin32Window parent) { LicenseSession.ShowLicenseDialog(session.ClientId, session.AppName, parent); }