Esempio n. 1
0
        /// <summary>
        /// Set the popupinfo on the layer definition
        /// </summary>
        /// <param name="layer"></param>
        /// <param name="popupInfo"></param>
        public static void SetPopupInfo(this Layer layer, CIMPopupInfo popupInfo)
        {
            var layerDef = layer.GetDefinition();

            layerDef.PopupInfo = popupInfo;
            layer.SetDefinition(layerDef);
        }
 /// <summary>
 /// Set the popupinfo on the layer definition
 /// </summary>
 /// <param name="layer"></param>
 /// <param name="popupInfo"></param>
 public static void SetPopupInfo(this Layer layer, CIMPopupInfo popupInfo) {
     var layerDef = layer.GetDefinition();
     layerDef.PopupInfo = popupInfo;
     layer.SetDefinition(layerDef);
 }
        /// <summary>
        /// Generate the CIMPopupInfo for the layer from the current media infos
        /// </summary>
        /// <returns></returns>
        public CIMPopupInfo CreatePopupInfo()
        {
            CIMPopupInfo popupInfo = new CIMPopupInfo();

            popupInfo.Title = this.Title;

            List <CIMMediaInfo> mediaInfos = new List <CIMMediaInfo>();

            if (this.TextMediaInfo != null)
            {
                var cimText = new CIMTextMediaInfo {
                    Row    = 1,
                    Column = 1,
                    Text   = this.TextMediaInfo.Text
                };
                mediaInfos.Add(cimText);
            }
            if (this.TableMediaInfo != null)
            {
                var cimTable = new CIMTableMediaInfo {
                    Row    = mediaInfos.Count + 1,
                    Column = 1,
                    Fields = this.TableMediaInfo.FieldNames.ToArray()
                };

                mediaInfos.Add(cimTable);
            }
            foreach (var cimMediaInfo in OtherMediaInfos)
            {
                if (cimMediaInfo is TextMediaInfo || cimMediaInfo is TableMediaInfo)
                {
                    continue;
                }
                if (cimMediaInfo is AttachmentsMediaInfo)
                {
                    var mediaInfo = CreateAttachmentMediaInfo((AttachmentsMediaInfo)cimMediaInfo);
                    mediaInfo.Row    = mediaInfos.Count + 1;
                    mediaInfo.Column = 1;
                    mediaInfos.Add(mediaInfo);
                }
                else if (cimMediaInfo is ImageMediaInfo)
                {
                    var mediaInfo = CreateImageMediaInfo((ImageMediaInfo)cimMediaInfo);
                    mediaInfo.Row    = mediaInfos.Count + 1;
                    mediaInfo.Column = 1;
                    mediaInfos.Add(mediaInfo);
                }
                else if (cimMediaInfo is ChartMediaInfo)
                {
                    var mediaInfo = CreateChartMediaInfo((ChartMediaInfo)cimMediaInfo);
                    mediaInfo.Row    = mediaInfos.Count + 1;
                    mediaInfo.Column = 1;
                    mediaInfos.Add(mediaInfo);
                }
            }
            if (mediaInfos.Count > 0)
            {
                popupInfo.MediaInfos = mediaInfos.ToArray();
            }
            return(popupInfo);;
        }
        /// <summary>
        /// Generate the CIMPopupInfo for the layer from the current media infos
        /// </summary>
        /// <returns></returns>
        public CIMPopupInfo CreatePopupInfo() {
            CIMPopupInfo popupInfo = new CIMPopupInfo();
            popupInfo.Title = this.Title;
            
            List<CIMMediaInfo> mediaInfos = new List<CIMMediaInfo>();
            
            if (this.TextMediaInfo != null) {
                var cimText = new CIMTextMediaInfo {
                    Row = 1,
                    Column = 1,
                    Text = this.TextMediaInfo.Text
                };
                mediaInfos.Add(cimText);
            }
            if (this.TableMediaInfo != null) {
                var cimTable = new CIMTableMediaInfo {
                    Row = mediaInfos.Count + 1,
                    Column = 1,
                    Fields = this.TableMediaInfo.FieldNames.ToArray()
                };

                mediaInfos.Add(cimTable);
            }
            foreach (var cimMediaInfo in OtherMediaInfos) {
                if (cimMediaInfo is TextMediaInfo || cimMediaInfo is TableMediaInfo)
                    continue;
                if (cimMediaInfo is AttachmentsMediaInfo) {
                    var mediaInfo = CreateAttachmentMediaInfo((AttachmentsMediaInfo)cimMediaInfo);
                    mediaInfo.Row = mediaInfos.Count + 1;
                    mediaInfo.Column = 1;
                    mediaInfos.Add(mediaInfo);
                }
                else if (cimMediaInfo is ImageMediaInfo) {
                    var mediaInfo = CreateImageMediaInfo((ImageMediaInfo)cimMediaInfo);
                    mediaInfo.Row = mediaInfos.Count + 1;
                    mediaInfo.Column = 1;
                    mediaInfos.Add(mediaInfo);
                }
                else if (cimMediaInfo is ChartMediaInfo) {
                    var mediaInfo = CreateChartMediaInfo((ChartMediaInfo)cimMediaInfo);
                    mediaInfo.Row = mediaInfos.Count + 1;
                    mediaInfo.Column = 1;
                    mediaInfos.Add(mediaInfo);
                }
             
            }
            if (mediaInfos.Count > 0) {
                popupInfo.MediaInfos = mediaInfos.ToArray();
            }
            return popupInfo;;
        }