Ejemplo n.º 1
0
        public TermsOfUseHelper(TermsOfUseHelperParams touParams)
        {
            if (touParams == null)
            {
                throw new ArgumentNullException("touParams");
            }
            if (touParams.PackageManagerClient == null)
            {
                throw new ArgumentNullException("PackageManagerClient");
            }
            if (touParams.AuthenticationManager == null)
            {
                throw new ArgumentNullException("AuthenticationManager");
            }
            if (touParams.AcceptanceCallback == null)
            {
                throw new ArgumentNullException("AcceptanceCallback");
            }
            if (touParams.ResourceProvider == null)
            {
                throw new ArgumentNullException("ResourceProvider");
            }

            resourceProvider      = touParams.ResourceProvider;
            packageManagerClient  = touParams.PackageManagerClient;
            callbackAction        = touParams.AcceptanceCallback;
            authenticationManager = touParams.AuthenticationManager;
        }
        public TermsOfUseHelper(TermsOfUseHelperParams touParams)
        {
            if (touParams == null)
                throw new ArgumentNullException("touParams");
            if (touParams.PackageManagerClient == null)
                throw new ArgumentNullException("PackageManagerClient");
            if (touParams.AuthenticationManager == null)
                throw new ArgumentNullException("AuthenticationManager");
            if (touParams.AcceptanceCallback == null)
                throw new ArgumentNullException("AcceptanceCallback");
            if (touParams.ResourceProvider == null)
                throw new ArgumentNullException("ResourceProvider");

            resourceProvider = touParams.ResourceProvider;
            packageManagerClient = touParams.PackageManagerClient;
            callbackAction = touParams.AcceptanceCallback;
            authenticationManager = touParams.AuthenticationManager;
        }
Ejemplo n.º 3
0
        public void PublishCurrentWorkspace(object m)
        {
            var ws = (CustomNodeWorkspaceModel)DynamoViewModel.CurrentSpace;

            CustomNodeDefinition currentFunDef;

            if (DynamoViewModel.Model.CustomNodeManager.TryGetFunctionDefinition(
                    ws.CustomNodeId,
                    DynamoModel.IsTestMode,
                    out currentFunDef))
            {
                CustomNodeInfo currentFunInfo;
                if (DynamoViewModel.Model.CustomNodeManager.TryGetNodeInfo(
                        ws.CustomNodeId,
                        out currentFunInfo))
                {
                    var touParams = new TermsOfUseHelperParams
                    {
                        PackageManagerClient  = Model,
                        AuthenticationManager = DynamoViewModel.Model.AuthenticationManager,
                        ResourceProvider      = DynamoViewModel.BrandingResourceProvider,
                        AcceptanceCallback    = () => ShowNodePublishInfo(new[]
                        {
                            Tuple.Create(currentFunInfo, currentFunDef)
                        })
                    };

                    var termsOfUseCheck = new TermsOfUseHelper(touParams);
                    termsOfUseCheck.Execute();
                    return;
                }
            }

            MessageBox.Show(Resources.MessageSelectSymbolNotFound,
                            Resources.SelectionErrorMessageBoxTitle,
                            MessageBoxButton.OK, MessageBoxImage.Question);
        }
        public void PublishCurrentWorkspace(object m)
        {
            var ws = (CustomNodeWorkspaceModel)DynamoViewModel.CurrentSpace;

            CustomNodeDefinition currentFunDef;
            if (DynamoViewModel.Model.CustomNodeManager.TryGetFunctionDefinition(
                ws.CustomNodeId,
                DynamoModel.IsTestMode,
                out currentFunDef))
            {
                CustomNodeInfo currentFunInfo;
                if (DynamoViewModel.Model.CustomNodeManager.TryGetNodeInfo(
                    ws.CustomNodeId,
                    out currentFunInfo))
                {
                    var touParams = new TermsOfUseHelperParams
                    {
                        PackageManagerClient = Model,
                        AuthenticationManager = DynamoViewModel.Model.AuthenticationManager,
                        ResourceProvider = DynamoViewModel.BrandingResourceProvider,
                        AcceptanceCallback = () => ShowNodePublishInfo(new[]
                        {
                            Tuple.Create(currentFunInfo, currentFunDef)
                        })
                    };

                    var termsOfUseCheck = new TermsOfUseHelper(touParams);
                    termsOfUseCheck.Execute();
                    return;
                }
            }
            
            MessageBox.Show(Resources.MessageSelectSymbolNotFound, 
                    Resources.SelectionErrorMessageBoxTitle,
                    MessageBoxButton.OK, MessageBoxImage.Question);
        }