public bool Save(String filename)
        {
            try
            {
                XmlWriter xw = XmlWriter.Create(filename);
                xw.WriteStartElement("SliceBuildConfig");
                xw.WriteElementString("DotsPermmX", dpmmX.ToString());
                xw.WriteElementString("DotsPermmY", dpmmY.ToString());
                xw.WriteElementString("XResolution", xres.ToString());
                xw.WriteElementString("YResolution", yres.ToString());
                xw.WriteElementString("SliceHeight", ZThick.ToString());
                xw.WriteElementString("LayerTime", layertime_ms.ToString());
                xw.WriteElementString("FirstLayerTime", firstlayertime_ms.ToString());
                xw.WriteElementString("BlankTime", blanktime_ms.ToString());
                xw.WriteElementString("PlatformTemp", plat_temp.ToString());
                xw.WriteElementString("ExportGCode", exportgcode.ToString());
                xw.WriteElementString("ExportSVG", exportsvg.ToString());
                xw.WriteElementString("ExportImages", exportimages.ToString());
                xw.WriteElementString("XOffset", XOffset.ToString());
                xw.WriteElementString("YOffset", YOffset.ToString());
                xw.WriteElementString("Direction", direction.ToString());
                xw.WriteElementString("LiftDistance", liftdistance.ToString());

                xw.WriteEndElement();
                xw.Close();
                return(true);
            }
            catch (Exception ex)
            {
                DebugLogger.Instance().LogRecord(ex.Message);
                return(false);
            }
        }
Beispiel #2
0
        protected internal virtual void RecalculateSelf()
        {
            float baseX;
            float baseY;
            float baseWidth;
            float baseHeight;

            if (Parent == null)
            {
                baseX      = 0;
                baseY      = 0;
                baseWidth  = Main.screenWidth;
                baseHeight = Main.screenHeight;
            }
            else
            {
                baseX      = Parent.InnerX;
                baseY      = Parent.InnerY;
                baseWidth  = Parent.InnerWidth;
                baseHeight = Parent.InnerHeight;
            }
            InnerWidth        = Width.CalculateValue(baseWidth);
            InnerHeight       = Height.CalculateValue(baseHeight);
            PadWidth          = InnerWidth + Padding.Left + Padding.Right;
            PadHeight         = InnerHeight + Padding.Top + Padding.Bottom;
            OuterWidth        = PadWidth + Margin.Left + Margin.Right;
            OuterHeight       = PadHeight + Margin.Top + Margin.Bottom;
            CalculatedXOffset = XOffset.CalculateValue(baseWidth);
            OuterX            = baseX + CalculatedXOffset;
            if (HorizontalAlign != 0f)
            {
                OuterX += (baseWidth - OuterWidth) * HorizontalAlign;
            }
            CalculatedYOffset = YOffset.CalculateValue(baseHeight);
            OuterY            = baseY + CalculatedYOffset;
            if (VerticalAlign != 0f)
            {
                OuterY += (baseHeight - OuterHeight) * VerticalAlign;
            }
            if (Parent is UIContainer container)
            {
                OuterY -= container.ScrollValue;
            }
            PadX   = OuterX + Margin.Left;
            PadY   = OuterY + Margin.Top;
            InnerX = PadX + Padding.Left;
            InnerY = PadY + Padding.Top;
        }
Beispiel #3
0
        public override int GetHashCode()
        {
            var hashCode = 108845050;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Name);

            hashCode = hashCode * -1521134295 + XOffset.GetHashCode();
            hashCode = hashCode * -1521134295 + YOffset.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <Color> .Default.GetHashCode(BorderColor);

            hashCode = hashCode * -1521134295 + EqualityComparer <Color> .Default.GetHashCode(FrontColor);

            hashCode = hashCode * -1521134295 + EqualityComparer <HitBoxType> .Default.GetHashCode(Type);

            hashCode = hashCode * -1521134295 + ActionName.GetHashCode();
            return(hashCode);
        }
        public bool Save(String filename)
        {
            try
            {
                m_filename = filename;
                XmlWriter xw = XmlWriter.Create(filename);
                xw.WriteStartElement("SliceBuildConfig");
                xw.WriteElementString("FileVersion", FILE_VERSION.ToString());
                xw.WriteElementString("DotsPermmX", dpmmX.ToString());
                xw.WriteElementString("DotsPermmY", dpmmY.ToString());
                xw.WriteElementString("XResolution", xres.ToString());
                xw.WriteElementString("YResolution", yres.ToString());
                xw.WriteElementString("SliceHeight", ZThick.ToString());
                xw.WriteElementString("LayerTime", layertime_ms.ToString());
                xw.WriteElementString("FirstLayerTime", firstlayertime_ms.ToString());
                xw.WriteElementString("BlankTime", blanktime_ms.ToString());
                xw.WriteElementString("PlatformTemp", plat_temp.ToString());
                xw.WriteElementString("ExportGCode", exportgcode.ToString());
                xw.WriteElementString("ExportSVG", exportsvg.ToString());
                xw.WriteElementString("ExportImages", exportimages.ToString());
                xw.WriteElementString("XOffset", XOffset.ToString());
                xw.WriteElementString("YOffset", YOffset.ToString());
                xw.WriteElementString("NumberofBottomLayers", numfirstlayers.ToString());
                xw.WriteElementString("Direction", direction.ToString());
                xw.WriteElementString("LiftDistance", liftdistance.ToString());
                xw.WriteElementString("SlideTiltValue", slidetiltval.ToString());
                xw.WriteElementString("AntiAliasing", antialiasing.ToString());
                xw.WriteElementString("AutoCalcDelay", autocalcdelay.ToString());
                xw.WriteElementString("UseMainLiftGCode", usemainliftgcode.ToString());
                xw.WriteElementString("AntiAliasingValue", aaval.ToString());
                xw.WriteElementString("LiftFeedRate", liftfeedrate.ToString());
                xw.WriteElementString("LiftRetractRate", liftretractrate.ToString());

                // xw.WriteElementString("Raise_Time_Delay",raise_time_ms.ToString());
                xw.WriteEndElement();
                xw.Close();
                SaveGCodes();
                return(true);
            }
            catch (Exception ex)
            {
                DebugLogger.Instance().LogRecord(ex.Message);
                return(false);
            }
        }
Beispiel #5
0
 public override string ToString()
 {
     return($"{{{nameof(Offset)}={Offset.ToString("X")}, {nameof(XOffset)}={XOffset.ToString("X")}, {nameof(YOffset)}={YOffset.ToString("X")}, {nameof(ZOffset)}={ZOffset.ToString("X")}, {nameof(XStretch)}={XStretch.ToString("X")}, {nameof(YStretch)}={YStretch.ToString("X")}, {nameof(ZStretch)}={ZStretch.ToString("X")}, {nameof(Radius)}={Radius.ToString("X")}, {nameof(Data)}={Data.ToString("X")}, {nameof(Bone)}={Bone.ToString("X")}, {nameof(Enabled)}={Enabled.ToString("X")}, {nameof(Zone)}={Zone.ToString("X")}, {nameof(Region)}={Region.ToString("X")}}}");
 }
        public override Task Rebuild()
        {
            this.DebugDepth("Rebuild");

            using (RebuildLock())
            {
                ResetPositions();

                this.Children.Modify(list =>
                {
                    if (list.Count == 0)
                    {
                        return;
                    }

                    var anchorBounds = AnchorBounds;
                    var children     = list.Where(c => c.GetType() != typeof(OperationSourceObject3D) &&
                                                  c.ID != SelectedChild.FirstOrDefault());

                    // align all the objects to the anchor
                    foreach (var child in children)
                    {
                        AlignAxis(0, XAlign, GetAlignToOffset(anchorBounds, 0, (!Advanced || XAlignTo == Align.None) ? XAlign : XAlignTo), XOffset.Value(this), child);
                        AlignAxis(1, YAlign, GetAlignToOffset(anchorBounds, 1, (!Advanced || YAlignTo == Align.None) ? YAlign : YAlignTo), YOffset.Value(this), child);
                        AlignAxis(2, ZAlign, GetAlignToOffset(anchorBounds, 2, (!Advanced || ZAlignTo == Align.None) ? ZAlign : ZAlignTo), ZOffset.Value(this), child);
                    }
                });
            }

            Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Matrix));
            return(Task.CompletedTask);
        }
Beispiel #7
0
 public override string ToString()
 {
     return(string.Format("(OffX = {0}, OffY = {1},Heading = {2}, Oid = {3}, Name= {4})", XOffset.ToString(), YOffset.ToString(), Heading.ToString(), Oid.ToString(), Name) + base.ToString());
 }