Пример #1
0
		public MainWindowControlState Read(ISettingsSection section) {
			HorizontalContentState = StackedContentStateSerializer.TryDeserialize(section.GetOrCreateSection(HORIZONTALCONTENT_SECT));
			VerticalContentState = StackedContentStateSerializer.TryDeserialize(section.GetOrCreateSection(VERTICALCONTENT_SECT));

			foreach (var twSect in section.SectionsWithName(TOOLWINDOWUI_SECT)) {
				var state = ToolWindowUIState.TryDeserialize(twSect);
				if (state == null)
					continue;
				switch (state.Location) {
				case AppToolWindowLocation.Left:	LeftState = state; break;
				case AppToolWindowLocation.Right:	RightState = state; break;
				case AppToolWindowLocation.Top:		TopState = state; break;
				case AppToolWindowLocation.Bottom:	BottomState = state; break;
				}
			}

			foreach (var locSect in section.SectionsWithName(LOCATION_SECT)) {
				var guid = locSect.Attribute<Guid?>(LOCATION_GUID_ATTR);
				var loc = locSect.Attribute<AppToolWindowLocation?>(LOCATION_ATTR);
				if (guid == null || loc == null)
					continue;
				if (!IsValid(loc.Value))
					continue;
				SavedLocations[guid.Value] = loc.Value;
			}

			return this;
		}
Пример #2
0
		SerializedTabGroupWindow(string name, int index, bool isHorizontal, StackedContentState stackedContentState) {
			Name = name;
			Index = index;
			IsHorizontal = isHorizontal;
			TabGroups = new List<SerializedTabGroup>();
			StackedContentState = stackedContentState;
		}
Пример #3
0
		public static void Serialize(ISettingsSection section, StackedContentState state) {
			section.Attribute(ISHORIZONTAL_ATTR, state.IsHorizontal);
			foreach (var length in state.RowsCols) {
				var lengthSect = section.CreateSection(LENGTH_SECTION);
				lengthSect.Attribute(LENGTH_ATTR, length);
			}
		}
Пример #4
0
 public static void Serialize(ISettingsSection section, StackedContentState state)
 {
     section.Attribute(ISHORIZONTAL_ATTR, state.IsHorizontal);
     foreach (var length in state.RowsCols)
     {
         var lengthSect = section.CreateSection(LENGTH_SECTION);
         lengthSect.Attribute(LENGTH_ATTR, length);
     }
 }
Пример #5
0
		public static StackedContentState TryDeserialize(ISettingsSection section) {
			var state = new StackedContentState();
			bool? b = section.Attribute<bool?>(ISHORIZONTAL_ATTR);
			if (b == null)
				return null;
			state.IsHorizontal = b.Value;
			foreach (var lengthSect in section.SectionsWithName(LENGTH_SECTION)) {
				var length = lengthSect.Attribute<GridLength?>(LENGTH_ATTR);
				if (length == null)
					return null;
				state.RowsCols.Add(length.Value);
			}
			return state;
		}
Пример #6
0
        public static StackedContentState TryDeserialize(ISettingsSection section)
        {
            var  state = new StackedContentState();
            bool?b     = section.Attribute <bool?>(ISHORIZONTAL_ATTR);

            if (b == null)
            {
                return(null);
            }
            state.IsHorizontal = b.Value;
            foreach (var lengthSect in section.SectionsWithName(LENGTH_SECTION))
            {
                var length = lengthSect.Attribute <GridLength?>(LENGTH_ATTR);
                if (length == null)
                {
                    return(null);
                }
                state.RowsCols.Add(length.Value);
            }
            return(state);
        }
Пример #7
0
 public ToolWindowUIState Save(AppToolWindowLocation location, MainWindowControl.ToolWindowUI ui)
 {
     this.Location = location;
     this.StackedContentState = ((ToolWindowGroupManager)ui.ToolWindowGroupManager).StackedContentState;
     var groups = ui.ToolWindowGroupManager.TabGroups.ToList();
     this.Index = groups.IndexOf(ui.ToolWindowGroupManager.ActiveTabGroup);
     this.IsHorizontal = ui.ToolWindowGroupManager.IsHorizontal;
     foreach (var g in groups)
         Groups.Add(new ToolWindowGroupState().Save(g));
     return this;
 }
Пример #8
0
 SerializedTabGroupWindow(string name, int index, bool isHorizontal, StackedContentState stackedContentState)
 {
     this.name = name;
     this.index = index;
     this.isHorizontal = isHorizontal;
     this.tabGroups = new List<SerializedTabGroup>();
     this.stackedContentState = stackedContentState;
 }