示例#1
0
		public void SetLayout(LayoutInfo layout)
		{
			Dictionary<Guid, Type> types = new Dictionary<Guid, Type>();
			foreach (LayoutLink layoutLink in layout.Links)
			{
				Type type = Type.GetType(layoutLink.TypeName, false);
				if (type != null)
				{
					this.Open(type);
					types.Add(layoutLink.Guid, type);
				}
			}
			ResolveDockControlEventHandler controlEventHandler = (ResolveDockControlEventHandler)((sender, e) =>
			{
				Type local_0;
				DockControl local_1;
				if (!types.TryGetValue(e.Guid, out local_0) || !this.controls.TryGetControl(local_0, null, out local_1))
					return;
				e.DockControl = (TD.SandDock.DockControl)local_1;
			});
			try
			{
				this.ResolveDockControl += controlEventHandler;
				base.SetLayout(layout.Layout);
			}
			finally
			{
				this.ResolveDockControl -= controlEventHandler;
			}
		}
示例#2
0
		public new LayoutInfo GetLayout()
		{
			LayoutInfo layoutInfo = new LayoutInfo();
			List<LayoutLink> list = new List<LayoutLink>();
			foreach (DockControl dockControl in this.controls)
			{
				if (dockControl.PersistState)
					list.Add(new LayoutLink()
					{
						TypeName = string.Format("{0}, {1}", dockControl.GetType().FullName, dockControl.GetType().Assembly.GetName().Name),
						Guid = dockControl.Guid
					});
			}
			layoutInfo.Links = list.ToArray();
			layoutInfo.Layout = base.GetLayout();
			return layoutInfo;
		}