Пример #1
0
        private void PublishExecute()
        {
            if (!NetworkInterface.GetIsNetworkAvailable())
            {
                UIServices.Show(Resources.NoNetworkConnection, MessageLevel.Warning);
                return;
            }

            // validate the package to see if there is any error before actually creating the package.
            var firstIssue = Validate().FirstOrDefault(p => p.Level == PackageIssueLevel.Error);

            if (firstIssue != null)
            {
                UIServices.Show(
                    Resources.PackageCreationFailed
                    + Environment.NewLine
                    + Environment.NewLine
                    + firstIssue.Description,
                    MessageLevel.Warning);
                return;
            }

            using (var mruSourceManager = new MruPackageSourceManager(
                       new PublishSourceSettings(_settingsManager)))
            {
                var publishPackageViewModel = new PublishPackageViewModel(
                    mruSourceManager,
                    _settingsManager,
                    _uiServices,
                    _credentialPublishProvider,
                    this);
                _uiServices.OpenPublishDialog(publishPackageViewModel);
            }
        }
Пример #2
0
        private void PublishExecute()
        {
            if (!NetworkInterface.GetIsNetworkAvailable())
            {
                UIServices.Show(Resources.NoNetworkConnection, MessageLevel.Warning);
                return;
            }

            if (!this.IsValid)
            {
                UIServices.Show(Resources.PackageHasNoFile, MessageLevel.Warning);
                return;
            }

            string storedKey = _settingsManager.ReadApiKeyFromSettingFile();
            var    publishPackageViewModel = new PublishPackageViewModel(_settingsManager.PublishPackageLocation, this)
            {
                PublishKey = storedKey
            };

            _uiServices.OpenPublishDialog(publishPackageViewModel);

            string newKey = publishPackageViewModel.PublishKey;

            if (!String.IsNullOrEmpty(newKey))
            {
                _settingsManager.WriteApiKeyToSettingFile(newKey);
            }
        }