Ejemplo n.º 1
0
        public static ToolWindowUIState TryDeserialize(ISettingsSection section)
        {
            var  location     = section.Attribute <AppToolWindowLocation?>(LOCATION_ATTR);
            int? index        = section.Attribute <int?>(INDEX_ATTR);
            bool?isHorizontal = section.Attribute <bool?>(ISHORIZONTAL_ATTR);

            if (location == null || index == null || isHorizontal == null)
            {
                return(null);
            }
            var state = new ToolWindowUIState();

            state.Location     = location.Value;
            state.Index        = index.Value;
            state.IsHorizontal = isHorizontal.Value;

            foreach (var sect in section.SectionsWithName(GROUP_SECT))
            {
                var content = ToolWindowGroupState.TryDeserialize(sect);
                if (content == null)
                {
                    return(null);
                }
                state.Groups.Add(content);
            }

            state.StackedContentState = StackedContentStateSerializer.TryDeserialize(section.GetOrCreateSection(STACKEDCONTENTSTATE_SECTION));
            if (state.StackedContentState == null)
            {
                return(null);
            }

            return(state);
        }
Ejemplo n.º 2
0
 public static void Serialize(ISettingsSection section, ToolWindowGroupState state)
 {
     section.Attribute(INDEX_ATTR, state.Index);
     foreach (var content in state.Contents)
     {
         ToolWindowContentState.Serialize(section.CreateSection(CONTENT_SECT), content);
     }
 }
Ejemplo n.º 3
0
 public static void Serialize(ISettingsSection section, ToolWindowUIState state)
 {
     section.Attribute(LOCATION_ATTR, state.Location);
     section.Attribute(INDEX_ATTR, state.Index);
     section.Attribute(ISHORIZONTAL_ATTR, state.IsHorizontal);
     foreach (var content in state.Groups)
     {
         ToolWindowGroupState.Serialize(section.CreateSection(GROUP_SECT), content);
     }
     Debug.Assert(state.StackedContentState != null);
     if (state.StackedContentState != null)
     {
         StackedContentStateSerializer.Serialize(section.GetOrCreateSection(STACKEDCONTENTSTATE_SECTION), state.StackedContentState);
     }
 }
Ejemplo n.º 4
0
        public static ToolWindowGroupState TryDeserialize(ISettingsSection section)
        {
            int?index = section.Attribute <int?>(INDEX_ATTR);

            if (index == null)
            {
                return(null);
            }
            var state = new ToolWindowGroupState();

            state.Index = index.Value;

            foreach (var sect in section.SectionsWithName(CONTENT_SECT))
            {
                var content = ToolWindowContentState.TryDeserialize(sect);
                if (content == null)
                {
                    return(null);
                }
                state.Contents.Add(content);
            }

            return(state);
        }
Ejemplo n.º 5
0
        public static ToolWindowGroupState TryDeserialize(ISettingsSection section)
        {
            int? index = section.Attribute<int?>(INDEX_ATTR);
            if (index == null)
                return null;
            var state = new ToolWindowGroupState();
            state.Index = index.Value;

            foreach (var sect in section.SectionsWithName(CONTENT_SECT)) {
                var content = ToolWindowContentState.TryDeserialize(sect);
                if (content == null)
                    return null;
                state.Contents.Add(content);
            }

            return state;
        }
Ejemplo n.º 6
0
 public static void Serialize(ISettingsSection section, ToolWindowGroupState state)
 {
     section.Attribute(INDEX_ATTR, state.Index);
     foreach (var content in state.Contents)
         ToolWindowContentState.Serialize(section.CreateSection(CONTENT_SECT), content);
 }