Ejemplo n.º 1
0
 /// <summary>
 /// Reset internal state and position of the content
 /// </summary>
 /// <remarks>After a <see cref="DockableContent"/> is hidden AvalonDock save its state and position in order to
 /// restore it correctly when user wants to reshow it calling <see cref="DockingManager.Show"/> function. Call this method
 /// if you want to reset these data and provide your state and anchor style calling one of the overloads of the function
 /// <see cref="DockingManager.Show"/>.</remarks>
 public void ResetSavedStateAndPosition()
 {
     SavedStateAndPosition = null;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Restore content specific layout settings
        /// </summary>
        /// <param name="storeReader">Saved xml element containg content layout settings</param>
        /// <remarks>Custom derived class must overload this method to restore custom layout settings previously saved trought <see cref="SaveLayout"/>.</remarks>
        public override void RestoreLayout(XmlElement contentElement)
        {
            if (contentElement.HasAttribute("FloatingWindowSize"))
                FloatingWindowSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("FloatingWindowSize"));
            if (contentElement.HasAttribute("FlyoutWindowSize"))
                FlyoutWindowSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("FlyoutWindowSize"));

            Size effectiveSize = new Size(0d, 0d);
            if (contentElement.HasAttribute("EffectiveSize"))
            {
                // Store
                effectiveSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("EffectiveSize"));
            }

            ResizingPanel.SetEffectiveSize(this, effectiveSize);

            if (contentElement.HasAttribute("ChildIndex"))
            {
                Pane paneRef = null;
                Guid containerPaneGuid = Guid.Empty;
                if (contentElement.HasAttribute("ContainerPaneID"))
                {
                    containerPaneGuid = new Guid(contentElement.GetAttribute("ContainerPaneID"));

                    if (Manager != null)
                    { 
                        ILinqToTree<DependencyObject> itemFound = new LogicalTreeAdapter(Manager).Descendants().FirstOrDefault(el => el.Item is DockablePane && ((el.Item as DockablePane).ID == containerPaneGuid));
                        paneRef = itemFound != null ? itemFound.Item as DockablePane : null;
                    }
                }

                if (paneRef != null)
                {
                    _savedStateAndPosition = new DockableContentStateAndPosition(
                        paneRef,
                        int.Parse(contentElement.GetAttribute("ChildIndex")),
                        double.Parse(contentElement.GetAttribute("Width")),
                        double.Parse(contentElement.GetAttribute("Height")),
                        (AnchorStyle)Enum.Parse(typeof(AnchorStyle), contentElement.GetAttribute("Anchor")),
                        (DockableContentState)Enum.Parse(typeof(DockableContentState), contentElement.GetAttribute("State")));
                }
                else
                {
                    _savedStateAndPosition = new DockableContentStateAndPosition(
                       containerPaneGuid,
                       int.Parse(contentElement.GetAttribute("ChildIndex")),
                       double.Parse(contentElement.GetAttribute("Width")),
                       double.Parse(contentElement.GetAttribute("Height")),
                       (AnchorStyle)Enum.Parse(typeof(AnchorStyle), contentElement.GetAttribute("Anchor")),
                       (DockableContentState)Enum.Parse(typeof(DockableContentState), contentElement.GetAttribute("State")));
                }
            }
        } 
Ejemplo n.º 3
0
 internal void SaveCurrentStateAndPosition()
 {
     SavedStateAndPosition = new DockableContentStateAndPosition(
         this);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Restore content specific layout settings
        /// </summary>
        /// <param name="storeReader">Saved xml element containg content layout settings</param>
        /// <remarks>Custom derived class must overload this method to restore custom layout settings previously saved trought <see cref="SaveLayout"/>.</remarks>
        public virtual void RestoreLayout(XmlElement contentElement)
        {
            if (contentElement.HasAttribute("FloatingWindowSize"))
                FloatingWindowSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("FloatingWindowSize"));


            Size effectiveSize = new Size(0d, 0d);
            if (contentElement.HasAttribute("EffectiveSize"))
            {
                // Store
                effectiveSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("EffectiveSize"));
            }

            ResizingPanel.SetEffectiveSize(this, effectiveSize);

            if (contentElement.HasAttribute("ChildIndex"))
            {
                _savedStateAndPosition = new DockableContentStateAndPosition(
                    ContainerPane,
                    int.Parse(contentElement.GetAttribute("ChildIndex")),
                    double.Parse(contentElement.GetAttribute("Width")),
                    double.Parse(contentElement.GetAttribute("Height")),
                    (AnchorStyle) Enum.Parse(typeof(AnchorStyle), contentElement.GetAttribute("Anchor")),
					(DockableContentState) Enum.Parse(typeof(DockableContentState), contentElement.GetAttribute("State"))
                    );
                    //contentElement.HasAttribute("State") ? (DockableContentState)Enum.Parse(typeof(DockableContentState), contentElement.GetAttribute("State") );
            }
        } 
Ejemplo n.º 5
0
 internal void SaveCurrentStateAndPosition()
 {
     //if (State == DockableContentState.Docked)
     //{
         _savedStateAndPosition = new DockableContentStateAndPosition(
             this);
     //}
     //else
     //{
     //    _savedStateAndPosition = null;
     //}
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Reset internal state and position of the content
 /// </summary>
 /// <remarks>After a <see cref="DockableContent"/> is hidden AvalonDock save its state and position in order to
 /// restore it correctly when user wants to reshow it calling <see cref="DockingManager.Show"/> function. Call this method
 /// if you want to reset these data and provide your state and anchor style calling one of the overloads of the function
 /// <see cref="DockingManager.Show"/>.</remarks>
 public void ResetSavedStateAndPosition()
 {
     SavedStateAndPosition = null;
 }
Ejemplo n.º 7
0
 internal void SaveCurrentStateAndPosition()
 {
     SavedStateAndPosition = new DockableContentStateAndPosition(
         this);
 }