Exemple #1
0
        private void ShowNodePublishInfo(object funcDef)
        {
            if (funcDef is List <CustomNodeDefinition> )
            {
                var fs = funcDef as List <CustomNodeDefinition>;

                foreach (var f in fs)
                {
                    var pkg = dynamoViewModel.Model.Loader.PackageLoader.GetOwnerPackage(f);

                    if (dynamoViewModel.Model.Loader.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)
                        {
                            var pkgVm = new PackageViewModel(dynamoViewModel, pkg);
                            pkgVm.PublishNewPackageVersionCommand.Execute();
                            return;
                        }
                    }
                }

                var newPkgVm = new PublishPackageViewModel(this.dynamoViewModel)
                {
                    CustomNodeDefinitions = fs
                };

                this.dynamoViewModel.OnRequestPackagePublishDialog(newPkgVm);
            }
            else
            {
                dynamoViewModel.Model.Logger.Log("Failed to obtain function definition from node.");
            }
        }
        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(object funcDef)
        {
            if (funcDef is List<CustomNodeDefinition>)
            {
                var fs = funcDef as List<CustomNodeDefinition>;

                foreach (var f in fs)
                {
                    var pkg = dynamoViewModel.Model.Loader.PackageLoader.GetOwnerPackage(f);

                    if (dynamoViewModel.Model.Loader.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)
                        {
                            var pkgVm = new PackageViewModel(dynamoViewModel, pkg);
                            pkgVm.PublishNewPackageVersionCommand.Execute();
                            return;
                        }
                    }
                }

                var newPkgVm = new PublishPackageViewModel(this.dynamoViewModel)
                {
                    CustomNodeDefinitions = fs
                };

                this.dynamoViewModel.OnRequestPackagePublishDialog(newPkgVm);
            }
            else
            {
                dynamoViewModel.Model.Logger.Log("Failed to obtain function definition from node.");
            }
        }