/// <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);
            }
        }
Exemplo n.º 2
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            // Assign the ScrollView called "AttributeContainer" to this variable
            AttributeContainer = GetTemplateChild("AttributeContainer") as FrameworkElement;
            // Dynamic Toolbar content control  (content comes from Tools.xml)
            _popupToolbarContentControl = GetTemplateChild(PopupToolbarContainerName) as ContentControl;

            PopulateToolbar();

            if (this.PopupInfo != null)
            {
                this.PopupInfo.AttributeContainer = this.AttributeContainer;
            }
            EditValuesCommand cmd = GetEditValuesToolCommand();

            if (cmd != null)
            {
                InfoWindow container = PopupInfo.Container as InfoWindow;
                cmd.OriginalPopupContent = container.Content;
            }
        }
        /// <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);
            }
        }