Beispiel #1
0
        public void ShowWindowPdmTest()
        {
            string parentFilePath = @"C:\EPDMVaults\Training\Built Parts\Block1.sldprt";
            string varName        = "Document Number";
            string vaultName      = "Training";

            IEdmVault13 vault = VaultSingleton.Instance;

            VaultHelper h = new VaultHelper(vault);

            string loginError;

            if (!h.TryLoginAuto(vaultName, out loginError))
            {
                Assert.Fail();
            }

            IEdmFolder5 parentFolder;
            IEdmFile5   file = (IEdmFile5)vault.GetFileFromPath(parentFilePath, out parentFolder);

            var fileVars = (IEdmEnumeratorVariable10)file.GetEnumeratorVariable();

            object oVal;
            bool   success = fileVars.GetVar2(varName, "@", parentFolder.ID, out oVal);

            var window = new AAFileRefsWindow();

            // do search and gret results...

            var search = new VaultSearch(vault);

            AAFileRef[] results = search.SearchForFileRefs(oVal.ToString());

            var vm = new AAFileRefsViewModel(parentFilePath, results, () => window.Close());

            window.DataContext = vm;

            window.ShowDialog();

            if (vm.OkWasClicked)
            {
                var fileRefsSvc = new CustomRefsService(vault);

                string[] chilPaths = vm.Results
                                     .Where(x => x.IsIncluded)
                                     .Select(x => x.Path).ToArray();

                fileRefsSvc.AddCustomReferences(file.ID, chilPaths);
            }
        }
        static void Main()
        {
            IEdmVault13 vault = VaultSingleton.Instance;

            VaultHelper vaultHelper = new VaultHelper(vault);

            // everything below here is predicated on being logged in...
            string error = null;

            if (!vaultHelper.TryLoginAuto("Training", out error))
            {
                Debug.WriteLine(error);
            }
            else
            {
                // Login success (or EdmServer was already logged in)

                var ex1 = new MapFolderExample();
                ex1.MapFolder();

                var ex2 = new MapFileReferenceExample();
                ex2.MapFileReferenceWithVariableValues();
            }
        }