Exemple #1
0
        protected void ViewCognitiveImage(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            if (args.IsPostBack)
            {
                return;
            }

            string attribute = XmlValue.GetAttribute("mediaid");

            if (string.IsNullOrEmpty(attribute))
            {
                SheerResponse.Alert("Select an image from the Media Library first.");
                return;
            }

            Language language = Language.Parse(ItemLanguage);
            Item     i        = Client.ContentDatabase.GetItem(attribute, language);

            ModalDialogOptions mdo = new ModalDialogOptions($"/SitecoreCognitiveServices/CognitiveImageSearch/ImageAnalysis?id={attribute}&language={language.Name}&db={Client.ContentDatabase.Name}")
            {
                Header   = "Cognitive Analysis",
                Height   = DataWrapper.GetFieldDimension(i, "height", 500, 60),
                Width    = DataWrapper.GetFieldDimension(i, "width", 810, 41),
                Message  = "View the cognitive analysis of the current item",
                Response = true
            };

            SheerResponse.ShowModalDialog(mdo);
            args.WaitForPostBack();
        }