private void OnSelected(object sender, EventArgs e)
        {
            if (used_mouse)
            {
                OpType = this.cbDepartment.SelectedIndex + 1;
                PropertySet.cutlistData.OpType = OpType;

                if (Properties.Settings.Default.Testing)
                {
                    SwProperty oldprop = PropertySet.GetProperty("DEPARTMENT");
                    PropertySet.GetProperty("DEPARTMENT").Value    = cbDepartment.SelectedText;
                    PropertySet.GetProperty("DEPARTMENT").ResValue = cbDepartment.SelectedText;
                }

                int idx = this.OpType - 1; // Don't sort the table, and this works well.
                cbDepartment.SelectedIndex = idx;
                cbDepartment.DisplayMember = "TYPEDESC";
                if (idx != starting_index)
                {
                    PropertySet.ResetOps();
                }

                used_mouse = false;
            }
        }
Exemplo n.º 2
0
        public void ReadControls()
        {
            DataTable dt = (DataTable)this.listBox.DataSource;

            this._innerArray.Clear();
            int count = 1;

            foreach (System.Windows.Forms.DataGridViewRow dr in this.listBox.Rows)
            {
                if (dr.Cells[0].Value != null && dr.Cells[2].Value != null)
                {
                    SwProperty rev = new SwProperty("REVISION " + (char)(count + 64), swCustomInfoType_e.swCustomInfoText, dr.Cells[0].Value.ToString(), true);
                    SwProperty eco = new SwProperty("ECO " + count.ToString(), swCustomInfoType_e.swCustomInfoText, dr.Cells[1].Value.ToString(), true);
                    SwProperty des = new SwProperty("DESCRIPTION " + count.ToString(), swCustomInfoType_e.swCustomInfoText, dr.Cells[2].Value.ToString(), true);
                    SwProperty lis = new SwProperty("LIST " + count.ToString(), swCustomInfoType_e.swCustomInfoText, dr.Cells[3].Value.ToString(), true);
                    SwProperty dat = new SwProperty("DATE " + count.ToString(), swCustomInfoType_e.swCustomInfoDate, dr.Cells[4].Value.ToString(), true);

                    DrawingRev r = new DrawingRev(rev, eco, des, lis, dat);
                    r.Del(this.SwApp);

                    this._innerArray.Add(r);

                    count++;
                }
            }
        }
Exemplo n.º 3
0
        public void GetProperties()
        {
            for (int i = 0; i < 6; i++)
            {
                string op = string.Format("OP{0}", i.ToString());

                foreach (Control c in this.tableLayoutPanel1.Controls)
                {
                    if ((c is ComboBox) && c.Name.ToUpper().Contains(op))
                    {
                        ComboBox cb = (c as ComboBox);

                        propertySet.GetProperty(op).Ctl = c;

                        cb.ValueMember   = "OPID";
                        cb.DisplayMember = "OPDESCR";

                        cb.SelectedValue = int.Parse(propertySet.GetProperty(op).Value);

                        SwProperty p = this.propertySet.GetProperty(op);
                        p.ID       = (cb.SelectedItem as DataRowView).Row.ItemArray[0].ToString();
                        p.Value    = (cb.SelectedItem as DataRowView).Row.ItemArray[1].ToString();
                        p.ResValue = (cb.SelectedItem as DataRowView).Row.ItemArray[2].ToString();

                        p.Table = "CUT_PARTS";
                        p.Field = string.Format("OP{0}ID", c.Name.Split('p')[1]);
                    }
                }
            }
        }
Exemplo n.º 4
0
        private SwProperty AssignProperty(CustomPropertyManager pm, string name)
        {
            int    res;
            int    success   = (int)swCustomInfoGetResult_e.swCustomInfoGetResult_ResolvedValue;
            bool   useCached = false;
            string valOut    = string.Empty;
            string resValOut = string.Empty;
            bool   wasResolved;

            SwProperty rp = new SwProperty();

            rp.SwApp = this.SwApp;

            if (!InThere(pm, name))
            {
                return(rp);
            }
            else
            {
            }

            res = pm.Get5(name, useCached, out valOut, out resValOut, out wasResolved);

            if (res == success)
            {
                System.Diagnostics.Debug.WriteLine(string.Format("Found {0}.", name));
                rp.Name     = name;
                rp.Value    = valOut;
                rp.ResValue = resValOut;
                rp.Type     = swCustomInfoType_e.swCustomInfoText;
                rp.Global   = true;
            }
            return(rp);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Check for an existing hash. We basically want it to be fresh every time.
        /// This would be a good place to abuse the Redbrick, if you had a mind to.
        /// </summary>
        private void AddHash()
        {
            System.IO.FileInfo fi;
            try {
                if (!string.IsNullOrWhiteSpace(Document.GetPathName()))
                {
                    fi = new System.IO.FileInfo(Document.GetPathName());
                    prop.PartFileInfo = fi;

                    if (!prop.Contains("CRC32"))
                    {
                        prop.Hash = Redbrick.GetHash(string.Format("{0}\\{1}", prop.PartFileInfo.Directory.FullName, prop.PartFileInfo.Name));
                        SwProperty p = new SwProperty("CRC32", swCustomInfoType_e.swCustomInfoNumber, prop.Hash.ToString(), true);
                        p.Old = false;
                        prop.Add(p);
                    }
                    else
                    {
                    }
                }
                else
                {
                    //this.prop.PartName = "New Document"; // <-- stack overflow? weird
                }
            } catch (ArgumentException ae) {
                prop.PartName = ae.HResult.ToString();
            } catch (Exception e) {
                prop.PartName = e.HResult.ToString();
            }
        }
Exemplo n.º 6
0
        private void UpdateRes(SwProperty p, Control c)
        {
            double tp = 0.0f;

            if (double.TryParse(p.ResValue, out tp))
            {
                c.Text = string.Format("{0:0.000}", double.Parse(p.ResValue));
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// This never really worked the way I hoped.
        /// </summary>
        /// <param name="propName">Prop name</param>
        /// <param name="Configuration">Configuration</param>
        /// <param name="oldValue">unused</param>
        /// <param name="NewValue">New Value</param>
        /// <param name="valueType">Type of value</param>
        /// <returns>0</returns>
        int dd_ChangeCustomPropertyNotify(string propName, string Configuration, string oldValue, string NewValue, int valueType)
        {
            SwProperty p = prop.GetProperty(propName);

            p.Value = NewValue;
            p.Type  = (swCustomInfoType_e)valueType;
            //drb.DrbUpdate();
            return(0);
        }
Exemplo n.º 8
0
 public EditRev(ref DrawingRevs revs, int NodeCount, CutlistData cd, SwProperty rev)
 {
     System.Diagnostics.Debug.Print(NodeCount.ToString());
       nodeCount = NodeCount;
       cutlist_data = cd;
       revision = rev;
       _revs = revs;
       InitializeComponent();
       Init();
 }
Exemplo n.º 9
0
 public EditRev(ref DrawingRevs revs, int NodeCount, CutlistData cd, SwProperty rev)
 {
     System.Diagnostics.Debug.Print(NodeCount.ToString());
     nodeCount    = NodeCount;
     cutlist_data = cd;
     revision     = rev;
     _revs        = revs;
     InitializeComponent();
     Init();
 }
Exemplo n.º 10
0
 public bool Contains(SwProperty item)
 {
     foreach (SwProperty p in this._innerArray)
     {
         if (item.Name == p.Name)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 11
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            DrawingRev         r     = null;
            swCustomInfoType_e tType = swCustomInfoType_e.swCustomInfoText;
            SwProperty         rev   = new SwProperty("REVISION " + (char)(nodeCount + 65), tType, cbRev.Text, true);
            SwProperty         eco   = new SwProperty("ECO " + (nodeCount + 1).ToString(), tType, tbECO.Text, true);
            // I usually only apply this filter on insertion, but this field is only ever
            // displayed on drawings. We only want all caps for that as well.
            SwProperty desc = new SwProperty("DESCRIPTION " + (nodeCount + 1).ToString(), tType, CutlistData.FilterString(tbDesc.Text, Properties.Settings.Default.FlameWar), true);

            cbBy.ValueMember = "INITIAL";

            SwProperty list;

            if (cbBy.SelectedValue != null)
            {
                list = new SwProperty("LIST " + (nodeCount + 1).ToString(), tType, (cbBy.SelectedValue as string).Substring(0, 2), true);
            }
            else
            {
                list = new SwProperty("LIST " + (nodeCount + 1).ToString(), tType, string.Empty, true);
            }

            SwProperty date = new SwProperty("DATE " + (nodeCount + 1).ToString(), tType, dtpDate.Value.ToShortDateString(), true);

            if (Revs.Contains("REVISION " + (char)(nodeCount + 65)))
            {
                r             = Revs.GetRev("REVISION " + (char)(nodeCount + 65));
                r.Revision    = rev;
                r.Eco         = eco;
                r.Description = desc;
                r.List        = list;
                r.Date        = date;
            }
            else
            {
                r = new DrawingRev(rev, eco, desc, list, date);
                Revs.Add(r);
            }

            r.SwApp = Revs.SwApp;

            if (new_rev)
            {
                try {
                    AddECRItem(r);
                } catch (Exception ex) {
                    r.SwApp.SendMsgToUser2(ex.Message, (int)swMessageBoxIcon_e.swMbStop, (int)swMessageBoxBtn_e.swMbOk);
                }
            }

            this.Close();
        }
Exemplo n.º 12
0
        public DrawingRev(SwProperty rev, SwProperty eco, SwProperty desc, SwProperty list, SwProperty date)
        {
            this.Revision = rev;
              this.Eco = eco;
              this.Description = desc;
              this.List = list;
              this.Date = date;

              this.Revision.SwApp = this.SwApp;
              this.Eco.SwApp = this.SwApp;
              this.Description.SwApp = this.SwApp;
              this.List.SwApp = this.SwApp;
              this.Date.SwApp = this.SwApp;
        }
Exemplo n.º 13
0
        public void LinkControls()
        {
            SwProperty newprop = PropertySet.GetProperty("DEPT");

            newprop.Type = SolidWorks.Interop.swconst.swCustomInfoType_e.swCustomInfoNumber;
            PropertySet.LinkControlToProperty("DEPT", true, cbDepartment);

            if (Properties.Settings.Default.Testing)
            {
                SwProperty oldprop = PropertySet.GetProperty("DEPTARTMENT");
                oldprop.Type = SolidWorks.Interop.swconst.swCustomInfoType_e.swCustomInfoText;
                PropertySet.LinkControlToProperty("DEPARTMENT", true, cbDepartment);
            }
        }
Exemplo n.º 14
0
        public DrawingRev(SwProperty rev, SwProperty eco, SwProperty desc, SwProperty list, SwProperty date)
        {
            this.Revision    = rev;
            this.Eco         = eco;
            this.Description = desc;
            this.List        = list;
            this.Date        = date;

            this.Revision.SwApp    = this.SwApp;
            this.Eco.SwApp         = this.SwApp;
            this.Description.SwApp = this.SwApp;
            this.List.SwApp        = this.SwApp;
            this.Date.SwApp        = this.SwApp;
        }
Exemplo n.º 15
0
        private void LinkControlToProperty(string property, Control c)
        {
            SwProperty p = this.propertySet.GetProperty(property);

            if (propertySet.Contains(p))
            {
                p.Ctl  = c;
                c.Text = p.Value;
            }
            else
            {
                SwProperty x = new SwProperty(property, swCustomInfoType_e.swCustomInfoText, string.Empty, true);
                x.Ctl = c;
            }
        }
Exemplo n.º 16
0
        public void Read()
        {
            ModelDoc2             md = (ModelDoc2)SwApp.ActiveDoc;
            CustomPropertyManager pm = md.Extension.get_CustomPropertyManager(string.Empty);

            int revLetterOffset = 64;
            int revLimit        = Properties.Settings.Default.RevLimit;

            for (int i = 1; i <= revLimit; i++)
            {
                string r  = "REVISION " + (char)(i + revLetterOffset);
                string e  = "ECO " + i.ToString();
                string de = "DESCRIPTION " + i.ToString();
                string l  = "LIST " + i.ToString();
                string da = "DATE " + i.ToString();
                //System.Diagnostics.Debug.Print(string.Format("{0}: {1}: {2}: {3}", r, e, de, l));

                SwProperty rp = this.AssignProperty(pm, r);
                if (rp.Value == "NULL" || rp.Value == string.Empty)
                {
                    break;
                }

                SwProperty ep  = this.AssignProperty(pm, e);
                SwProperty dep = this.AssignProperty(pm, de);
                SwProperty lp  = this.AssignProperty(pm, l);
                SwProperty dap = this.AssignProperty(pm, da);

                rp.SwApp  = this.SwApp;
                ep.SwApp  = this.SwApp;
                dep.SwApp = this.SwApp;
                lp.SwApp  = this.SwApp;
                dap.SwApp = this.SwApp;

                if ((rp.Value != "NULL"))
                {
                    DrawingRev dr = new DrawingRev(rp, ep, dep, lp, dap);
                    if (dr != null)
                    {
                        this._innerArray.Add(dr);
                    }
                }
                else
                {
                    break;
                }
            }
        }
Exemplo n.º 17
0
        private void LinkControlToProperty()
        {
            string pn = "DEPARTMENT";

            if (!Properties.Settings.Default.Testing)
            {
                pn = "DEPTID";
            }

            string dept;

            if (PropertySet.Contains(pn))
            {
                PropertySet.GetProperty(pn).Ctl = cbDepartment;
                dept = PropertySet.GetProperty(pn).Value;
                int tp = 1;

                if (int.TryParse(dept, out tp))
                {
                    OpType = tp;
                }
                else
                {
                    OpType = PropertySet.cutlistData.GetOpTypeIDByName(dept);
                }
                dept = tp.ToString();
            }
            else
            {
                SolidWorks.Interop.swconst.swCustomInfoType_e t = SolidWorks.Interop.swconst.swCustomInfoType_e.swCustomInfoNumber;
                SwProperty p = new SwProperty(pn, t, "1", true);
                p.SwApp = SwApp;
                p.Ctl   = cbDepartment;
                PropertySet.Add(p);
                OpType = 1;
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// Check for an existing hash. We basically want it to be fresh every time.
        /// This would be a good place to abuse the Redbrick, if you had a mind to.
        /// </summary>
        private void AddHash()
        {
            System.IO.FileInfo fi;
              try {
            if (!string.IsNullOrWhiteSpace(Document.GetPathName())) {
              fi = new System.IO.FileInfo(Document.GetPathName());
              prop.PartFileInfo = fi;

              if (!prop.Contains("CRC32")) {
            prop.Hash = Redbrick.GetHash(string.Format("{0}\\{1}", prop.PartFileInfo.Directory.FullName, prop.PartFileInfo.Name));
            SwProperty p = new SwProperty("CRC32", swCustomInfoType_e.swCustomInfoNumber, prop.Hash.ToString(), true);
            p.Old = false;
            prop.Add(p);
              } else {

              }
            } else {
              //this.prop.PartName = "New Document"; // <-- stack overflow? weird
            }
              } catch (ArgumentException ae) {
            prop.PartName = ae.HResult.ToString();
              } catch (Exception e) {
            prop.PartName = e.HResult.ToString();
              }
        }
Exemplo n.º 19
0
 private void LinkControlToProperty(string property, Control c)
 {
     SwProperty p = this.propertySet.GetProperty(property);
       if (propertySet.Contains(p)) {
     p.Ctl = c;
     c.Text = p.Value;
       } else {
     SwProperty x = new SwProperty(property, swCustomInfoType_e.swCustomInfoText, string.Empty, true);
     x.Ctl = c;
       }
 }
Exemplo n.º 20
0
        /// <summary>
        /// Select known data in fields, and link controls to properties. I think this should be refactored.
        /// </summary>
        private void FillBoxes()
        {
            SwProperty partNo = this.PropertySet.GetProperty("PartNo");
              SwProperty custo = this.PropertySet.GetProperty("CUSTOMER");
              SwProperty by = this.PropertySet.GetProperty("DrawnBy");
              SwProperty d = this.PropertySet.GetProperty("DATE");
              SwProperty rl = PropertySet.GetProperty("REVISION LEVEL");

              string name = (PropertySet.SwApp.ActiveDoc as ModelDoc2).GetTitle().Replace(@".SLDDRW", string.Empty).Split(' ')[0].Trim();

              if (partNo != null) {
            label4.Text = name;
            partNo.Ctl = tbItemNo;
              } else {
            partNo = new SwProperty("PartNo", swCustomInfoType_e.swCustomInfoText, "$PRP:\"SW-File Name\"", true);
            partNo.SwApp = SwApp;
            partNo.Ctl = tbItemNo;
            this.PropertySet.Add(partNo);
              }

              if (custo != null) {
            custo.Ctl = cbCustomer;
              } else {
            custo = new SwProperty("CUSTOMER", swCustomInfoType_e.swCustomInfoText, string.Empty, true);
            custo.SwApp = SwApp;
            custo.Ctl = cbCustomer;
            this.PropertySet.Add(custo);
              }

              if (by != null) {
            if (by.Value == string.Empty) {
              by.ID = PropertySet.CutlistData.GetCurrentAuthor().ToString();
              by.Value = PropertySet.CutlistData.GetCurrentAuthorInitial();
              by.ResValue = by.Value;
            }
            by.Ctl = this.cbAuthor;
              } else {
            by = new SwProperty("DrawnBy", swCustomInfoType_e.swCustomInfoText, string.Empty, true);
            by.SwApp = SwApp;
            by.Ctl = cbAuthor;
            this.PropertySet.Add(by);
              }

              if (d != null) {
            d.Ctl = this.dpDate;
              } else {
            d = new SwProperty("DATE", swCustomInfoType_e.swCustomInfoDate, string.Empty, true);
            d.SwApp = SwApp;
            d.Ctl = dpDate;
            this.PropertySet.Add(d);
              }

              if (rl != null) {
            rl.Ctl = cbRevision;
              } else {
            rl = new SwProperty("REVISION LEVEL", swCustomInfoType_e.swCustomInfoText, "100", true);
            rl.SwApp = SwApp;
            rl.Ctl = cbRevision;
            PropertySet.Add(rl);
              }

              for (int i = 1; i < 6; i++) {
            if (PropertySet.Contains("M" + i.ToString())) {
              foreach (Control c in tableLayoutPanel3.Controls) {
            if (c.Name.ToUpper().Contains("M" + i.ToString()))
              PropertySet.GetProperty("M" + i.ToString()).Ctl = c;

            if (c.Name.ToUpper().Contains("FINISH" + i.ToString()))
              this.PropertySet.GetProperty("FINISH " + i.ToString()).Ctl = c;
              }
            } else {
              foreach (Control c in tableLayoutPanel3.Controls) {
            if (c.Name.ToUpper().Contains("M" + i.ToString())) {
              SwProperty mx = new SwProperty("M" + i.ToString(), swCustomInfoType_e.swCustomInfoText, string.Empty, true);
              mx.SwApp = SwApp;
              mx.Ctl = c;
              PropertySet.Add(mx);
            }

            if (c.Name.ToUpper().Contains("FINISH" + i.ToString())) {
              SwProperty fx = new SwProperty("FINISH " + i.ToString(), swCustomInfoType_e.swCustomInfoText, string.Empty, true);
              fx.SwApp = SwApp;
              fx.Ctl = c;
              PropertySet.Add(fx);
            }
              }
            }
              }

              DataSet ds = PropertySet.CutlistData.GetCutlistData(name.Trim(),
            PropertySet.GetProperty("REVISION LEVEL").Value.Trim());
              int stat = 0;
              if (ds.Tables[0].Rows.Count > 0 && int.TryParse(ds.Tables[0].Rows[0][(int)CutlistData.CutlistDataFields.STATEID].ToString(), out stat)) {
            cbStatus.Enabled = true;
            cbStatus.SelectedValue = stat;
              } else {
            cbStatus.Enabled = false;
              }

              PropertySet.UpdateFields();
              tbItemNoRes.Text = PropertySet.GetProperty("PartNo").ResValue;
        }
Exemplo n.º 21
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            DrawingRev r = null;
              swCustomInfoType_e tType = swCustomInfoType_e.swCustomInfoText;
              SwProperty rev = new SwProperty("REVISION " + (char)(nodeCount + 65), tType, cbRev.Text, true);
              SwProperty eco = new SwProperty("ECO " + (nodeCount + 1).ToString(), tType, tbECO.Text, true);
              // I usually only apply this filter on insertion, but this field is only ever
              // displayed on drawings. We only want all caps for that as well.
              SwProperty desc = new SwProperty("DESCRIPTION " + (nodeCount + 1).ToString(), tType, CutlistData.FilterString(tbDesc.Text, Properties.Settings.Default.FlameWar), true);
              cbBy.ValueMember = "INITIAL";

              SwProperty list;
              if (cbBy.SelectedValue != null) {
            list = new SwProperty("LIST " + (nodeCount + 1).ToString(), tType, (cbBy.SelectedValue as string).Substring(0, 2), true);
              } else {
            list = new SwProperty("LIST " + (nodeCount + 1).ToString(), tType, string.Empty, true);
              }

              SwProperty date = new SwProperty("DATE " + (nodeCount + 1).ToString(), tType, dtpDate.Value.ToShortDateString(), true);

              if (Revs.Contains("REVISION " + (char)(nodeCount + 65))) {
            r = Revs.GetRev("REVISION " + (char)(nodeCount + 65));
            r.Revision = rev;
            r.Eco = eco;
            r.Description = desc;
            r.List = list;
            r.Date = date;
              } else {
            r = new DrawingRev(rev, eco, desc, list, date);
            Revs.Add(r);
              }

              r.SwApp = Revs.SwApp;

              if (new_rev) {
            try {
              AddECRItem(r);
            } catch (Exception ex) {
              r.SwApp.SendMsgToUser2(ex.Message, (int)swMessageBoxIcon_e.swMbStop, (int)swMessageBoxBtn_e.swMbOk);
            }
              }

              this.Close();
        }
Exemplo n.º 22
0
        /// <summary>
        /// Select known data in fields, and link controls to properties. I think this should be refactored.
        /// </summary>
        private void FillBoxes()
        {
            SwProperty partNo = this.PropertySet.GetProperty("PartNo");
            SwProperty custo  = this.PropertySet.GetProperty("CUSTOMER");
            SwProperty by     = this.PropertySet.GetProperty("DrawnBy");
            SwProperty d      = this.PropertySet.GetProperty("DATE");
            SwProperty rl     = PropertySet.GetProperty("REVISION LEVEL");

            fileTitle = (PropertySet.SwApp.ActiveDoc as ModelDoc2).GetTitle().Replace(@".SLDDRW", string.Empty);
            fileName  = fileTitle.Split(' ')[0].Trim();
            if (fileTitle.ToUpper().Contains(@" REV"))
            {
                fileRev = fileTitle.Split(new string[] { @" REV", @" " }, StringSplitOptions.RemoveEmptyEntries)[1].Trim();
            }
            else
            {
                if (rl != null)
                {
                    fileRev = rl.ResValue;
                }
                else
                {
                    fileRev = "100";
                }
            }

            if (partNo != null)
            {
                label4.Text = fileName;
                partNo.Ctl  = tbItemNo;
            }
            else
            {
                partNo       = new SwProperty("PartNo", swCustomInfoType_e.swCustomInfoText, "$PRP:\"SW-File Name\"", true);
                partNo.SwApp = SwApp;
                partNo.Ctl   = tbItemNo;
                this.PropertySet.Add(partNo);
            }

            if (custo != null)
            {
                custo.Ctl = cbCustomer;
            }
            else
            {
                custo       = new SwProperty("CUSTOMER", swCustomInfoType_e.swCustomInfoText, string.Empty, true);
                custo.SwApp = SwApp;
                custo.Ctl   = cbCustomer;
                this.PropertySet.Add(custo);
            }

            if (by != null)
            {
                if (by.Value == string.Empty)
                {
                    by.ID       = PropertySet.CutlistData.GetCurrentAuthor().ToString();
                    by.Value    = PropertySet.CutlistData.GetCurrentAuthorInitial();
                    by.ResValue = by.Value;
                }
                by.Ctl = this.cbAuthor;
            }
            else
            {
                by       = new SwProperty("DrawnBy", swCustomInfoType_e.swCustomInfoText, string.Empty, true);
                by.SwApp = SwApp;
                by.Ctl   = cbAuthor;
                this.PropertySet.Add(by);
            }

            if (d != null)
            {
                d.Ctl = this.dpDate;
            }
            else
            {
                d       = new SwProperty("DATE", swCustomInfoType_e.swCustomInfoDate, string.Empty, true);
                d.SwApp = SwApp;
                d.Ctl   = dpDate;
                this.PropertySet.Add(d);
            }

            if (rl != null)
            {
                rl.Ctl = cbRevision;
            }
            else
            {
                rl       = new SwProperty("REVISION LEVEL", swCustomInfoType_e.swCustomInfoText, "100", true);
                rl.SwApp = SwApp;
                rl.Ctl   = cbRevision;
                PropertySet.Add(rl);
            }

            for (int i = 1; i < 6; i++)
            {
                if (PropertySet.Contains("M" + i.ToString()))
                {
                    foreach (Control c in tableLayoutPanel3.Controls)
                    {
                        if (c.Name.ToUpper().Contains("M" + i.ToString()))
                        {
                            PropertySet.GetProperty("M" + i.ToString()).Ctl = c;
                        }


                        if (c.Name.ToUpper().Contains("FINISH" + i.ToString()))
                        {
                            this.PropertySet.GetProperty("FINISH " + i.ToString()).Ctl = c;
                        }
                    }
                }
                else
                {
                    foreach (Control c in tableLayoutPanel3.Controls)
                    {
                        if (c.Name.ToUpper().Contains("M" + i.ToString()))
                        {
                            SwProperty mx = new SwProperty("M" + i.ToString(), swCustomInfoType_e.swCustomInfoText, string.Empty, true);
                            mx.SwApp = SwApp;
                            mx.Ctl   = c;
                            PropertySet.Add(mx);
                        }

                        if (c.Name.ToUpper().Contains("FINISH" + i.ToString()))
                        {
                            SwProperty fx = new SwProperty("FINISH " + i.ToString(), swCustomInfoType_e.swCustomInfoText, string.Empty, true);
                            fx.SwApp = SwApp;
                            fx.Ctl   = c;
                            PropertySet.Add(fx);
                        }
                    }
                }
            }

            DataSet ds = PropertySet.CutlistData.GetCutlistData(fileName.Trim(),
                                                                PropertySet.GetProperty("REVISION LEVEL").Value.Trim());
            int stat = 0;

            if (ds.Tables[0].Rows.Count > 0 && int.TryParse(ds.Tables[0].Rows[0][(int)CutlistData.CutlistDataFields.STATEID].ToString(), out stat))
            {
                cbStatus.Enabled       = true;
                cbStatus.SelectedValue = stat;
            }
            else
            {
                cbStatus.Enabled = false;
            }

            PropertySet.UpdateFields();
            tbItemNoRes.Text = PropertySet.GetProperty("PartNo").ResValue;
        }
Exemplo n.º 23
0
 private void UpdateRes(SwProperty p, Control c)
 {
     double tp = 0.0f;
       if (double.TryParse(p.ResValue, out tp)) {
     c.Text = string.Format("{0:0.000}", double.Parse(p.ResValue));
       }
 }