示例#1
0
        public void InsertFirst(T item)
        {
            CustomLink <T> newLink = new CustomLink <T>(item);

            newLink.Next = first;
            first        = newLink;
        }
示例#2
0
        public CustomLink <T> Delete(T item)
        {
            if (IsEmpty())
            {
                throw new ListIsEmptyException();
            }

            CustomLink <T> previous = first;
            CustomLink <T> current  = first;

            while (!current.Item.Equals(item))
            {
                if (current.Next == null)
                {
                    throw new ItemNotFoundException <T>(item); // Элемент не найден
                }
                else
                {
                    previous = current; // Перейти к следующему элементу
                    current  = current.Next;
                }
            } // Совпадение найдено

            if (current == first) // Если первый элемент,
            {
                first = first.Next; // изменить first
            }
            else // В противном случае
            {
                previous.Next = current.Next; // обойти его в списке
            }
            return(current);
        }
        public static void NavigateToChampionshipPage(UserChampionshipObject championship)
        {
            var mainWindow = Application.Current?.MainWindow as MainWindow;
            var group      = mainWindow?.MenuLinkGroups.FirstOrDefault(x => x.GroupKey == "drive" && x.DisplayName == AppStrings.Main_Single);
            var links      = group?.Links;

            links?.Remove(links.OfType <CustomLink>().FirstOrDefault(x => x.Source.OriginalString.StartsWith(@"/Pages/Drive/UserChampionships_SelectedPage.xaml")));

            if (championship == null)
            {
                mainWindow?.NavigateTo(new Uri("/Pages/Drive/UserChampionships.xaml", UriKind.RelativeOrAbsolute));
                return;
            }

            var uri = UriExtension.Create("/Pages/Drive/UserChampionships_SelectedPage.xaml?Id={0}", championship.Id);

            if (links == null)
            {
                LinkCommands.NavigateLink.Execute(uri, null);
                return;
            }

            var link = new CustomLink {
                DisplayName = championship.DisplayName,
                Source      = uri
            };

            links.Insert(4, link);
            mainWindow.NavigateTo(link.Source);
        }
示例#4
0
        public static void NavigateToCareerPage([CanBeNull] KunosCareerObject kunosCareer)
        {
            var mainWindow = Application.Current?.MainWindow as MainWindow;
            var group      = mainWindow?.MenuLinkGroups.FirstOrDefault(x => x.GroupKey == "drive" && x.DisplayName == AppStrings.Main_Single);
            var links      = group?.Links;

            links?.Remove(links.OfType <CustomLink>().FirstOrDefault(x => x.Source?.OriginalString.StartsWith(@"/Pages/Drive/KunosCareer_SelectedPage.xaml") == true));

            if (kunosCareer == null)
            {
                mainWindow?.NavigateTo(new Uri("/Pages/Drive/KunosCareer.xaml", UriKind.RelativeOrAbsolute));
                return;
            }

            var uri = UriExtension.Create("/Pages/Drive/KunosCareer_SelectedPage.xaml?Id={0}", kunosCareer.Id);

            if (links == null)
            {
                LinkCommands.NavigateLink.Execute(uri, null);
                return;
            }

            var link = new CustomLink {
                DisplayName = kunosCareer.DisplayName,
                Source      = uri
            };

            links.Insert(2, link);
            mainWindow.NavigateTo(link.Source);
        }
示例#5
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseHttpsRedirection();
            app.UseRouting();

            app.UseDocumentation(cfg =>
            {
                cfg.RootPathHandling = HandlingType.Redirect;
                cfg.GetMdlStyle      = "https://code.getmdl.io/1.3.0/material.deep_purple-light_blue.min.css";
                var swashbuckleLink  = new CustomLink("Swagger UI", "/swagger", false);
                cfg
                .AddCustomLink(swashbuckleLink)
                .AddFooterLink(swashbuckleLink)
                .AddFooterLink(new CustomLink("Swagger.json", "/swagger/v1/swagger.json", true))
                .AddFooterLink(new CustomLink("See on Gitub", "https://github.com/enisn/AutoFilterer", true));
            });

            app.UseSwagger();
            app.UseSwaggerUI(options =>
            {
                options.DefaultModelExpandDepth(3);
                options.EnableDeepLinking();
                options.DisplayRequestDuration();
                options.ShowExtensions();

                options.RoutePrefix = "swagger";

                options.SwaggerEndpoint("/swagger/v1/swagger.json", "V1 Docs");
            });

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
        private async Task DeleteCustomLink(CustomLink customLink)
        {
            var response = await HttpClient.DeleteAsync($"/api/CustomLink/{User.Id}/{customLink.Id}");

            response.EnsureSuccessStatusCode();
            CustomLinks.Remove(customLink);
            await InvokeAsync(StateHasChanged);
        }
示例#7
0
 public Task Update(CustomLink network)
 {
     return(Task.Run(() =>
     {
         FunctionalDbContext.CustomLinks.Update(network);
         FunctionalDbContext.SaveChange();
     }));
 }
示例#8
0
        public CustomLink <T> DeleteFirst()
        {
            if (IsEmpty())
            {
                throw new ListIsEmptyException();
            }

            CustomLink <T> temp = first;

            first = first.Next;
            return(temp);
        }
示例#9
0
        public override string ToString()
        {
            string         result  = string.Empty;
            CustomLink <T> current = first;

            while (current != null)
            {
                result += current.ToString();
                current = current.Next;
            }

            return(result);
        }
        public async Task <IActionResult> PutAsync(CustomLink network)
        {
            if (network == null)
            {
                return(BadRequest());
            }

            if (network.OwnerId != User.NameIdentifier())
            {
                return(BadRequest());
            }

            await _functionalUnitOfWork.CustomLinkRepository.Update(network);

            return(Ok());
        }
示例#11
0
        public CustomLink <T> Find(T item)
        {
            if (IsEmpty())
            {
                throw new ListIsEmptyException();
            }

            CustomLink <T> current = first;                    // Начиная с 'first'

            while (!current.Item.Equals(item))                 // Пока совпадение не найдено
            {
                if (current.Next == null)                      // Если достигнут конец списка
                {
                    throw new ItemNotFoundException <T>(item); // и совпадение не найдено
                }
                else // Если еще остались элементы
                {
                    current = current.Next; // Перейти к следующему элементу
                }
            }

            return(current); // Совпадение обнаружено
        }
示例#12
0
 public CustomList()
 {
     first = null;
 }
示例#13
0
 public CustomLink(T item)
 {
     Item = item;
     Next = null;
 }
示例#14
0
 public static DocumentingConfig AddCustomLink(this DocumentingConfig config, CustomLink item)
 {
     config.CustomLinks.Add(item);
     return(config);
 }
示例#15
0
 public static DocumentingConfig AddFooterLink(this DocumentingConfig config, CustomLink item)
 {
     config.FooterMetaDatas.Add(item);
     return(config);
 }
示例#16
0
 public Task Remove(CustomLink link)
 {
     return(Task.Run(() => FunctionalDbContext.CustomLinks.Remove(link.Id)));
 }
示例#17
0
 public Task <CustomLink> AddCustomLink(CustomLink CustomLink)
 {
     return(Task.Run(() => FunctionalDbContext.CustomLinks.Add(CustomLink)));
 }