예제 #1
0
        public static PublishPackageViewModel FromLocalPackage(Package l)
        {
            var vm = new PublishPackageViewModel(dynSettings.PackageManagerClient)
            {
                Group       = l.Group,
                Description = l.Description,
                Keywords    = l.Keywords != null?String.Join(" ", l.Keywords) : ""
            };

            vm.FunctionDefinitions =
                l.LoadedCustomNodes.Select(x => dynSettings.CustomNodeManager.GetFunctionDefinition(x.Guid)).ToList();

            if (l.VersionName != null)
            {
                var parts = l.VersionName.Split('.');
                if (parts.Count() == 3)
                {
                    vm.MajorVersion = parts[0];
                    vm.MinorVersion = parts[1];
                    vm.BuildVersion = parts[2];
                }
            }

            vm.Name    = l.Name;
            vm.Package = l;

            return(vm);
        }
        public void SetsErrorState()
        {
           
            //open a dyf file and modify it
            string packagedirectory = Path.Combine(TestDirectory, "pkgs");
            var packages = Directory.EnumerateDirectories(packagedirectory);
            var first = Path.GetFullPath(packages.First());
            string dyfpath = Path.Combine(first, "dyf");
            var customnodes = Directory.GetFiles(dyfpath);
            var firstnode = customnodes.First();
            
            OpenModel(firstnode);

            //add a preset so that customnode has changes that are unsaved
            GetModel().CurrentWorkspace.AddPreset("a useless preset", "some thing that will modify the definition",
                new List<Guid>(){GetModel().CurrentWorkspace.Nodes.First().GUID});

            Assert.IsTrue(GetModel().CurrentWorkspace.HasUnsavedChanges);

            //now try to upload this file
            var vm = new PublishPackageViewModel(this.ViewModel);
            ViewModel.OnRequestPackagePublishDialog(vm);
            //now add a customnode to the package
            vm.AddFile(firstnode);
            Console.WriteLine("add node at" + firstnode + "to package");

            vm.PublishLocallyCommand.Execute();
            //assert that we have not uploaded the file or indicated that we have
            Assert.AreNotEqual(vm.UploadState,PackageUploadHandle.State.Uploaded);
            Console.WriteLine(vm.ErrorString);

        }
예제 #3
0
        public static PublishPackageViewModel FromLocalPackage(DynamoViewModel dynamoViewModel, Package l)
        {
            var vm = new PublishPackageViewModel(dynamoViewModel)
            {
                Group       = l.Group,
                Description = l.Description,
                Keywords    = l.Keywords != null?String.Join(" ", l.Keywords) : "",
                                  FunctionDefinitions =
                                      l.LoadedCustomNodes.Select(
                                          x => dynamoViewModel.Model.CustomNodeManager.GetFunctionDefinition(x.Guid))
                                      .ToList(),
                                  Name    = l.Name,
                                  Package = l
            };

            if (l.VersionName == null)
            {
                return(vm);
            }

            var parts = l.VersionName.Split('.');

            if (parts.Count() != 3)
            {
                return(vm);
            }

            vm.MajorVersion = parts[0];
            vm.MinorVersion = parts[1];
            vm.BuildVersion = parts[2];
            return(vm);
        }
        public void AddingDyfRaisesCanExecuteChangeOnDelegateCommand()
        {
            
            var vm = new PublishPackageViewModel(ViewModel);
            ViewModel.OnRequestPackagePublishDialog(vm);

            //find a customnode to add to the package
            string packagedirectory = Path.Combine(TestDirectory, "pkgs");
            var packages = Directory.EnumerateDirectories(packagedirectory);
            var first = Path.GetFullPath(packages.First());
            string dyfpath = Path.Combine(first, "dyf");
            var customnodes = Directory.GetFiles(dyfpath);
            var firstnode = customnodes.First();

            Console.WriteLine("add node at" + firstnode + "to package");

            var canExecuteChangedFired = 0;
            vm.SubmitCommand.CanExecuteChanged += ((o, e) => { canExecuteChangedFired++; });
            //now add a customnode to the package
            vm.AddFile(firstnode);

            //assert that canExecute changed was fired one time 
            Assert.AreEqual(canExecuteChangedFired, 1);

        }
예제 #5
0
        private void ShowNodePublishInfo(object funcDef)
        {
            if (funcDef is List <FunctionDefinition> )
            {
                var fs = funcDef as List <FunctionDefinition>;

                foreach (var f in fs)
                {
                    var pkg = dynSettings.PackageLoader.GetOwnerPackage(f);

                    if (dynSettings.PackageLoader.GetOwnerPackage(f) != null)
                    {
                        var m = MessageBox.Show("The node is part of the dynamo package called \"" + pkg.Name +
                                                "\" - do you want to submit a new version of this package?  \n\nIf not, this node will be moved to the new package you are creating.",
                                                "Package Warning", MessageBoxButton.YesNo, MessageBoxImage.Question);
                        if (m == MessageBoxResult.Yes)
                        {
                            pkg.PublishNewPackageVersionCommand.Execute();
                            return;
                        }
                    }
                }

                var newPkgVm = new PublishPackageViewModel(dynSettings.PackageManagerClient);
                newPkgVm.FunctionDefinitions = fs;
                dynSettings.Controller.DynamoViewModel.OnRequestPackagePublishDialog(newPkgVm);
            }
            else
            {
                DynamoLogger.Instance.Log("Failed to obtain function definition from node.");
                return;
            }
        }
예제 #6
0
 public void OnShowPackagePublishUIRequested(PublishPackageViewModel vm)
 {
     if (ShowPackagePublishUIRequested != null)
     {
         ShowPackagePublishUIRequested(vm);
     }
 }
예제 #7
0
        public PublishPackageView(PublishPackageViewModel packageViewModel)
        {
            this.DataContext = packageViewModel;
            packageViewModel.PublishSuccess += PackageViewModelOnPublishSuccess;

            InitializeComponent();
        }
예제 #8
0
        private void PublishNewPackage()
        {
            this.RefreshCustomNodesFromDirectory();
            var vm = PublishPackageViewModel.FromLocalPackage(this);

            vm.IsNewVersion = false;
            var e = new PackageManagerPublishView(vm);
        }
예제 #9
0
파일: Package.cs 프로젝트: vtaran/Dynamo
        private void PublishNewPackage()
        {
            this.RefreshCustomNodesFromDirectory();
            var vm = PublishPackageViewModel.FromLocalPackage(this);

            vm.IsNewVersion = false;

            dynSettings.Controller.DynamoViewModel.OnRequestPackagePublishDialog(vm);
        }
예제 #10
0
        private void PublishNewPackage()
        {
            this.RefreshCustomNodesFromDirectory();
            var vm = PublishPackageViewModel.FromLocalPackage(this);

            vm.IsNewVersion = false;

            dynSettings.PackageManagerClient.OnShowPackagePublishUIRequested(vm);
        }
예제 #11
0
        public PublishPackageView(PublishPackageViewModel packageViewModel)
        {
            this.DataContext = packageViewModel;
            packageViewModel.PublishSuccess += PackageViewModelOnPublishSuccess;

            InitializeComponent();

            Title = string.Format(Wpf.Properties.Resources.PublishPackageViewTitle,
                                  packageViewModel.DynamoViewModel.BrandingResourceProvider.ProductName);
        }
예제 #12
0
        public PublishPackageView(PublishPackageViewModel packageViewModel)
        {
            this.DataContext = packageViewModel;
            packageViewModel.PublishSuccess += PackageViewModelOnPublishSuccess;

            InitializeComponent();

            Title = string.Format(Wpf.Properties.Resources.PublishPackageViewTitle,
                packageViewModel.DynamoViewModel.BrandingResourceProvider.ProductName);
        }
예제 #13
0
        public PublishPackageView(PublishPackageViewModel packageViewModel)
        {
            this.DataContext = packageViewModel;
            packageViewModel.PublishSuccess += PackageViewModelOnPublishSuccess;

            this.Owner = WPF.FindUpVisualTree <DynamoView>(this);
            this.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            InitializeComponent();
        }
        public PackageManagerPublishView(PublishPackageViewModel packageViewModel)
        {
            this.DataContext = packageViewModel;
            packageViewModel.PublishSuccess += PackageViewModelOnPublishSuccess;

            this.Owner = dynSettings.Bench;
            this.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            InitializeComponent();
        }
        public PackageManagerPublishView(PublishPackageViewModel packageViewModel)
        {
            this.DataContext = packageViewModel;
            packageViewModel.PublishSuccess += PackageViewModelOnPublishSuccess;

            this.Owner = dynSettings.Bench;
            this.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            InitializeComponent();
        }
예제 #16
0
        public static PublishPackageViewModel FromLocalPackage(DynamoViewModel dynamoViewModel, Package l)
        {
            var vm = new PublishPackageViewModel(dynamoViewModel)
            {
                Group       = l.Group,
                Description = l.Description,
                Keywords    = l.Keywords != null?String.Join(" ", l.Keywords) : "",
                                  CustomNodeDefinitions =
                                      l.LoadedCustomNodes.Select(
                                          x => dynamoViewModel.Model.CustomNodeManager.GetFunctionDefinition(x.Guid))
                                      .ToList(),
                                  Name    = l.Name,
                                  Package = l
            };

            // add additional files
            l.EnumerateAdditionalFiles();
            foreach (var file in l.AdditionalFiles)
            {
                vm.AdditionalFiles.Add(file.Model.FullName);
            }

            // load assemblies into reflection only context
            foreach (var file in l.EnumerateAssemblyFiles())
            {
                Assembly assem;
                var      result = PackageLoader.TryReflectionOnlyLoadFrom(file, out assem);
                if (result)
                {
                    vm.Assemblies.Add(assem);
                }
                else
                {
                    // if it's not a .NET assembly, we load it as an additional file
                    vm.AdditionalFiles.Add(file);
                }
            }

            if (l.VersionName == null)
            {
                return(vm);
            }

            var parts = l.VersionName.Split('.');

            if (parts.Count() != 3)
            {
                return(vm);
            }

            vm.MajorVersion = parts[0];
            vm.MinorVersion = parts[1];
            vm.BuildVersion = parts[2];
            return(vm);
        }
        public PackageManagerPublishView(PublishPackageViewModel packageViewModel)
        {

            this.DataContext = packageViewModel;
            packageViewModel.PublishSuccess += PackageViewModelOnPublishSuccess;

            this.Owner = WPF.FindUpVisualTree<DynamoView>(this);
            this.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            InitializeComponent();
        }
        public PublishPackageView(PublishPackageViewModel packageViewModel)
        {
            this.DataContext = packageViewModel;
            packageViewModel.PublishSuccess += PackageViewModelOnPublishSuccess;

            InitializeComponent();

            Title = string.Format(Wpf.Properties.Resources.PublishPackageViewTitle,
                packageViewModel.DynamoViewModel.BrandingResourceProvider.ProductName);
            packageViewModel.RequestShowFolderBrowserDialog += OnRequestShowFolderBrowserDialog;
            Logging.Analytics.TrackScreenView("PackageManager");
        }
예제 #19
0
        public PublishPackageView(PublishPackageViewModel packageViewModel)
        {
            this.DataContext = packageViewModel;
            packageViewModel.PublishSuccess += PackageViewModelOnPublishSuccess;

            InitializeComponent();

            Title = string.Format(Wpf.Properties.Resources.PublishPackageViewTitle,
                                  packageViewModel.DynamoViewModel.BrandingResourceProvider.ProductName);
            packageViewModel.RequestShowFolderBrowserDialog += OnRequestShowFolderBrowserDialog;
            Logging.Analytics.TrackScreenView("PackageManager");
        }
예제 #20
0
        public static PublishPackageViewModel FromLocalPackage(DynamoViewModel dynamoViewModel, Package l)
        {
            var vm = new PublishPackageViewModel(dynamoViewModel)
            {
                Group       = l.Group,
                Description = l.Description,
                Keywords    = l.Keywords != null?String.Join(" ", l.Keywords) : "",
                                  CustomNodeDefinitions =
                                      l.LoadedCustomNodes.Select(
                                          x => dynamoViewModel.Model.CustomNodeManager.GetFunctionDefinition(x.Guid))
                                      .ToList(),
                                  Assemblies = l.LoadedAssemblies.ToList(),
                                  Name       = l.Name,
                                  Package    = l
            };

            // add additional files
            l.EnumerateAdditionalFiles();
            foreach (var file in l.AdditionalFiles)
            {
                vm.AdditionalFiles.Add(file.Model.FullName);
            }

            // add unloaded assemblies, that are not yet loaded
            var unloadedAssemblies =
                l.EnumerateAssemblyFiles()
                .Where(x => !l.LoadedAssemblies.Select(a => a.Location).Contains(x));

            foreach (var file in unloadedAssemblies)
            {
                vm.Assemblies.Add(Assembly.ReflectionOnlyLoadFrom(file));
            }

            if (l.VersionName == null)
            {
                return(vm);
            }

            var parts = l.VersionName.Split('.');

            if (parts.Count() != 3)
            {
                return(vm);
            }

            vm.MajorVersion = parts[0];
            vm.MinorVersion = parts[1];
            vm.BuildVersion = parts[2];
            return(vm);
        }
예제 #21
0
        public static PublishPackageViewModel FromLocalPackage(DynamoViewModel dynamoViewModel, Package l)
        {
            var vm = new PublishPackageViewModel(dynamoViewModel)
            {
                Group = l.Group,
                Description = l.Description,
                Keywords = l.Keywords != null ? String.Join(" ", l.Keywords) : "",
                CustomNodeDefinitions =
                    l.LoadedCustomNodes.Select(
                        x => dynamoViewModel.Model.CustomNodeManager.GetFunctionDefinition(x.Guid))
                        .ToList(),
                Name = l.Name,
                Package = l
            };

            // add additional files
            l.EnumerateAdditionalFiles();
            foreach ( var file in l.AdditionalFiles)
            {
                vm.AdditionalFiles.Add(file.Model.FullName);
            }

            // load assemblies into reflection only context
            foreach (var file in l.EnumerateAssemblyFiles())
            {
                Assembly assem;
                var result = PackageLoader.TryReflectionOnlyLoadFrom(file, out assem);
                if (result)
                {
                    vm.Assemblies.Add(assem);
                }
                else
                {
                    // if it's not a .NET assembly, we load it as an additional file
                    vm.AdditionalFiles.Add(file);
                }
            }

            if (l.VersionName == null) return vm;

            var parts = l.VersionName.Split('.');
            if (parts.Count() != 3) return vm;

            vm.MajorVersion = parts[0];
            vm.MinorVersion = parts[1];
            vm.BuildVersion = parts[2];
            return vm;

        }
예제 #22
0
        public static PublishPackageViewModel FromLocalPackage(DynamoViewModel dynamoViewModel, Package l)
        {
            var defs = new List <CustomNodeDefinition>();

            foreach (var x in l.LoadedCustomNodes)
            {
                CustomNodeDefinition def;
                if (dynamoViewModel.Model.CustomNodeManager.TryGetFunctionDefinition(
                        x.FunctionId,
                        DynamoModel.IsTestMode,
                        out def))
                {
                    defs.Add(def);
                }
            }

            var vm = new PublishPackageViewModel(dynamoViewModel)
            {
                Group       = l.Group,
                Description = l.Description,
                Keywords    = l.Keywords != null?String.Join(" ", l.Keywords) : "",
                                  CustomNodeDefinitions = defs,
                                  Name          = l.Name,
                                  RepositoryUrl = l.RepositoryUrl ?? "",
                                  SiteUrl       = l.SiteUrl ?? "",
                                  Package       = l,
                                  License       = l.License
            };

            // add additional files
            l.EnumerateAdditionalFiles();
            foreach (var file in l.AdditionalFiles)
            {
                vm.AdditionalFiles.Add(file.Model.FullName);
            }

            var nodeLibraryNames = l.Header.node_libraries;

            // load assemblies into reflection only context
            foreach (var file in l.EnumerateAssemblyFilesInBinDirectory())
            {
                Assembly assem;
                var      result = PackageLoader.TryReflectionOnlyLoadFrom(file, out assem);

                if (result)
                {
                    var isNodeLibrary = nodeLibraryNames == null || nodeLibraryNames.Contains(assem.FullName);
                    vm.Assemblies.Add(new  PackageAssembly()
                    {
                        IsNodeLibrary = isNodeLibrary,
                        Assembly      = assem
                    });
                }
                else
                {
                    // if it's not a .NET assembly, we load it as an additional file
                    vm.AdditionalFiles.Add(file);
                }
            }

            if (l.VersionName == null)
            {
                return(vm);
            }

            var parts = l.VersionName.Split('.');

            if (parts.Count() != 3)
            {
                return(vm);
            }

            vm.MajorVersion = parts[0];
            vm.MinorVersion = parts[1];
            vm.BuildVersion = parts[2];
            return(vm);
        }
예제 #23
0
        void DynamoViewModelRequestRequestPackageManagerPublish(PublishPackageViewModel model)
        {
            if (_pubPkgView == null)
            {
                _pubPkgView = new PublishPackageView(model)
                {
                    Owner = this,
                    WindowStartupLocation = WindowStartupLocation.CenterOwner
                };
                _pubPkgView.Closed += (sender, args) => _pubPkgView = null;
                _pubPkgView.Show();

                if (_pubPkgView.IsLoaded && IsLoaded) _pubPkgView.Owner = this;
            }

            _pubPkgView.Focus();
        }
예제 #24
0
        public static PublishPackageViewModel FromLocalPackage(DynamoViewModel dynamoViewModel, Package l)
        {
            var vm = new PublishPackageViewModel(dynamoViewModel)
            {
                Group = l.Group,
                Description = l.Description,
                Keywords = l.Keywords != null ? String.Join(" ", l.Keywords) : "",
                FunctionDefinitions =
                    l.LoadedCustomNodes.Select(
                        x => dynamoViewModel.Model.CustomNodeManager.GetFunctionDefinition(x.Guid))
                        .ToList(),
                Name = l.Name,
                Package = l
            };

            if (l.VersionName == null) return vm;

            var parts = l.VersionName.Split('.');
            if (parts.Count() != 3) return vm;

            vm.MajorVersion = parts[0];
            vm.MinorVersion = parts[1];
            vm.BuildVersion = parts[2];
            return vm;

        }        
        private void ShowNodePublishInfo(ICollection<Tuple<CustomNodeInfo, CustomNodeDefinition>> funcDefs)
        {
            foreach (var f in funcDefs)
            {
                var pmExtension = DynamoViewModel.Model.GetPackageManagerExtension();
                var pkg = pmExtension.PackageLoader.GetOwnerPackage(f.Item1);

                if (pkg != null)
                {
                    var m = MessageBox.Show(String.Format(Resources.MessageSubmitSameNamePackage, 
                            DynamoViewModel.BrandingResourceProvider.ProductName,pkg.Name),
                            Resources.PackageWarningMessageBoxTitle, 
                            MessageBoxButton.YesNo, MessageBoxImage.Question);

                    if (m == MessageBoxResult.Yes)
                    {
                        var pkgVm = new PackageViewModel(DynamoViewModel, pkg);
                        pkgVm.PublishNewPackageVersionCommand.Execute();
                        return;
                    }
                }
            }

            var newPkgVm = new PublishPackageViewModel(DynamoViewModel) { CustomNodeDefinitions = funcDefs.Select(pair => pair.Item2).ToList() };

            DynamoViewModel.OnRequestPackagePublishDialog(newPkgVm);
        }
 private void ShowNodePublishInfo()
 {
     var newPkgVm = new PublishPackageViewModel(DynamoViewModel);
     DynamoViewModel.OnRequestPackagePublishDialog(newPkgVm);
 }
예제 #27
0
        void _vm_RequestRequestPackageManagerPublish(PublishPackageViewModel model)
        {
            if (_pubPkgView == null)
            {
                _pubPkgView = new PackageManagerPublishView(model);
                _pubPkgView.Closed += (sender, args) => _pubPkgView = null;
                _pubPkgView.Show();

                if (_pubPkgView.IsLoaded && this.IsLoaded) _pubPkgView.Owner = this;
            }

            _pubPkgView.Focus();
        }
예제 #28
0
        public static PublishPackageViewModel FromLocalPackage(DynamoViewModel dynamoViewModel, Package l)
        {
            var defs = new List<CustomNodeDefinition>();

            foreach (var x in l.LoadedCustomNodes)
            {
                CustomNodeDefinition def;
                if (dynamoViewModel.Model.CustomNodeManager.TryGetFunctionDefinition(
                    x.FunctionId,
                    DynamoModel.IsTestMode,
                    out def))
                {
                    defs.Add(def);
                }
            }

            var vm = new PublishPackageViewModel(dynamoViewModel)
            {
                Group = l.Group,
                Description = l.Description,
                Keywords = l.Keywords != null ? String.Join(" ", l.Keywords) : "",
                CustomNodeDefinitions = defs,
                Name = l.Name,
                RepositoryUrl = l.RepositoryUrl ?? "",
                SiteUrl = l.SiteUrl ?? "",
                Package = l,
                License = l.License
            };

            // add additional files
            l.EnumerateAdditionalFiles();
            foreach (var file in l.AdditionalFiles)
            {
                vm.AdditionalFiles.Add(file.Model.FullName);
            }

            var nodeLibraryNames = l.Header.node_libraries;

            var assembliesLoadedTwice = new List<string>();
            // load assemblies into reflection only context
            foreach (var file in l.EnumerateAssemblyFilesInBinDirectory())
            {
                Assembly assem;
                var result = PackageLoader.TryReflectionOnlyLoadFrom(file, out assem);

                switch (result)
                {
                    case AssemblyLoadingState.Success:
                        {
                            var isNodeLibrary = nodeLibraryNames == null || nodeLibraryNames.Contains(assem.FullName);
                            vm.Assemblies.Add(new PackageAssembly()
                            {
                                IsNodeLibrary = isNodeLibrary,
                                Assembly = assem
                            });
                            break;
                        }
                    case AssemblyLoadingState.NotManagedAssembly:
                        {
                            // if it's not a .NET assembly, we load it as an additional file
                            vm.AdditionalFiles.Add(file);
                            break;
                        }
                    case AssemblyLoadingState.AlreadyLoaded:
                        {
                            assembliesLoadedTwice.Add(file);
                            break;
                        }
                }
            }

            if (assembliesLoadedTwice.Any())
            {
                vm.UploadState = PackageUploadHandle.State.Error;
                vm.ErrorString = Resources.OneAssemblyWasLoadedSeveralTimesErrorMessage + string.Join("\n", assembliesLoadedTwice);
            }

            if (l.VersionName == null) return vm;

            var parts = l.VersionName.Split('.');
            if (parts.Count() != 3) return vm;

            vm.MajorVersion = parts[0];
            vm.MinorVersion = parts[1];
            vm.BuildVersion = parts[2];
            return vm;

        }
 private void PackageViewModelOnPublishSuccess(PublishPackageViewModel sender)
 {
     this.Dispatcher.BeginInvoke((Action) (Close));
 }
예제 #30
0
        private void ShowNodePublishInfo(object funcDef)
        {
            if (funcDef is List<CustomNodeDefinition>)
            {
                var fs = funcDef as List<CustomNodeDefinition>;

                foreach (var f in fs)
                {
                    var pkg = dynSettings.PackageLoader.GetOwnerPackage(f);

                    if (dynSettings.PackageLoader.GetOwnerPackage(f) != null)
                    {
                        var m = MessageBox.Show("The node is part of the dynamo package called \"" + pkg.Name +
                            "\" - do you want to submit a new version of this package?  \n\nIf not, this node will be moved to the new package you are creating.",
                            "Package Warning", MessageBoxButton.YesNo, MessageBoxImage.Question);
                        if (m == MessageBoxResult.Yes)
                        {
                            pkg.PublishNewPackageVersionCommand.Execute();
                            return;
                        }
                    }
                }

                var newPkgVm = new PublishPackageViewModel(dynSettings.PackageManagerClient);
                newPkgVm.FunctionDefinitions = fs;
                dynSettings.Controller.DynamoViewModel.OnRequestPackagePublishDialog(newPkgVm);
            }
            else
            {
                dynSettings.DynamoLogger.Log("Failed to obtain function definition from node.");
                return;
            }
        }
예제 #31
0
 private void PackageViewModelOnPublishSuccess(PublishPackageViewModel sender)
 {
     this.Dispatcher.BeginInvoke((Action)(Close));
 }
예제 #32
0
        public static PublishPackageViewModel FromLocalPackage(Package l)
        {

            var vm = new PublishPackageViewModel(dynSettings.PackageManagerClient)
                {
                    Group = l.Group,
                    Description = l.Description,
                    Keywords = l.Keywords != null ? String.Join(" ", l.Keywords ) : ""
                };

            vm.FunctionDefinitions =
                l.LoadedCustomNodes.Select(x => dynSettings.CustomNodeManager.GetFunctionDefinition(x.Guid)).ToList();

            if (l.VersionName != null)
            {
                var parts = l.VersionName.Split('.');
                if (parts.Count() == 3)
                {
                    vm.MajorVersion = parts[0];
                    vm.MinorVersion = parts[1];
                    vm.BuildVersion = parts[2];
                }
            }

            vm.Name = l.Name;
            vm.Package = l;

            return vm;

        }        
예제 #33
0
        private void DynamoViewModelRequestRequestPackageManagerPublish(PublishPackageViewModel model)
        {
            var cmd = Analytics.TrackCommandEvent("PublishPackage");
            if (_pubPkgView == null)
            {
                _pubPkgView = new PublishPackageView(model)
                {
                    Owner = this,
                    WindowStartupLocation = WindowStartupLocation.CenterOwner
                };
                _pubPkgView.Closed += (sender, args) => { _pubPkgView = null; cmd.Dispose(); };
                _pubPkgView.Show();

                if (_pubPkgView.IsLoaded && IsLoaded) _pubPkgView.Owner = this;
            }

            _pubPkgView.Focus();
        }
예제 #34
0
 public void OnRequestPackagePublishDialog(PublishPackageViewModel vm)
 {
     if (RequestPackagePublishDialog != null)
         RequestPackagePublishDialog(vm);
 }
예제 #35
0
        /// <summary>
        ///     Class constructor
        /// </summary>
        public DynamoController(ExecutionEnvironment env, Type viewModelType, string context)
        {
            dynSettings.Controller = this;

            this.Context = context;

            //create the view model to which the main window will bind
            //the DynamoModel is created therein
            this.DynamoViewModel = (DynamoViewModel)Activator.CreateInstance(viewModelType,new object[]{this});

            // custom node loader
            string directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string pluginsPath = Path.Combine(directory, "definitions");

            CustomNodeManager = new CustomNodeManager(pluginsPath);

            SearchViewModel = new SearchViewModel();
            PackageManagerClient = new PackageManagerClient();
            dynSettings.PackageManagerClient = PackageManagerClient;
            PublishPackageViewModel = new PublishPackageViewModel(PackageManagerClient);

            dynSettings.PackageLoader = new PackageLoader();

            dynSettings.PackageLoader.DoCachedPackageUninstalls();
            dynSettings.PackageLoader.LoadPackages();

            FSchemeEnvironment = env;

            DynamoViewModel.Model.CurrentSpace.X = DynamoView.CANVAS_OFFSET_X;
            DynamoViewModel.Model.CurrentSpace.Y = DynamoView.CANVAS_OFFSET_Y;

            dynSettings.Controller.DynamoViewModel.Log(String.Format(
                "Dynamo -- Build {0}",
                Assembly.GetExecutingAssembly().GetName().Version));

            DynamoLoader.ClearCachedAssemblies();
            DynamoLoader.LoadBuiltinTypes();

            //run tests
            if (FScheme.RunTests(dynSettings.Controller.DynamoViewModel.Log))
            {
                dynSettings.Controller.DynamoViewModel.Log("All Tests Passed. Core library loaded OK.");
            }

            NodeSubmittedForRendering += new EventHandler(Controller_NodeSubmittedForRendering);
            NodeRemovedFromRendering += new EventHandler(Controller_NodeRemovedFromRendering);
        }