示例#1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string userFolder     = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "RebarPos");
            string userStylesFile = System.IO.Path.Combine(userFolder, "TableStyles.txt");
            string newStylesFile  = System.IO.Path.Combine(userFolder, "TableStyles.new");

            BOQStyle.ClearBOQStyles();
            foreach (TableStyleCopy copy in m_Copies)
            {
                if (!copy.IsBuiltin)
                {
                    BOQStyle style = new BOQStyle();

                    style.Name = copy.Name;

                    style.Columns = copy.Columns;

                    style.PosLabel          = copy.PosColumn;
                    style.CountLabel        = copy.CountColumn;
                    style.DiameterLabel     = copy.DiameterColumn;
                    style.LengthLabel       = copy.LengthColumn;
                    style.ShapeLabel        = copy.ShapeColumn;
                    style.TotalLengthLabel  = copy.TotalLengthColumn;
                    style.DiameterListLabel = copy.DiameterListColumn;

                    style.DiameterLengthLabel = copy.TotalLengthRow;
                    style.UnitWeightLabel     = copy.UnitWeightRow;
                    style.WeightLabel         = copy.WeightRow;
                    style.GrossWeightLabel    = copy.GrossWeightRow;

                    style.MultiplierHeadingLabel = copy.MultiplierHeadingLabel;

                    style.TextStyleId    = copy.TextStyleId;
                    style.HeadingStyleId = copy.HeadingStyleId;
                    style.FootingStyleId = copy.FootingStyleId;

                    BOQStyle.AddBOQStyle(style);
                }
            }

            try
            {
                BOQStyle.SaveBOQStylesToFile(newStylesFile);
                System.IO.File.Delete(userStylesFile);
                System.IO.File.Move(newStylesFile, userStylesFile);
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Error: " + ex.Message, "RebarPos", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }

            BOQStyle.ReadBOQStylesFromFile(userStylesFile);

            Close();
        }
示例#2
0
        public void ReadUserTableStyles()
        {
            string userFolder     = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "RebarPos");
            string userStylesFile = System.IO.Path.Combine(userFolder, "TableStyles.txt");

            try
            {
                if (System.IO.File.Exists(userStylesFile))
                {
                    BOQStyle.ClearBOQStyles();
                    BOQStyle.ReadBOQStylesFromFile(userStylesFile);
                }
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Error: " + ex.Message, "RebarPos", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
        }