コード例 #1
0
        /// <summary>
        /// As yet unused warning.
        /// </summary>
        private void AskWrite()
        {
            string q = "Write unwritten properties?";
            swMessageBoxResult_e r = (swMessageBoxResult_e)SwApp.SendMsgToUser2(q,
                                                                                (int)swMessageBoxIcon_e.swMbQuestion, (int)swMessageBoxBtn_e.swMbYesNo);

            switch (r)
            {
            case swMessageBoxResult_e.swMbHitAbort:
                break;

            case swMessageBoxResult_e.swMbHitCancel:
                break;

            case swMessageBoxResult_e.swMbHitIgnore:
                break;

            case swMessageBoxResult_e.swMbHitNo:
                break;

            case swMessageBoxResult_e.swMbHitOk:
                break;

            case swMessageBoxResult_e.swMbHitRetry:
                break;

            case swMessageBoxResult_e.swMbHitYes:
                Write();
                break;

            default:
                break;
            }
        }
コード例 #2
0
        /// <summary>
        /// Pop up the CutlistHeaderInfo form.
        /// </summary>
        private void AddToCutlist()
        {
            string question          = string.Format(Properties.Resources.AddToExistingCutlist, propertySet.PartName);
            swMessageBoxResult_e res = (swMessageBoxResult_e)propertySet.SwApp.SendMsgToUser2(question,
                                                                                              (int)swMessageBoxIcon_e.swMbQuestion,
                                                                                              (int)swMessageBoxBtn_e.swMbYesNoCancel);

            switch (res)
            {
            case swMessageBoxResult_e.swMbHitAbort:
                break;

            case swMessageBoxResult_e.swMbHitCancel:
                break;

            case swMessageBoxResult_e.swMbHitIgnore:
                break;

            case swMessageBoxResult_e.swMbHitNo:
                CutlistHeaderInfo chin = new CutlistHeaderInfo(CutlistData.MakePartFromPropertySet(propertySet, Convert.ToUInt16(nudQ.Value)),
                                                               propertySet.cutlistData, CutlistHeaderInfo.CutlistFunction.CreateNew);
                chin.Text = "Creating new cutlist...";
                chin.ShowDialog();
                break;

            case swMessageBoxResult_e.swMbHitOk:
                break;

            case swMessageBoxResult_e.swMbHitRetry:
                break;

            case swMessageBoxResult_e.swMbHitYes:
                CutlistHeaderInfo chiy = new CutlistHeaderInfo(CutlistData.MakePartFromPropertySet(propertySet, Convert.ToUInt16(nudQ.Value)),
                                                               propertySet.cutlistData, CutlistHeaderInfo.CutlistFunction.AddToExistingNotSelected);
                chiy.Text = "Adding to cutlist...";
                chiy.ShowDialog();
                break;

            default:
                break;
            }
        }
コード例 #3
0
ファイル: Redbrick.cs プロジェクト: kcjuntunen/Redbrick-Addin
        /// <summary>
        /// Ask user if update is wanted.
        /// </summary>
        public void Update()
        {
            string chge = string.Format(Properties.Resources.Update, currentVersion.ToString(), publicVersion.Key.ToString());
            swMessageBoxResult_e res = (swMessageBoxResult_e)swApp.SendMsgToUser2(
                string.Format("{0}\n\nCHANGE: {1}", chge, UpdateMessage),
                (int)swMessageBoxIcon_e.swMbQuestion,
                (int)swMessageBoxBtn_e.swMbYesNo);

            switch (res)
            {
            case swMessageBoxResult_e.swMbHitAbort:
                break;

            case swMessageBoxResult_e.swMbHitCancel:
                break;

            case swMessageBoxResult_e.swMbHitIgnore:
                break;

            case swMessageBoxResult_e.swMbHitNo:
                break;

            case swMessageBoxResult_e.swMbHitOk:
                break;

            case swMessageBoxResult_e.swMbHitRetry:
                break;

            case swMessageBoxResult_e.swMbHitYes:
                //swApp.DestroyNotify += swApp_DestroyNotify;
                swApp_DestroyNotify();
                //swApp.SendMsgToUser2(Properties.Resources.Restart,
                //  (int)swMessageBoxIcon_e.swMbWarning,
                //  (int)swMessageBoxBtn_e.swMbOk);
                break;

            default:
                break;
            }
        }
コード例 #4
0
        /// <summary>
        /// Delete a LVL, and all sub LVLs.
        /// </summary>
        /// <param name="sender">Where'd the click come from?</param>
        /// <param name="e">Args?</param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            string prtno = tbItemNoRes.Text;
            string revno = cbRevision.Text;

            string question = string.Format("Really delete {0} REV {1}",
                                            prtno,
                                            revno);

            swMessageBoxResult_e mebore = (swMessageBoxResult_e)SwApp.SendMsgToUser2(question,
                                                                                     (int)swMessageBoxIcon_e.swMbQuestion,
                                                                                     (int)swMessageBoxBtn_e.swMbYesNo);

            if (mebore == swMessageBoxResult_e.swMbHitYes)
            {
                PropertySet.CutlistData.DeleteCutlist(prtno, revno);

                if (Properties.Settings.Default.MakeSounds)
                {
                    System.Media.SystemSounds.Beep.Play();
                }
            }
        }
コード例 #5
0
ファイル: PDFArchiver.cs プロジェクト: 15831944/ArchivePDF
        private void InsertIntoDb(string fileName, string table)
        {
            FileInfo fi      = new FileInfo(fileName);
            string   oldPath = ExistingPath(fi.FullName, table);
            string   newPath = fi.DirectoryName
                               .Replace(Properties.Settings.Default.KPath, Properties.Settings.Default.KMapped)
                               .Replace(Properties.Settings.Default.MetalPath, Properties.Settings.Default.SMapped) + @"\";

            if (oldPath != string.Empty && oldPath != newPath)
            {
                string message = string.Format("Original path was '{0}'\n\nUpdate to '{1}\\'?", oldPath, fi.DirectoryName
                                               .Replace(Properties.Settings.Default.KPath, Properties.Settings.Default.KMapped)
                                               .Replace(Properties.Settings.Default.MetalPath, Properties.Settings.Default.SMapped));
                swMessageBoxResult_e mbRes = (swMessageBoxResult_e)swApp.SendMsgToUser2(message, (int)swMessageBoxIcon_e.swMbQuestion, (int)swMessageBoxBtn_e.swMbOkCancel);
                if (mbRes == swMessageBoxResult_e.swMbHitOk)
                {
                    DoInsert(fileName, table);
                }
            }
            else
            {
                DoInsert(fileName, table);
            }
        }
コード例 #6
0
        /// <summary>
        /// Save if unsaved, and add Cutlist to DB.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnMakeOriginal_Click(object sender, EventArgs e)
        {
            int hash = propertySet.cutlistData.GetHash(propertySet.PartName);

            if (propertySet.modeldoc.GetPathName() == string.Empty)
            {
                propertySet.modeldoc.Extension.RunCommand(
                    (int)SolidWorks.Interop.swcommands.swCommands_e.swCommands_SaveAs,
                    propertySet.modeldoc.GetTitle());
                if (propertySet.modeldoc.GetPathName() == string.Empty)
                {
                    throw new Exception("Unsaved models cannot be added to a cutlist.");
                }
            }

            if (hash != propertySet.Hash)
            {
                if (hash != 0)
                {
                    string question = string.Format(Properties.Resources.AlreadyInOtherLocation, propertySet.PartName);

                    swMessageBoxResult_e res = (swMessageBoxResult_e)propertySet.SwApp.SendMsgToUser2(question,
                                                                                                      (int)swMessageBoxIcon_e.swMbQuestion,
                                                                                                      (int)swMessageBoxBtn_e.swMbYesNo);
                    switch (res)
                    {
                    case swMessageBoxResult_e.swMbHitAbort:
                        break;

                    case swMessageBoxResult_e.swMbHitCancel:
                        break;

                    case swMessageBoxResult_e.swMbHitIgnore:
                        break;

                    case swMessageBoxResult_e.swMbHitNo:
                        break;

                    case swMessageBoxResult_e.swMbHitOk:
                        break;

                    case swMessageBoxResult_e.swMbHitRetry:
                        break;

                    case swMessageBoxResult_e.swMbHitYes:
                        propertySet.cutlistData.MakeOriginal(propertySet);
                        AddToCutlist();
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    AddToCutlist();
                }
            }
            else
            {
                AddToCutlist();
            }
            Updte();
        }
コード例 #7
0
ファイル: EditRev.cs プロジェクト: kcjuntunen/Redbrick-Addin
        private void AddECRItem(DrawingRev r)
        {
            ModelDoc2 md           = (ModelDoc2)r.SwApp.ActiveDoc;
            string    partpath     = md.GetPathName();
            string    partfilename = System.IO.Path.GetFileNameWithoutExtension(partpath);

            if (md.GetPathName() == string.Empty)
            {
                md.Extension.RunCommand((int)swCommands_e.swCommands_SaveAs, md.GetTitle());
                if (md.GetPathName() == string.Empty)
                {
                    throw new Exception("Unsaved drawings cannot be added to an ECR.");
                }
                partpath     = md.GetPathName();
                partfilename = System.IO.Path.GetFileNameWithoutExtension(partpath);
            }
            string[] partarr = partfilename.Split(new string[] { "REV" }, StringSplitOptions.RemoveEmptyEntries);
            string   partno  = partarr[0].Trim();
            string   rv      = revision.Value;

            if (partarr.Length > 1)
            {
                rv = partarr[1].Trim();
            }
            string question = string.Format(Properties.Resources.InsertIntoEcrItems,
                                            System.IO.Path.GetFileName(partno),
                                            r.Eco.Value);

            swMessageBoxResult_e mbr = swMessageBoxResult_e.swMbHitNo;

            int en = 0;

            if (int.TryParse(r.Eco.Value, out en) &&
                !cutlist_data.ECRIsBogus(r.Eco.Value) &&
                !cutlist_data.ECRItemExists(en, partno, revision.Value))
            {
                mbr = (swMessageBoxResult_e)r.SwApp.SendMsgToUser2(question,
                                                                   (int)swMessageBoxIcon_e.swMbQuestion,
                                                                   (int)swMessageBoxBtn_e.swMbYesNo);
            }

            if (mbr == swMessageBoxResult_e.swMbHitYes)
            {
                OnAdded(EventArgs.Empty);
                ArchivePDF.csproj.ArchivePDFWrapper apw = new ArchivePDF.csproj.ArchivePDFWrapper(r.SwApp);
                apw.Archive();
                int parttype = 7;
                // M2M
                M2MData m = new M2MData();
                if (m.GetPartCount(partno, revision.Value) > 0)
                {
                    parttype = m.GetPartType(partno, revision.Value);
                }
                else
                {
                    // Cutlist
                    int prtid = 0;
                    if (int.TryParse(
                            cutlist_data.GetCutlistData(partno, revision.Value).Tables[0].Columns["CLID"].ToString(), out prtid))
                    {
                        if (prtid > 0)
                        {
                            parttype = 5;
                        }
                    }
                    else
                    {
                        if (cutlist_data.PartUsed(partno))
                        {
                            parttype = 6;
                        }
                    }
                }
                cutlist_data.InsertECRItem(en,
                                           partno,
                                           rv,
                                           parttype,
                                           r.Revision.Value,
                                           partpath,
                                           r.Eco.Value);
            }

            OnAddedLvl(new EventArgs());
        }