public void Initialize() { var el = ConfigManager.Read<DrawingElement> (("Element" + System.IO.Path.DirectorySeparatorChar + "sample.xml").GetAbsolutePath()); el.SetupContainer (); Surface = new PrimitivesSurface () { IsPalette = true }; Surface.Add (el, new Position{ X = 0, Y = 0 }); }
void InitArduino() { _arduino.Clear(); var elementNames = Directory.GetFiles((@"Buttons" + Path.DirectorySeparatorChar).GetAbsolutePath()); foreach (var el in elementNames .Select(name => !string.IsNullOrEmpty(name) ? ConfigManager.Read <DrawingElement> (name) : new DrawingElement { Type = ElementType.None, Primitives = new List <Drawable>() })) { el.SetupContainer(); var surface = new PrimitivesSurface() { IsButton = true }; surface.Add(el, new Position { X = 0, Y = 0 }); surface.Tooltip = el.Tooltip; _arduino.Add(surface); } }
void InitPalette() { _palette.Clear(); /* * var elementNames = new [] { * "NcContact.xml", * "NoContact.xml", * "Coil.xml", * "NotCoil.xml", * "OnTimer.xml", * "OffTimer.xml", * "CycleTimer.xml", * "SetCoil.xml", * "ResetCoil.xml", * "Line.xml", * "Properties.xml", * "Cursor.xml", * "Latch.xml"}; */ var elementNames = Directory.GetFiles((@"Element" + Path.DirectorySeparatorChar).GetAbsolutePath()); foreach (var el in elementNames .Select(name => !string.IsNullOrEmpty(name) ? ConfigManager.Read <DrawingElement> (name) : new DrawingElement { Type = ElementType.None, Primitives = new List <Drawable>() })) { el.SetupContainer(); var surface = new PrimitivesSurface() { IsPalette = true }; if (el.Type == ElementType.Latch) { surface.Add(new Position { X = 0, Y = 0 }); surface.Add(new Position { X = 0, Y = 1 }); surface.Add(el, new Position { X = 0, Y = 0 }); } else { surface.Add(el, new Position { X = 0, Y = 0 }); } surface.Tooltip = el.Tooltip; _palette.Add(surface); } }
public Proection (PrimitivesSurface surface) { _surface = surface; CalculateSurfaceAxis (); CreateGridLines (); if (!surface.IsPalette && !surface.IsButton) { CreatePowerLines (); CreateAxisLabels (); } }
public Proection(PrimitivesSurface surface) { _surface = surface; CalculateSurfaceAxis(); CreateGridLines(); if (!surface.IsPalette && !surface.IsButton) { CreatePowerLines(); CreateAxisLabels(); } }
public ElementDrawing(PrimitivesSurface surface, uint hMargin, uint vMargin) { Surface = surface; _hMargin = hMargin; _vMargin = vMargin; TooltipText = surface.Tooltip; AddEvents((int)EventMask.ButtonPressMask); ButtonPressEvent += OnMouseClick; }
public ElementDrawing (PrimitivesSurface surface, uint hMargin, uint vMargin) { Surface = surface; _hMargin = hMargin; _vMargin = vMargin; TooltipText = surface.Tooltip; AddEvents ((int)EventMask.ButtonPressMask); ButtonPressEvent += OnMouseClick; }
public void ReloadSurface(PrimitivesSurface saved) { foreach (var seg in Surface.Segments) { var savedSeg = saved.Segments.FirstOrDefault(s => s.Position == seg.Position); if (savedSeg == null || seg.Join.Any()) { continue; } if (savedSeg.Type != ElementType.None) { var el = _palette.First(s => s.Get() .First().Type == savedSeg.Type) .Get() .First() .Primitives .First(p => p.Container != null) .Container; var restored = Surface.Add((DrawingElement)el.Clone(), seg.Position) .ConnectPower() .ConnectSiblings(); } else { seg.Connectors.AddRange(savedSeg.Connectors); } } foreach (var line in saved.PowerLines) { Surface.AddPowerLine(line); } foreach (var seg in Surface.Segments) { var savedSeg = saved.Segments.FirstOrDefault(s => s.Type != ElementType.None && s.Position == seg.Position); if (savedSeg == null) { continue; } seg.Variables.AddRange(savedSeg.Variables); seg.OverrideFunction = savedSeg.OverrideFunction; seg.Function = savedSeg.Function; seg.FunctionText = seg.Type.GetRuleForElement() .GetFormatted(seg); seg.ConnectPower().ConnectSiblings(); } }
public void Initialize() { var el = ConfigManager.Read <DrawingElement> (("Element" + System.IO.Path.DirectorySeparatorChar + "sample.xml").GetAbsolutePath()); el.SetupContainer(); Surface = new PrimitivesSurface() { IsPalette = true }; Surface.Add(el, new Position { X = 0, Y = 0 }); }
public void InitSurface() { Surface = new PrimitivesSurface(); _contactsCount = _instance.Config.ContactsCount; _rowsCount = _instance.Config.RowsCount; for (uint j = 0; j < _rowsCount; j++) { for (uint i = 0; i < _contactsCount + 1; i++) { Surface.Add(new Position { X = i, Y = j }); } } }
void InitPalette() { _palette.Clear(); var elementNames = Directory.GetFiles((@"Element" + Path.DirectorySeparatorChar).GetAbsolutePath()); foreach (var el in elementNames .Select(name => !string.IsNullOrEmpty(name) ? ConfigManager.Read <DrawingElement> (name) : new DrawingElement { Type = ElementType.None, Primitives = new List <Drawable>() })) { el.SetupContainer(); var surface = new PrimitivesSurface() { IsPalette = true }; if (el.Type == ElementType.Latch) { surface.Add(new Position { X = 0, Y = 0 }); surface.Add(new Position { X = 0, Y = 1 }); surface.Add(el, new Position { X = 0, Y = 0 }); } else { surface.Add(el, new Position { X = 0, Y = 0 }); } surface.Tooltip = el.Tooltip; _palette.Add(surface); } }
public void ReloadSurface (PrimitivesSurface saved) { foreach (var seg in Surface.Segments) { var savedSeg = saved.Segments.FirstOrDefault (s => s.Position == seg.Position); if (savedSeg == null || seg.Join.Any()) { continue; } if (savedSeg.Type != ElementType.None) { var el = _palette.First (s => s.Get () .First ().Type == savedSeg.Type) .Get () .First () .Primitives .First (p => p.Container != null) .Container; var restored = Surface.Add ((DrawingElement)el.Clone (), seg.Position) .ConnectPower () .ConnectSiblings (); } else { seg.Connectors.AddRange (savedSeg.Connectors); } } foreach (var line in saved.PowerLines) { Surface.AddPowerLine (line); } foreach (var seg in Surface.Segments) { var savedSeg = saved.Segments.FirstOrDefault (s => s.Type != ElementType.None && s.Position == seg.Position); if (savedSeg == null) { continue; } seg.Variables.AddRange(savedSeg.Variables); seg.OverrideFunction = savedSeg.OverrideFunction; seg.Function = savedSeg.Function; seg.FunctionText =seg.Type.GetRuleForElement() .GetFormatted(seg); seg.ConnectPower ().ConnectSiblings (); } }
public void InitSurface () { Surface = new PrimitivesSurface (); _contactsCount = _instance.Config.ContactsCount; _rowsCount = _instance.Config.RowsCount; for (uint j = 0; j < _rowsCount; j++) { for (uint i = 0; i < _contactsCount + 1; i++) { Surface.Add (new Position{ X = i, Y = j }); } } }
void InitArduino() { _arduino.Clear (); var elementNames = Directory.GetFiles ((@"Buttons"+ Path.DirectorySeparatorChar).GetAbsolutePath ()); foreach (var el in elementNames .Select(name => !string.IsNullOrEmpty(name) ? ConfigManager.Read<DrawingElement> (name) : new DrawingElement{ Type = ElementType.None, Primitives = new List<Drawable>()})) { el.SetupContainer (); var surface = new PrimitivesSurface () { IsButton = true}; surface.Add (el, new Position{ X = 0, Y = 0 }); surface.Tooltip = el.Tooltip; _arduino.Add (surface); } }
void InitPalette() { _palette.Clear (); var elementNames = Directory.GetFiles ((@"Element"+ Path.DirectorySeparatorChar).GetAbsolutePath ()); foreach (var el in elementNames .Select(name => !string.IsNullOrEmpty(name) ? ConfigManager.Read<DrawingElement> (name) : new DrawingElement{ Type = ElementType.None, Primitives = new List<Drawable>()})) { el.SetupContainer (); var surface = new PrimitivesSurface () {IsPalette = true}; if (el.Type == ElementType.Latch) { surface.Add (new Position{ X = 0, Y = 0 }); surface.Add (new Position{ X = 0, Y = 1 }); surface.Add (el, new Position{ X = 0, Y = 0 }); } else { surface.Add (el, new Position{ X = 0, Y = 0 }); } surface.Tooltip = el.Tooltip; _palette.Add (surface); } }