private static void DeserializeInternal(ILPanelEditor editor, IDeserializer deserializer, object instance, IEnumerable<PropertyInfo> properties, string path) { foreach (PropertyInfo property in properties) { if (property.CanRead && property.CanWrite) { object value = property.GetValue(instance, null); string configPrefixChild = String.Format("{0}:{1}", path, ToIdentifier(property.Name)); if (deserializer.Contains(SplitPath(configPrefixChild))) { PropertyInfo[] childProperties = GetProperties(value); if (childProperties.Length > 0 && editor.WrapperMap.Values.Contains(value.GetType())) { DeserializeInternal(editor, deserializer, value, childProperties, String.Format("{0}:{1}", path, ToIdentifier(property.Name))); continue; } } try { string[] pathParts = SplitPath(path); if (deserializer.Contains(pathParts, property.Name)) property.SetValue(instance, deserializer.Get(pathParts, property.Name, property.PropertyType), null); } catch { // Exception in deserialization (e.g. ElementNotFound or not deserializable) } } } }
public PanelEditorForm(ILPanelEditor editor) { this.editor = editor; plotBrowser = new PlotBrowserForm(editor); InitializeComponent(); }
public static void SerializeToFile(ILPanelEditor editor, string filename) { var serializer = new XmlSerializer(); editor.Serialize(serializer); serializer.SaveToFile(filename); }
public ILTickWrapper(ILTick source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, String.IsNullOrEmpty(name) ? "Tick" : name, label) { this.source = source; this.label = new ILLabelWrapper(source.Label, editor, path, ILTickCollection.TickLabelTag); }
public ILSelectionRectangleWrapper(ILSelectionRectangle source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, ILSelectionRectangle.LineTag), label) { this.source = source; lines = new ILLinesWrapper(source.Lines, editor, Path, ILScreenObject.BorderTag, "Lines"); }
public static string SerializeToString(ILPanelEditor editor) { var serializer = new XmlSerializer(); editor.Serialize(serializer); return serializer.SaveToString(); }
public ILCameraWrapper(ILCamera source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, "Camera"), label) { // ILCamera needs to be accessed from SceneSyncRoot (instead of Scene) this.source = GetSyncNode(source); this.source.MouseDoubleClick += OnMouseDoubleClick; }
public ILLegendItemWrapper(ILLegendItem source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, ILLegendItem.LegendItemTag), String.IsNullOrEmpty(label) ? GetLegendItemLabel(source) : label) { this.source = source; this.label = new ILLabelWrapper(source.Label, editor, Path, ILLegendItem.LabelTag); }
public ILMarkerWrapper(ILMarker source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, "Marker"), label) { this.source = source; fill = new ILTrianglesWrapper(source.Fill, editor, Path, ILMarker.DefaultFillTag, "Fill"); border = new ILLinesWrapper(source.Border, editor, Path, ILMarker.DefaultBorderTag, "Border"); }
public ILLabelWrapper(ILLabel source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, "Label"), String.IsNullOrEmpty(label) ? GetLabel(source) : label) { this.source = source; this.source.MouseDoubleClick += OnMouseDoubleClick; }
public ILScreenObjectWrapper(ILScreenObject source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, "ScreenObject"), label) { this.source = source; border = new ILLinesWrapper(source.Border, editor, Path, ILScreenObject.BorderTag, "Border"); background = new ILTrianglesWrapper(source.Background, editor, Path, ILScreenObject.BackgroundTag, "Background"); }
public ILAxisCollectionWrapper(ILAxisCollection source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, ILAxisCollection.DefaultTag), label) { this.source = source; xAxis = new ILAxisWrapper(source.XAxis, editor, Path); yAxis = new ILAxisWrapper(source.YAxis, editor, Path); zAxis = new ILAxisWrapper(source.ZAxis, editor, Path); }
public ILPlotCubeScaleGroupWrapper(ILPlotCubeScaleGroup source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, ILPlotCubeScaleGroup.DefaultTag), String.IsNullOrEmpty(label) ? GetPlotCubeScaleGroupLabel(source, editor.Panel) : label) { this.source = source; axes = new ILAxisCollectionWrapper(source.First<ILAxisCollection>(ILPlotCubeScaleGroup.AxesTag), editor, Path, ILPlotCubeScaleGroup.AxesTag); lines = new ILLinesWrapper(source.First<ILLines>(ILPlotCubeScaleGroup.LinesTag), editor, Path, ILPlotCubeScaleGroup.LinesTag); }
public ILPlotCubeDataGroupWrapper(ILPlotCubeDataGroup source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, ILPlotCubeScaleGroup.PlotsTag), String.IsNullOrEmpty(label) ? GetPlotCubeDataGroupLabel(source, editor.Panel) : label) { this.source = source; scaleModes = new ILScaleModesWrapper(source.ScaleModes, editor, Path); limits = new ILLimitsWrapper(source.Limits, GetSyncNode(source).Limits, editor, Path); }
public ILTickCollectionWrapper(ILTickCollection source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, ILPlotCube.DefaultTag), label) { // ILTickCollection needs to be accessed from SceneSyncRoot (instead of Scene) this.source = GetSyncNode(source); lines = new ILLinesWrapper(this.source.Lines, editor, Path, ILTickCollection.TickLinesTag, "TickLines"); ticks = new ReadOnlyCollection<ILTickWrapper>(((IEnumerable<ILTick>) source).Select(tick => new ILTickWrapper(tick, editor, Path)).ToList()); }
protected ILShapeWrapper(ILShape source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, "Shape"), label) { this.source = source; // Subscribe mouse events on SceneSyncRoot (instead of Scene) sourceSync = GetSyncNode(source); sourceSync.MouseDoubleClick += OnMouseDoubleClick; }
public ILCircleWrapper(ILCircle source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, ILCircle.CircleGroupTag), label) { this.source = source; fill = new ILTrianglesWrapper(source.Fill, editor, Path, ILCircle.FillTagDefault); border = new ILLinesWrapper(source.Border, editor, Path, ILCircle.BorderTagDefault); this.source.MouseDoubleClick += OnMouseDoubleClick; }
protected ILWrapperBase(object source, ILPanelEditor editor, string path, string name, string label = null) { this.source = source; this.editor = editor; this.path = String.IsNullOrEmpty(path) ? name : path + ":" + name; this.name = name; this.label = String.IsNullOrEmpty(label) ? name : label; editor.Wrappers.Add(this); }
public ILPlotCubeWrapper(ILPlotCube source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, ILPlotCube.DefaultTag), String.IsNullOrEmpty(label) ? GetPlotCubeLabel(source, editor.Panel) : label) { this.source = source; // Subscribe mouse events on SceneSyncRoot (instead of Scene) sourceSync = GetSyncNode(source); sourceSync.MouseClick += OnMouseClick; }
public ILSphereWrapper(ILSphere source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, ILSphere.DefaultSphereTag), label) { this.source = source; fill = new ILTrianglesWrapper(source.Fill, editor, Path, ILSphere.DefaultFillTag); wireframe = new ILLinesWrapper(source.Wireframe, editor, Path, ILSphere.DefaultWireframeTag); this.source.MouseDoubleClick += OnMouseDoubleClick; }
public ILSurfaceWrapper(ILSurface source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, ILLinePlot.LinePlotTag), String.IsNullOrEmpty(label) ? GetSurfaceLabelFromLegend(source, editor.Panel) : label) { this.source = source; fill = new ILTrianglesWrapper(source.Fill, editor, Path, ILSurface.FillTag, "Fill"); wireframe = new ILLinesWrapper(source.Wireframe, editor, Path, ILSurface.WireframeTag, "Wireframe"); positions = new ReadOnlyCollection<float>(source.Positions.ToList()); }
public ILGearWrapper(ILGear source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, "Gear"), label) { this.source = source; fill = new ILTrianglesWrapper(source.Fill, editor, Path, "Fill"); wireframe = new ILLinesWrapper(source.Wireframe, editor, Path, "Wireframe"); this.source.MouseDoubleClick += OnMouseDoubleClick; }
public ILLinePlotWrapper(ILLinePlot source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, ILLinePlot.LinePlotTag), String.IsNullOrEmpty(label) ? GetLinePlotLabelFromLegend(source, editor.Panel) : label) { this.source = source; line = new ILLinesWrapper(source.Line, editor, Path, ILLinePlot.LineTag, "Line"); marker = new ILMarkerWrapper(source.Marker, editor, Path, ILLinePlot.MarkerTag, "Marker"); positions = new ReadOnlyCollection<float>(source.Positions.ToList()); }
public ILCylinderWrapper(ILCylinder source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, ILCylinder.CylinderGroupTag), label) { this.source = source; bottom = new ILCircleWrapper(source.Bottom, editor, Path, ILCylinder.BottomTag); top = new ILCircleWrapper(source.Top, editor, Path, ILCylinder.TopTag); hull = new ILTrianglesWrapper(source.Hull, editor, Path, ILCylinder.HullTag); this.source.MouseDoubleClick += OnMouseDoubleClick; }
public ILConeWrapper(ILCone source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, ILCone.ConeGroupTag), label) { this.source = source; bottom = new ILTrianglesWrapper(source.Bottom, editor, Path, ILCone.BottomTag); hull = new ILTrianglesWrapper(source.Hull, editor, Path, ILCone.HullTag); border = new ILLinesWrapper(source.Border, editor, Path, ILCone.BorderTag); this.source.MouseDoubleClick += OnMouseDoubleClick; }
public ILAxisWrapper(ILAxis source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, String.IsNullOrEmpty(name) ? source.AxisName.ToString().Replace(" ", String.Empty) : name, String.IsNullOrEmpty(label) ? source.AxisName.ToString() : label) { this.source = source; this.label = new ILLabelWrapper(source.Label, editor, Path, ILAxis.LabelTag, "AxisLabel"); scaleLabel = new ILLabelWrapper(source.ScaleLabel, editor, Path, ILAxis.ScaleLabelTag, "ScaleLabel"); ticks = new ILTickCollectionWrapper(source.Ticks, editor, Path, "TicksCollection"); gridMajor = new ILLinesWrapper(source.GridMajor, editor, Path, ILAxis.GridMajorLinesTag, "GridMajor"); gridMinor = new ILLinesWrapper(source.GridMinor, editor, Path, ILAxis.GridMinorLinesTag, "GridMinor"); }
private static void SerializeInternal(ILPanelEditor editor, ISerializer serializer, object instance, IEnumerable<PropertyInfo> properties, string path) { foreach (PropertyInfo property in properties) { if (property.CanRead) { object value = property.GetValue(instance, null); if (value != null && editor.WrapperMap.Values.Contains(value.GetType())) { PropertyInfo[] childProperties = GetProperties(value); if (childProperties.Length > 0) { SerializeInternal(editor, serializer, value, childProperties, String.Format("{0}:{1}", path, ToIdentifier(property.Name))); continue; } } if (property.CanWrite) serializer.Set(SplitPath(path), ToIdentifier(property.Name), value); } } }
protected ILDrawableWrapper(ILDrawable source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, String.IsNullOrEmpty(name) ? "Drawable" : name, label) { this.source = source; }
public ILTrianglesWrapper(ILTriangles source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, "Triangles"), label) { this.source = source; }
public ILPointLightWrapper(ILPointLight source, ILPanelEditor editor, string path, string name = null, string label = null) : base(source, editor, path, BuildName(name, editor.Panel, source, ILPointLight.DefaultPointLightTag), label) { this.source = source; }