Esempio n. 1
0
        internal PackageViewModel(
            IPackage package,
            string source,
            IMruManager mruManager,
            IUIServices uiServices,
            IPackageEditorService editorService,
            ISettingsManager settingsManager,
            CredentialPublishProvider credentialPublishProvider,
            IList <Lazy <IPackageContentViewer, IPackageContentViewerMetadata> > contentViewerMetadata,
            IList <Lazy <IPackageRule> > packageRules)
        {
            _settingsManager           = settingsManager ?? throw new ArgumentNullException(nameof(settingsManager));
            _editorService             = editorService ?? throw new ArgumentNullException(nameof(editorService));
            _uiServices                = uiServices ?? throw new ArgumentNullException(nameof(uiServices));
            _mruManager                = mruManager ?? throw new ArgumentNullException(nameof(mruManager));
            _credentialPublishProvider = credentialPublishProvider ?? throw new ArgumentNullException(nameof(credentialPublishProvider));
            _package = package ?? throw new ArgumentNullException(nameof(package));
            _contentViewerMetadata = contentViewerMetadata;
            _packageRules          = packageRules;

            _packageMetadata = new EditablePackageMetadata(_package, _uiServices);

            PackageSource = source;

            _isSigned = _packageMetadata.IsSigned;

            _packageRoot = PathToTreeConverter.Convert(_package.GetFiles().ToList(), this);
        }
Esempio n. 2
0
#pragma warning disable CS8618 // Non-nullable field is uninitialized.
        internal PackageViewModel(
#pragma warning restore CS8618 // Non-nullable field is uninitialized.
            IPackage package,
            string path,
            string source,
            IMruManager mruManager,
            IUIServices uiServices,
            IPackageEditorService editorService,
            ISettingsManager settingsManager,
            CredentialPublishProvider credentialPublishProvider,
            IList <Lazy <IPackageContentViewer, IPackageContentViewerMetadata> > contentViewerMetadata,
            IList <Lazy <IPackageRule> > packageRules)
        {
            SettingsManager            = settingsManager ?? throw new ArgumentNullException(nameof(settingsManager));
            _editorService             = editorService ?? throw new ArgumentNullException(nameof(editorService));
            UIServices                 = uiServices ?? throw new ArgumentNullException(nameof(uiServices));
            _mruManager                = mruManager ?? throw new ArgumentNullException(nameof(mruManager));
            _credentialPublishProvider = credentialPublishProvider ?? throw new ArgumentNullException(nameof(credentialPublishProvider));
            _package = package ?? throw new ArgumentNullException(nameof(package));
            ContentViewerMetadata = contentViewerMetadata;
            _packageRules         = packageRules;

            _packageMetadata = new EditablePackageMetadata(_package, UIServices);

            PackagePath   = path;
            PackageSource = source;

            _isSigned = _packageMetadata.IsSigned;

            RootFolder = PathToTreeConverter.Convert(_package.GetFiles().ToList(), this);
        }
Esempio n. 3
0
        internal PackageViewModel(
            IPackage package,
            string source,
            IMruManager mruManager,
            IUIServices uiServices,
            IPackageEditorService editorService,
            ISettingsManager settingsManager)
        {
            if (package == null) {
                throw new ArgumentNullException("package");
            }
            if (mruManager == null) {
                throw new ArgumentNullException("mruManager");
            }
            if (uiServices == null) {
                throw new ArgumentNullException("uiServices");
            }
            if (editorService == null) {
                throw new ArgumentNullException("editorService");
            }
            if (settingsManager == null) {
                throw new ArgumentNullException("settingsManager");
            }

            _settingsManager = settingsManager;
            _editorService = editorService;
            _uiServices = uiServices;
            _mruManager = mruManager;
            _package = package;
            _packageMetadata = new EditablePackageMetadata(_package);
            PackageSource = source;

            _packageRoot = PathToTreeConverter.Convert(_package.GetFiles().ToList(), this);
        }
        internal PackageViewModel(
            IPackage package,
            string source,
            IMruManager mruManager,
            IUIServices uiServices,
            IPackageEditorService editorService,
            ISettingsManager settingsManager,
            IList <Lazy <IPackageContentViewer, IPackageContentViewerMetadata> > contentViewerMetadata,
            IList <Lazy <IPackageRule> > packageRules)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }
            if (mruManager == null)
            {
                throw new ArgumentNullException("mruManager");
            }
            if (uiServices == null)
            {
                throw new ArgumentNullException("uiServices");
            }
            if (editorService == null)
            {
                throw new ArgumentNullException("editorService");
            }
            if (settingsManager == null)
            {
                throw new ArgumentNullException("settingsManager");
            }

            _settingsManager       = settingsManager;
            _editorService         = editorService;
            _uiServices            = uiServices;
            _mruManager            = mruManager;
            _package               = package;
            _contentViewerMetadata = contentViewerMetadata;
            _packageRules          = packageRules;

            _packageMetadata = new EditablePackageMetadata(_package);

            PackageSource = source;

            _packageRoot = PathToTreeConverter.Convert(_package.GetFiles().ToList(), this);

            // HACK: this is after the package.GetFiles() since that reads the signature
            _packageMetadata.PublisherCertificate = _package.PublisherCertificate;
        }
        internal PackageViewModel(
            IPackage package,
            string source,
            IMruManager mruManager,
            IUIServices uiServices,
            IPackageEditorService editorService,
            ISettingsManager settingsManager,
            IList <Lazy <IPackageContentViewer, IPackageContentViewerMetadata> > contentViewerMetadata,
            IList <Lazy <IPackageRule> > packageRules)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }
            if (mruManager == null)
            {
                throw new ArgumentNullException("mruManager");
            }
            if (uiServices == null)
            {
                throw new ArgumentNullException("uiServices");
            }
            if (editorService == null)
            {
                throw new ArgumentNullException("editorService");
            }
            if (settingsManager == null)
            {
                throw new ArgumentNullException("settingsManager");
            }

            _settingsManager       = settingsManager;
            _editorService         = editorService;
            _uiServices            = uiServices;
            _mruManager            = mruManager;
            _package               = package;
            _contentViewerMetadata = contentViewerMetadata;
            _packageRules          = packageRules;

            _packageMetadata = new EditablePackageMetadata(_package, _uiServices);

            PackageSource = source;
            _isSigned     = package.IsSigned;

            _packageRoot = PathToTreeConverter.Convert(_package.GetFiles().ToList(), this);
        }
Esempio n. 6
0
        private void LoadPackage(IPackage package, string packagePath, PackageType packageType)
        {
            if (package != null)
            {
                if (!RootLayout.LastChildFill)
                {
                    var packageViewer = new PackageViewer(UIServices, _packageViewModelFactory);
                    Grid.SetRow(packageViewer, 1);
                    RootLayout.Children.Add(packageViewer);
                    RootLayout.LastChildFill = true;

                    // set the Export of IPackageMetadataEditor here
                    EditorService = packageViewer.PackageMetadataEditor;
                }

                DataContext = _packageViewModelFactory.CreateViewModel(package, packagePath);
                if (!String.IsNullOrEmpty(packagePath))
                {
                    _mruManager.NotifyFileAdded(package, packagePath, packageType);
                }
            }
        }