Exemplo n.º 1
0
        public void RebuildLicenses_AddRemovePage()
        {
            var licenses = new List <SummaryLicenseViewModel>();

            licenses.Add(new SummaryLicenseViewModel(new TemplateLicense()
            {
                Text = "TestLicense", Url = "Test"
            }));

            var userSelection = new UserSelection()
            {
                ProjectType = "SplitView",
                Framework   = "MVVMLight",
                HomeName    = "Main"
            };

            userSelection.Pages.Add(("Main", _fixture.Repository.Get(t => t.Identity == "wts.Page.Blank").FirstOrDefault()));
            userSelection.Features.Add(("SettingStorage", _fixture.Repository.Get(t => t.Identity == "wts.Feat.SettingsStorage").FirstOrDefault()));

            LicensesService.RebuildLicenses(userSelection, licenses);

            Assert.True(licenses.Count == 3);
            Assert.False(licenses.Any(l => l.Text == "TestLicense"));
            Assert.True(licenses.Any(l => l.Text == "MVVM Light"));
            Assert.True(licenses.Any(l => l.Text == "Microsoft.Toolkit.Uwp"));
            Assert.True(licenses.Any(l => l.Text == "Newtonsoft.Json"));
        }
Exemplo n.º 2
0
        private void BuildLicenses()
        {
            var userSelection = GetUserSelection();
            var licenses      = GenComposer.GetAllLicences(userSelection);

            LicensesService.SyncLicenses(licenses, Licenses);

            // Notify Licenses name to update the visibillity on the layout
            OnPropertyChanged(nameof(Licenses));
        }
Exemplo n.º 3
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (_loaded)
            {
                return;
            }

            _loaded = true;

            _creating = NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
                        StartsWith("admin/software_versions/create",
                                   StringComparison.InvariantCulture);

            if (Id <= 0 &&
                !_creating)
            {
                return;
            }

            _softwareVersions = await Service.GetAsync();

            _softwareFamilies = await SoftwareFamiliesService.GetAsync();

            _licenses = await LicensesService.GetAsync();

            _companies = await CompaniesService.GetAsync();

            _roles = await DocumentRolesService.GetEnabledAsync();

            _model = _creating ? new SoftwareVersionViewModel() : await Service.GetAsync(Id);

            _authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();

            _addingCompanyRoleId      = _roles.First().Id;
            _softwareVersionCompanies = await CompaniesBySoftwareVersionService.GetBySoftwareVersion(Id);

            _editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant().
                       StartsWith("admin/software_versions/edit/",
                                  StringComparison.InvariantCulture);

            if (_editing)
            {
                SetCheckboxes();
            }

            StateHasChanged();
        }
Exemplo n.º 4
0
        public void RebuildLicenses_Default()
        {
            var userSelection = new UserSelection()
            {
                ProjectType = "SplitView",
                Framework   = "MVVMLight",
                HomeName    = "Main"
            };

            ITemplateInfo template = _fixture.Repository.Get(t => t.Identity == "wts.Page.Blank").FirstOrDefault();

            userSelection.Pages.Add(("Main", template));

            var licenses = new List <SummaryLicenseViewModel>();

            LicensesService.RebuildLicenses(userSelection, licenses);

            Assert.True(licenses.Count == 2);
            Assert.True(licenses.Any(l => l.Text == "MVVM Light"));
            Assert.True(licenses.Any(l => l.Text == "Microsoft.Toolkit.Uwp"));
        }
Exemplo n.º 5
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (_loaded)
            {
                return;
            }

            _licenses = await LicensesService.GetAsync();

            _machine = await MachinesService.GetAsync(MachineId);

            _authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();

            if (_machine is null)
            {
                NavigationManager.ToBaseRelativePath("admin/machines");
            }

            _loaded = true;

            StateHasChanged();
        }
Exemplo n.º 6
0
 public LicensesController(LicensesService licensesService)
 {
     _licensesService = licensesService;
 }