コード例 #1
0
        protected override void DoAction()
        {
            Message("Closing file: \"" + SolidWorksDoc.GetTitle() + "\"");

            if (SaveChanges)
            {
                const int options = (int)swSaveAsOptions_e.swSaveAsOptions_Silent |
                                    (int)swSaveAsOptions_e.swSaveAsOptions_SaveReferenced;
                int  errs = 0, warnings = 0;
                bool saved = SolidWorksDoc.Save3(options, ref errs, ref warnings);
                if (!saved || errs != 0)
                {
                    throw new SolidWorksActionException(this);
                }
            }
            if (SolidWorksDoc.GetSaveFlag())
            {
                AskEventEnums.DialogResult result = Ask(string.Format("Closing {0} without saving changes.", SolidWorksDoc.GetPathName()), "Closing document", AskEventEnums.AskType.OKCancel);
                if (result == AskEventEnums.DialogResult.Cancel)
                {
                    return;
                }
            }
            SolidWorksDoc.Quit();
            SolidWorksDoc = null;
        }
コード例 #2
0
        protected override void DoAction()
        {
            const int options = (int)swSaveAsOptions_e.swSaveAsOptions_Silent |
                                (int)swSaveAsOptions_e.swSaveAsOptions_SaveReferenced;
            int  errs = 0, warnings = 0;
            bool saved = SolidWorksDoc.Save3(options, ref errs, ref warnings);

            if (!saved || errs != 0)
            {
                throw new SolidWorksActionException(this);
            }
        }