public override bool CanExecute(object parameter)
        {
            var popupInfo = parameter as OnClickPopupInfo;

            if (popupInfo == null ||
                popupInfo.PopupItem == null ||
                !(popupInfo.PopupItem.Layer is FeatureLayer) ||
                popupInfo.PopupItem.Graphic == null ||
                !((FeatureLayer)popupInfo.PopupItem.Layer).IsAddAttachmentAllowed(popupInfo.PopupItem.Graphic))
            {
                return(false);
            }

            if (popupInfo == null || popupInfo.PopupItem == null || popupInfo.PopupItem.Layer == null)
            {
                return(false);
            }

            bool isEditable = LayerProperties.GetIsEditable(popupInfo.PopupItem.Layer);

            if (!isEditable)
            {
                return(false);
            }

            FeatureLayer fl = popupInfo.PopupItem.Layer as FeatureLayer;

            if (fl == null)
            {
                return(false);
            }

            return(fl.LayerInfo.HasAttachments);
        }
        /// <summary>
        /// Executes edit values command if that is the mode we are in
        /// </summary>
        /// <param name="popupInfo"></param>
        public static void SyncPreviousDisplayMode(OnClickPopupInfo popupInfo)
        {
            if (popupInfo == null || popupInfo.PopupItem == null)
            {
                return;
            }

            InfoWindow win = popupInfo.Container as InfoWindow;

            if (win == null || OnClickPopupControl == null)
            {
                return;
            }

            // find the edit values command associated with the active tool
            EditValuesCommand editValues = OnClickPopupControl.GetEditValuesToolCommand();

            bool isEditable = LayerProperties.GetIsEditable(popupInfo.PopupItem.Layer);

            if (isEditable)
            {
                if (editValues == null)
                {
                    //if we were showing edit values panel, show that again
                    if (_wasEditingValues && popupInfo != null && popupInfo.Container is InfoWindow)
                    {
                        win.Dispatcher.BeginInvoke(() =>
                        {
                            EditValuesCommand cmd =
                                new EditValuesCommand();
                            cmd.Execute(popupInfo);
                        });
                    }
                }
                else
                {
                    if (_wasEditingValues)
                    {
                        win.Dispatcher.BeginInvoke(() => { editValues.Execute(popupInfo); });
                    }
                    else
                    {
                        editValues.BackToOriginalContent(popupInfo);
                    }
                }
            }
            else if (editValues != null)
            {
                editValues.BackToOriginalContent(popupInfo);
            }
        }
        public override bool CanExecute(object parameter)
        {
            var popupInfo = parameter as OnClickPopupInfo;

            PopupInfo = popupInfo;
            if (popupInfo == null ||
                popupInfo.PopupItem == null ||
                !(popupInfo.PopupItem.Layer is FeatureLayer) ||
                popupInfo.PopupItem.Graphic == null ||
                !((FeatureLayer)popupInfo.PopupItem.Layer).IsDeleteAllowed(popupInfo.PopupItem.Graphic))
            {
                return(false);
            }

            bool isEditable = LayerProperties.GetIsEditable(popupInfo.PopupItem.Layer);

            return(isEditable);
        }
Пример #4
0
        public static bool CanEditShape(PopupItem popup, ESRI.ArcGIS.Client.Editor editor = null)
        {
            if (editor == null)
            {
                editor = FindEditorInVisualTree();
            }
            var featureLayer = popup.Layer as FeatureLayer;

            if (popup == null ||
                popup.Graphic == null ||
                featureLayer == null ||
                featureLayer.LayerInfo == null ||
                !featureLayer.IsGeometryUpdateAllowed(popup.Graphic) ||
                !(LayerProperties.GetIsEditable(featureLayer)) ||
                editor == null ||
                editor.EditVertices == null ||
                !editor.EditVerticesEnabled ||
                View.Instance.Map == null)
            {
                return(false);
            }

            return(true);
        }