예제 #1
0
        public void SetTable()
        {
            ClearItems();

            if (mTable != null)
            {
                mTable.Dispose();
            }

            mTable = new BOQTable();
            mTable.SuspendUpdate();

            string shape = "GENEL";

            if (PosShape.HasPosShape("00"))
            {
                shape = "00";
            }
            mTable.Items.Add(1, 6, 14, 240, shape, "240", "", "", "", "", "");
            if (PosShape.HasPosShape("11"))
            {
                shape = "11";
            }
            mTable.Items.Add(1, 12, 16, 320, shape, "200", "120", "", "", "", "");

            mTable.Multiplier = 2;
            mTable.Precision  = 2;
            mTable.ColumnDef  = Columns;

            mTable.PosLabel               = PosLabel;
            mTable.CountLabel             = CountLabel;
            mTable.DiameterLabel          = DiameterLabel;
            mTable.LengthLabel            = LengthLabel;
            mTable.ShapeLabel             = ShapeLabel;
            mTable.TotalLengthLabel       = TotalLengthLabel;
            mTable.DiameterListLabel      = DiameterListLabel;
            mTable.DiameterLengthLabel    = DiameterLengthLabel;
            mTable.UnitWeightLabel        = UnitWeightLabel;
            mTable.WeightLabel            = WeightLabel;
            mTable.GrossWeightLabel       = GrossWeightLabel;
            mTable.MultiplierHeadingLabel = MultiplierHeadingLabel;

            mTable.TextStyleId    = TextStyleId;
            mTable.HeadingStyleId = HeadingStyleId;
            mTable.FootingStyleId = FootingStyleId;

            mTable.ResumeUpdate();

            AddItem(mTable);
        }
예제 #2
0
        private void ApplyChanges()
        {
            string userFolder     = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "RebarPos");
            string userShapesFile = System.IO.Path.Combine(userFolder, "ShapeList.txt");
            string newShapesFile  = System.IO.Path.Combine(userFolder, "ShapeList.new");

            foreach (PosShape copy in m_Copies)
            {
                if (!copy.IsBuiltIn)
                {
                    if (PosShape.HasPosShape(copy.Name))
                    {
                        PosShape org = PosShape.GetPosShape(copy.Name);
                        org.Fields         = copy.Fields;
                        org.Formula        = copy.Formula;
                        org.FormulaBending = copy.FormulaBending;
                        org.Priority       = copy.Priority;
                        org.Items.Clear();
                        for (int i = 0; i < copy.Items.Count; i++)
                        {
                            org.Items.Add(copy.Items[i].Clone());
                        }
                    }
                    else
                    {
                        PosShape.AddPosShape(copy);
                    }
                }
            }

            try
            {
                PosShape.SavePosShapesToFile(newShapesFile);
                System.IO.File.Delete(userShapesFile);
                System.IO.File.Move(newShapesFile, userShapesFile);
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Error: " + ex.Message, "RebarPos", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }

            PosShape.ReadPosShapesFromFile(userShapesFile);
        }