void Execute(VDF.Vault.Currency.Entities.FileIteration file, VDF.Vault.Currency.Connections.Connection connection)
        {
            VaultAccess.VaultAccess va = new VaultAccess.VaultAccess(connection, @"\\HLAFILESRVR2\ENGCOMMON\PDF Drawing Files\");

            if (System.IO.File.Exists(AppSettings.SettingsFilePath))
            {
                IvFullPath = (string)AppSettings.Get("Iv_FullPath");

                if (!System.IO.File.Exists(IvFullPath))
                {
                    selectDirectViewerApp();
                }
            }
            else
            {
                selectDirectViewerApp();
            }

            string filePath = Path.Combine(System.IO.Path.GetTempPath() + "\\DirectView\\", file.EntityName);

            if (file.EntityName.EndsWith(".iam"))
            {
                va.downloadFileAndAssociations(file, Path.GetDirectoryName(filePath));
            }
            else if (file.EntityName.EndsWith(".idw"))
            {
                va.downloadFile(file, Path.GetDirectoryName(filePath));
                if (va.CheckForOutOfDateSheets(filePath))
                {
                    MessageBox.Show("Cannot view this file, there are drawing sheet(s) that are out of date");
                }
            }
            else
            {
                va.downloadFile(file, Path.GetDirectoryName(filePath));
            }

            if (!File.Exists(filePath))
            {
                DialogResult downloadResult = MessageBox.Show("File is not finished downloading.  Did you want to try again?", "File Download", MessageBoxButtons.YesNoCancel);

                if (downloadResult == DialogResult.No || downloadResult == DialogResult.Cancel)
                {
                    return;
                }
            }

            Process p = new Process();

            p.StartInfo.WorkingDirectory = Path.GetDirectoryName(IvFullPath);

            p.StartInfo.FileName = IvFullPath;

            p.StartInfo.Arguments = "\"" + filePath + "\"";

            p.StartInfo.CreateNoWindow = false;
            p.Start();

            System.IO.File.SetAttributes(filePath, FileAttributes.ReadOnly);
        }
Exemplo n.º 2
0
        string GetERPPartNumberProperty(VDF.Vault.Currency.Entities.FileIteration fileInteration)
        {
            object partNumber = connection.PropertyManager.GetPropertyValue(
                fileInteration, propDefs["Keywords"], null);

            string partNumberString = partNumber == null ? "" : partNumber.ToString();

            return(partNumberString);
        }
Exemplo n.º 3
0
        string GetERPDescriptionProperty(VDF.Vault.Currency.Entities.FileIteration fileInteration)
        {
            object partDesc = connection.PropertyManager.GetPropertyValue(
                fileInteration, propDefs["Description"], null);

            string partDescString = partDesc == null ? "" : partDesc.ToString();

            return(partDescString);
        }
Exemplo n.º 4
0
 private System.Drawing.Image getThumbNail(VDF.Vault.Currency.Entities.FileIteration file)
 {
     try
     {
         VDF.Vault.Currency.Properties.PropertyDefinition thumbnailPropDef = connection.PropertyManager.GetPropertyDefinitionBySystemName("Thumbnail");
         VDF.Vault.Currency.Properties.ThumbnailInfo      thumbnailInfo    = connection.PropertyManager.GetPropertyValue(file, thumbnailPropDef, null) as VDF.Vault.Currency.Properties.ThumbnailInfo;
         byte[] thumbnailBytes = thumbnailInfo.Image;
         return(GetImage(thumbnailBytes, 200, 200));
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemplo n.º 5
0
        void Execute(VDF.Vault.Currency.Entities.FileIteration file, VDF.Vault.Currency.Connections.Connection connection)
        {
            string filePath = Path.Combine(System.IO.Path.GetTempPath(), file.EntityName);

            if (System.IO.File.Exists(filePath))
            {
                System.IO.File.SetAttributes(filePath, FileAttributes.Normal);
            }

            //determine if the file already exists
            if (System.IO.File.Exists(filePath))
            {
                //we'll try to delete the file so we can get the latest copy
                try
                {
                    System.IO.File.Delete(filePath);

                    //remove the file from the collection of downloaded files that need to be removed when the application exits
                    if (m_downloadedFiles.Contains(filePath))
                    {
                        m_downloadedFiles.Remove(filePath);
                    }
                }
                catch (System.IO.IOException)
                {
                    throw new Exception("The file you are attempting to open already exists and can not be overwritten. This file may currently be open, try closing any application you are using to view this file and try opening the file again.");
                }
            }

            downloadFile(connection, file, Path.GetDirectoryName(filePath));
            m_downloadedFiles.Add(filePath);

            //Create a new ProcessStartInfo structure.
            ProcessStartInfo pInfo = new ProcessStartInfo();

            //Set the file name member.
            pInfo.Arguments = "/high";
            pInfo.FileName  = filePath;
            //UseShellExecute is true by default. It is set here for illustration.
            pInfo.UseShellExecute = true;
            Process p = Process.Start(pInfo);

            System.IO.File.SetAttributes(filePath, FileAttributes.ReadOnly);
        }
Exemplo n.º 6
0
        void downloadFile(VDF.Vault.Currency.Connections.Connection connection, VDF.Vault.Currency.Entities.FileIteration file, string folderPath)
        {
            VDF.Vault.Settings.AcquireFilesSettings settings = new VDF.Vault.Settings.AcquireFilesSettings(connection);
            settings.AddEntityToAcquire(file);

            if (file.EntityName.EndsWith(".iam"))
            {
                settings.OptionsRelationshipGathering.FileRelationshipSettings.IncludeChildren        = true;
                settings.OptionsRelationshipGathering.FileRelationshipSettings.IncludeLibraryContents = true;
                // this forces all the files to go into one folder, it doesn't replicate the vault's folder structure..
                // this is needed so that Inventor view knows where to find the file
                settings.OrganizeFilesRelativeToCommonVaultRoot = false;
            }
            else
            {
                settings.OptionsRelationshipGathering.FileRelationshipSettings.IncludeChildren        = false;
                settings.OptionsRelationshipGathering.FileRelationshipSettings.IncludeLibraryContents = false;
                settings.OptionsRelationshipGathering.FileRelationshipSettings.IncludeChildren        = false;
            }

            settings.LocalPath = new VDF.Currency.FolderPathAbsolute(folderPath);
            connection.FileManager.AcquireFiles(settings);
        }