Esempio n. 1
0
 public static void InstallNewInstance(string sUnparsed)
 {
     try
     {
         BPSUtilities.WriteLog("PlaceQRCode InstallNewInstance");
         PlaceQRCode qrCodeTool = new PlaceQRCode(0, 0, sUnparsed);
         qrCodeTool.InstallTool();
     }
     catch (Exception ex)
     {
         BPSUtilities.WriteLog($"PlaceQRCode InstallNewInstance {ex.Message}\n{ex.StackTrace}");
     }
 }
        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);
            }
        }