Esempio n. 1
0
        private void CheckForMissingVersions()
        {
            var requiredVersions = GenComposer.GetAllRequiredVersions(GetUserSelection());
            var missingVersions  = new List <RequiredVersionInfo>();

            foreach (var requiredVersion in requiredVersions)
            {
                var requirementInfo = RequiredVersionService.GetVersionInfo(requiredVersion);
                var isInstalled     = RequiredVersionService.Instance.IsVersionInstalled(requirementInfo);
                if (!isInstalled)
                {
                    missingVersions.Add(requirementInfo);
                }
            }

            if (missingVersions.Any())
            {
                var missingSdkVersions = missingVersions.Select(v => RequiredVersionService.GetRequirementDisplayName(v));

                var notification = Notification.Warning(string.Format(StringRes.NotificationMissingVersions, missingSdkVersions.Aggregate((i, j) => $"{i}, {j}")), Category.MissingVersion, TimerType.None);
                NotificationsControl.AddNotificationAsync(notification).FireAndForget();
            }
            else
            {
                NotificationsControl.CleanCategoryNotificationsAsync(Category.MissingVersion).FireAndForget();
            }
        }
Esempio n. 2
0
        private async void OnSyncStatusChanged(object sender, SyncStatusEventArgs args)
        {
            var notification = args.GetNotification();

            if (notification?.Category == Category.TemplatesSync)
            {
                await NotificationsControl.AddOrUpdateNotificationAsync(notification);
            }
            else
            {
                await NotificationsControl.AddNotificationAsync(notification);
            }

            if (args.Status == SyncStatus.NoUpdates || args.Status == SyncStatus.Ready)
            {
                NotificationsControl.RemoveNotification();
            }

            if (args.Status == SyncStatus.Updated || args.Status == SyncStatus.Ready)
            {
                WizardStatus.SetVersions();

                await OnTemplatesAvailableAsync();
            }
        }
Esempio n. 3
0
        private async Task ShowDependencyNotificationAsync(string name, IEnumerable <string> dependencyNames)
        {
            var allDependencyNames = ConcatTemplateNames(dependencyNames);

            var message      = string.Format(StringRes.NotificationRemoveError_Dependency, name, allDependencyNames);
            var notification = Notification.Warning(message, Category.RemoveTemplateValidation);
            await NotificationsControl.AddNotificationAsync(notification);
        }
Esempio n. 4
0
        private async Task ShowRemoveRequirementNotificationAsync(string name, IEnumerable <string> requiredForNames)
        {
            var allRequiredForNames = ConcatTemplateNames(requiredForNames);

            var message = string.Format(StringRes.NotificationRemoveError_Requirement, name, allRequiredForNames);

            var notification = Notification.Warning(message, Category.RemoveTemplateValidation);
            await NotificationsControl.AddNotificationAsync(notification);
        }
Esempio n. 5
0
        private async Task ShowAddTemplateExclusionsNotificationAsync(string name, IEnumerable <string> exludedTemplateNames)
        {
            var allExludedTemplateNames = ConcatTemplateNames(exludedTemplateNames);

            var message = string.Format(StringRes.NotificationAdditionError_Exclusion, name, allExludedTemplateNames);

            var notification = Notification.Warning(message, Category.AddTemplateValidation);
            await NotificationsControl.AddNotificationAsync(notification);
        }
 private void ValidateProjectPaths()
 {
     if (GenContext.Current.ProjectName != new DirectoryInfo(GenContext.Current.DestinationPath).Name)
     {
         var notification = Notification.Error(StringRes.NotificationValidationError_ProjectNameAndPathDoNotMatch, ErrorCategory.ProjectPathValidation);
         NotificationsControl.AddNotificationAsync(notification).FireAndForget();
         ChangesSummary.DoNotMerge          = true;
         ChangesSummary.IsDoNotMergeEnabled = false;
     }
     else
     {
         ChangesSummary.DoNotMerge          = false;
         ChangesSummary.IsDoNotMergeEnabled = true;
     }
 }
Esempio n. 7
0
        private void CheckForMissingSdks()
        {
            var sdks = GenComposer.GetAllRequiredSdks(GetUserSelection());

            var missingSdks = sdks.Where(sdk => !GenContext.ToolBox.Shell.IsSdkInstalled(sdk)).Select(sdk => Regex.Match(sdk, @"\d+(\.\d+)+").Value);

            if (missingSdks.Any())
            {
                var notification = Notification.Warning(string.Format(StringRes.NotificationMissingSdk, missingSdks.Aggregate((i, j) => $"{i},{j}")), Category.MissingSdk, TimerType.None);
                NotificationsControl.AddNotificationAsync(notification).FireAndForget();
            }
            else
            {
                NotificationsControl.CleanCategoryNotificationsAsync(Category.MissingSdk).FireAndForget();
            }
        }
        private async Task <bool> IsStepAvailableAsync(StepData step)
        {
            if (step.Id == NewItemStepChangesSummary && !WizardStatus.HasValidationErrors)
            {
                _output = await CleanupAndGenerateNewItemAsync();

                if (!_output.HasChangesToApply)
                {
                    var message = GetNewItemHasNoChangesMessage(TemplateType);
                    message = string.Format(message, TemplateSelection.Name);
                    var notification = Notification.Warning(message, Category.RightClickItemHasNoChanges);
                    NotificationsControl.AddNotificationAsync(notification).FireAndForget();
                }

                return(_output.HasChangesToApply);
            }

            return(true);
        }
        protected override async Task <bool> IsStepAvailableAsync(int step)
        {
            if (step == 1 && !WizardStatus.HasValidationErrors)
            {
                _output = await CleanupAndGenerateNewItemAsync();

                if (!_output.HasChangesToApply)
                {
                    var message = TemplateType == TemplateType.Page ? StringRes.NewItemHasNoChangesPage : StringRes.NewItemHasNoChangesFeature;
                    message = string.Format(message, TemplateSelection.Name);
                    var notification = Notification.Warning(message, Category.RightClickItemHasNoChanges);
                    NotificationsControl.AddNotificationAsync(notification).FireAndForget();
                }

                return(_output.HasChangesToApply);
            }

            return(await base.IsStepAvailableAsync(step));
        }
        private async Task ShowDependencyNotificationAsync(string name, IEnumerable <string> dependencyNames)
        {
            var dependencyNamesFormated = string.Empty;

            foreach (var dependencyName in dependencyNames.Take(3))
            {
                dependencyNamesFormated += $" **{dependencyName}**,";
            }

            dependencyNamesFormated = dependencyNamesFormated.Remove(dependencyNamesFormated.Length - 1);
            if (dependencyNames.Count() > 3)
            {
                dependencyNamesFormated += "...";
            }

            var message      = string.Format(StringRes.NotificationRemoveError_Dependency, name, dependencyNamesFormated);
            var notification = Notification.Warning(message, Category.RemoveTemplateValidation);
            await NotificationsControl.AddNotificationAsync(notification);
        }
Esempio n. 11
0
        protected async Task OnRefreshTemplatesAsync()
        {
            try
            {
                WizardStatus.IsLoading = true;
                await GenContext.ToolBox.Repo.RefreshAsync(true);
            }
            catch (Exception ex)
            {
                await NotificationsControl.AddNotificationAsync(Notification.Error(StringRes.NotificationSyncError_Refresh));

                await AppHealth.Current.Error.TrackAsync(ex.ToString());

                await AppHealth.Current.Exception.TrackAsync(ex);
            }
            finally
            {
                WizardStatus.IsLoading = GenContext.ToolBox.Repo.SyncInProgress;
            }
        }
Esempio n. 12
0
 private async Task ShowReadOnlyNotificationAsync(string name)
 {
     var message      = string.Format(StringRes.NotificationRemoveError_ReadOnly, name);
     var notification = Notification.Warning(message, Category.RemoveTemplateValidation);
     await NotificationsControl.AddNotificationAsync(notification);
 }