private void SetPWVarsCE_NewDesignFileEvent(Bentley.MstnPlatformNET.AddIn sender, NewDesignFileEventArgs eventArgs) { if (eventArgs.WhenCode == NewDesignFileEventArgs.When.AfterDesignFileOpen) { string sFileName = Bentley.MstnPlatformNET.Session.Instance.GetActiveDgnFile().GetFileName(); BPSUtilities.WriteLog($"Filename is '{sFileName}'"); int iProjectNo = 0, iDocumentNo = 0; PWWrapper.aaApi_Initialize(0); if (mcmMain_GetDocumentIdByFilePath(sFileName, 1, ref iProjectNo, ref iDocumentNo)) { BPSUtilities.WriteLog($"IDs: {iProjectNo}, {iDocumentNo}"); if (iProjectNo > 0 && iDocumentNo > 0) { UpdatePWEnvVars(iProjectNo, iDocumentNo); } else { BPSUtilities.WriteLog("No integrated session of ProjectWise."); } } else { BPSUtilities.WriteLog("No integrated session of ProjectWise."); } ListReferences(true); } }
public static void Place(string unparsed) { if (string.IsNullOrEmpty(unparsed)) { string sFileName = Bentley.MstnPlatformNET.Session.Instance.GetActiveDgnFile().GetFileName(); BPSUtilities.WriteLog($"Filename is '{sFileName}'"); int iProjectNo = 0, iDocumentNo = 0; PWWrapper.aaApi_Initialize(0); if (mcmMain_GetDocumentIdByFilePath(sFileName, 1, ref iProjectNo, ref iDocumentNo)) { BPSUtilities.WriteLog($"IDs: {iProjectNo}, {iDocumentNo}"); if (iProjectNo > 0 && iDocumentNo > 0) { int GMAIL_PROJECTWISE_WEB_VIEW_SETTING = -5250; string sWebViewURL = PWWrapper.GetPWStringSetting(GMAIL_PROJECTWISE_WEB_VIEW_SETTING); string sProjectGUIDString = PWWrapper.GetProjectGuidStringFromId(iProjectNo); string sDocumentGUIDString = PWWrapper.GetGuidStringFromIds(iProjectNo, iDocumentNo); if (!string.IsNullOrEmpty(sWebViewURL)) { unparsed = $"{sWebViewURL}?project={sProjectGUIDString}&item={sDocumentGUIDString}"; } else { BPSUtilities.WriteLog("No web view link address set."); } } else { BPSUtilities.WriteLog("No integrated session of ProjectWise."); } } else { BPSUtilities.WriteLog("No integrated session of ProjectWise."); } if (string.IsNullOrEmpty(unparsed)) { unparsed = "www.bentley.com"; } BPSUtilities.WriteLog($"Make code for this: {unparsed}"); PlaceQRCode.InstallNewInstance(unparsed); } else { BPSUtilities.WriteLog($"Make code for this: {unparsed}"); PlaceQRCode.InstallNewInstance(unparsed); } }