Esempio n. 1
0
        private void OnTaskRun(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
        {
            IEdmTaskInstance inst = default(IEdmTaskInstance);

            inst = (IEdmTaskInstance)poCmd.mpoExtra;

            IEdmVault5 vault = new EdmVault5();

            try
            {
                for (int i = 0; i < ppoData.Length; i++)
                {
                    if (((EdmCmdData)ppoData.GetValue(0)).mlObjectID1 != 0)
                    {
                        vault = (IEdmVault5)poCmd.mpoVault;
                        IEdmObject5 folderObject = vault.GetObject(EdmObjectType.EdmObject_Folder, ((EdmCmdData)ppoData.GetValue(i)).mlObjectID2);
                        IEdmFolder5 ef           = (IEdmFolder5)folderObject;
                        IEdmObject5 fileObject   = vault.GetObject(EdmObjectType.EdmObject_File,
                                                                   ((EdmCmdData)ppoData.GetValue(i)).mlObjectID1);
                        string fullpath = ef.LocalPath + "\\" + fileObject.Name;

                        DxfLoad dxfl = new DxfLoad();
                        var     sp   = dxfl.GetSpecification(fullpath, "");
                        dxfl.UpLoadDxf(sp);
                        XmlFile xf = new XmlFile();
                        xf.DownloadXml(fullpath);
                    }

                    SolidWorksPdmAdapter.Instance.KillProcsses("SLDWORKS");
                    MessageObserver.Instance.SetMessage("End upload.\n");
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                inst.SetStatus(EdmTaskStatus.EdmTaskStat_DoneFailed, ex.ErrorCode, "The test task failed!");
            }
            catch (Exception ex)
            {
                MessageObserver.Instance.SetMessage(ex.Message);
            }
        }
Esempio n. 2
0
        private void OnMenu(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
        {
            try
            {
                Logger.Instance.RootDirectory             = tempAppFolder;
                MessageObserver.Instance.ReceivedMessage += Program.Instance_ReceivedMessage;

                for (int i = 0; i < ppoData.Length; i++)
                {
                    if (((EdmCmdData)ppoData.GetValue(0)).mlObjectID1 != 0)
                    {
                        IEdmVault5 vault = new EdmVault5();

                        vault = (IEdmVault5)poCmd.mpoVault;
                        IEdmObject5 folderObject = vault.GetObject(EdmObjectType.EdmObject_Folder,
                                                                   ((EdmCmdData)ppoData.GetValue(i)).mlObjectID3);
                        IEdmFolder5 ef         = (IEdmFolder5)folderObject;
                        IEdmObject5 fileObject = vault.GetObject(EdmObjectType.EdmObject_File,
                                                                 ((EdmCmdData)ppoData.GetValue(i)).mlObjectID1);
                        string fullpath = ef.LocalPath + "\\" + fileObject.Name;

                        DxfLoad dxfl = new DxfLoad();
                        var     sp   = dxfl.GetSpecification(fullpath, "");
                        dxfl.UpLoadDxf(sp);

                        //XmlFile xf = new XmlFile();
                        //xf.DownloadXml(fullpath);
                    }

                    SolidWorksPdmAdapter.Instance.KillProcsses("SLDWORKS");
                    //MessageObserver.Instance.SetMessage("End upload.\n");
                }
            }
            catch (Exception ex)
            {
                MessageObserver.Instance.SetMessage(ex.Message);
                throw;
            }
        }