initial
BIN
.vs/RoutesInfoLibrary/v16/.suo
Normal file
25
RoutesInfoLibrary.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.33529.622
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoutesInfoLibrary", "RoutesInfoLibrary\RoutesInfoLibrary.csproj", "{F7218ED6-826A-422A-85A8-747D0BEC804B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{F7218ED6-826A-422A-85A8-747D0BEC804B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F7218ED6-826A-422A-85A8-747D0BEC804B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F7218ED6-826A-422A-85A8-747D0BEC804B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F7218ED6-826A-422A-85A8-747D0BEC804B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8A7DB158-284C-4962-B89D-3E26722AA081}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
3
RoutesInfoLibrary/App.Config
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
</configuration>
|
||||
70
RoutesInfoLibrary/Model1.Designer.cs
generated
Normal file
@@ -0,0 +1,70 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код был создан из шаблона.
|
||||
//
|
||||
// Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
|
||||
// Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Data.EntityClient;
|
||||
using System.Data.Objects;
|
||||
using System.Data.Objects.DataClasses;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
[assembly: EdmSchemaAttribute()]
|
||||
namespace RoutesInfoLibrary
|
||||
{
|
||||
#region Контексты
|
||||
|
||||
/// <summary>
|
||||
/// Нет доступной документации по метаданным.
|
||||
/// </summary>
|
||||
public partial class Model1Container : ObjectContext
|
||||
{
|
||||
#region Конструкторы
|
||||
|
||||
/// <summary>
|
||||
/// Инициализирует новый объект Model1Container, используя строку соединения из раздела "Model1Container" файла конфигурации приложения.
|
||||
/// </summary>
|
||||
public Model1Container() : base("name=Model1Container", "Model1Container")
|
||||
{
|
||||
this.ContextOptions.LazyLoadingEnabled = true;
|
||||
OnContextCreated();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация нового объекта Model1Container.
|
||||
/// </summary>
|
||||
public Model1Container(string connectionString) : base(connectionString, "Model1Container")
|
||||
{
|
||||
this.ContextOptions.LazyLoadingEnabled = true;
|
||||
OnContextCreated();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация нового объекта Model1Container.
|
||||
/// </summary>
|
||||
public Model1Container(EntityConnection connection) : base(connection, "Model1Container")
|
||||
{
|
||||
this.ContextOptions.LazyLoadingEnabled = true;
|
||||
OnContextCreated();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Разделяемые методы
|
||||
|
||||
partial void OnContextCreated();
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
46
RoutesInfoLibrary/Model1.edmx
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
|
||||
<!-- EF Runtime content -->
|
||||
<edmx:Runtime>
|
||||
<!-- SSDL content -->
|
||||
<edmx:StorageModels>
|
||||
<Schema xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl" Namespace="Model1.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005">
|
||||
<EntityContainer Name="Model1TargetContainer" >
|
||||
</EntityContainer>
|
||||
</Schema>
|
||||
</edmx:StorageModels>
|
||||
<!-- CSDL content -->
|
||||
<edmx:ConceptualModels>
|
||||
<Schema xmlns="http://schemas.microsoft.com/ado/2009/11/edm" xmlns:cg="http://schemas.microsoft.com/ado/2006/04/codegeneration" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" Namespace="Model1" Alias="Self" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" annotation:UseStrongSpatialTypes="false">
|
||||
<EntityContainer Name="Model1Container" annotation:LazyLoadingEnabled="true">
|
||||
</EntityContainer>
|
||||
</Schema>
|
||||
</edmx:ConceptualModels>
|
||||
<!-- C-S mapping content -->
|
||||
<edmx:Mappings>
|
||||
<Mapping xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs" Space="C-S">
|
||||
<Alias Key="Model" Value="Model1" />
|
||||
<Alias Key="Target" Value="Model1.Store" />
|
||||
<EntityContainerMapping CdmEntityContainer="Model1Container" StorageEntityContainer="Model1TargetContainer">
|
||||
</EntityContainerMapping>
|
||||
</Mapping>
|
||||
</edmx:Mappings>
|
||||
</edmx:Runtime>
|
||||
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
|
||||
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
|
||||
<edmx:Connection>
|
||||
<DesignerInfoPropertySet>
|
||||
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
|
||||
</DesignerInfoPropertySet>
|
||||
</edmx:Connection>
|
||||
<edmx:Options>
|
||||
<DesignerInfoPropertySet>
|
||||
<DesignerProperty Name="ValidateOnBuild" Value="true" />
|
||||
<DesignerProperty Name="EnablePluralization" Value="False" />
|
||||
</DesignerInfoPropertySet>
|
||||
</edmx:Options>
|
||||
<!-- Diagram content (shape and connector positions) -->
|
||||
<edmx:Diagrams>
|
||||
</edmx:Diagrams>
|
||||
</edmx:Designer>
|
||||
</edmx:Edmx>
|
||||
9
RoutesInfoLibrary/Model1.edmx.diagram
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
|
||||
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
|
||||
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
|
||||
<!-- Diagram content (shape and connector positions) -->
|
||||
<edmx:Diagrams>
|
||||
</edmx:Diagrams>
|
||||
</edmx:Designer>
|
||||
</edmx:Edmx>
|
||||
13
RoutesInfoLibrary/Models/IModel.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RoutesInfoLibrary.Models
|
||||
{
|
||||
public interface IModel
|
||||
{
|
||||
List<IModel> GenerateData();
|
||||
}
|
||||
}
|
||||
63
RoutesInfoLibrary/Models/Route.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using RoutesInfoLibrary.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace RoutesInfoLibrary.Models
|
||||
{
|
||||
public class Route : IModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public List<Stop> Stops { get; set; }
|
||||
public int TransportId { get; set; }
|
||||
public Transport Transport
|
||||
{
|
||||
get
|
||||
{
|
||||
return DBService.Instance.GetModelData<Transport>().FirstOrDefault(x => x.Id == TransportId);
|
||||
}
|
||||
}
|
||||
public string RouteDescription
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Join(", ", Stops.Select(x => x.Name));
|
||||
}
|
||||
}
|
||||
public BitmapImage RouteMap { get => new BitmapImage(new Uri(Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), $@"../../../RoutesInfoLibrary/Resources/{Id}.png")))); }
|
||||
|
||||
public Route()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Route(int id, string name, List<Stop> stops, int transportId)
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
Stops = stops;
|
||||
TransportId = transportId;
|
||||
}
|
||||
|
||||
public List<IModel> GenerateData()
|
||||
{
|
||||
List<IModel> data = new List<IModel>();
|
||||
data.Add(new Route(1, "30", new List<Stop>() { new Stop(1, "Урицкого"), new Stop(2, "Железнодорожный вокзал"), new Stop(3, "Чернышевского") }, 1));
|
||||
data.Add(new Route(2, "45", new List<Stop>() { new Stop(4, "Парк победы"), new Stop(5, "Разъезд восстания") }, 1));
|
||||
data.Add(new Route(3, "2", new List<Stop>() { new Stop(1, "Урицкого"), new Stop(2, "Железнодорожный вокзал") }, 1));
|
||||
data.Add(new Route(4, "12", new List<Stop>() { new Stop(6, "Площадь Тукая"), new Stop(7, "Филармония") }, 2));
|
||||
data.Add(new Route(5, "8", new List<Stop>() { new Stop(6, "Площадь Тукая"), new Stop(7, "Филармония") }, 2));
|
||||
data.Add(new Route(6, "10", new List<Stop>() { new Stop(8, "Саид Галеева"), new Stop(6, "Площадь Тукая") }, 1));
|
||||
data.Add(new Route(7, "63", new List<Stop>() { new Stop(9, "Советская площадь"), new Stop(10, "Парк Горького") }, 1));
|
||||
data.Add(new Route(8, "91", new List<Stop>() { new Stop(11, "Высокая гора"), new Stop(16, "Улица мира"), }, 1));
|
||||
data.Add(new Route(9, "7", new List<Stop>() { new Stop(12, "Дворец спорта"), new Stop(13, "ЦУМ") }, 2));
|
||||
data.Add(new Route(10, "6", new List<Stop>() { new Stop(14, "Театр кукол"), new Stop(15, "Улица Халева") }, 2));
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
27
RoutesInfoLibrary/Models/Stop.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RoutesInfoLibrary.Models
|
||||
{
|
||||
public class Stop
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public BitmapImage Image { get => new BitmapImage(new Uri(Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), $@"../../../RoutesInfoLibrary/Resources/Stops/{Id}.png")))); }
|
||||
|
||||
public Stop()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Stop(int id, string name)
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
23
RoutesInfoLibrary/Models/Transport.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RoutesInfoLibrary.Models
|
||||
{
|
||||
public class Transport : IModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
public List<IModel> GenerateData()
|
||||
{
|
||||
List<IModel> data = new List<IModel>();
|
||||
data.Add(new Transport() { Id = 1, Name = "Автобус" });
|
||||
data.Add(new Transport() { Id = 2, Name = "Троллейбус" });
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
36
RoutesInfoLibrary/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Общие сведения об этой сборке предоставляются следующим набором
|
||||
// набора атрибутов. Измените значения этих атрибутов для изменения сведений,
|
||||
// связанные со сборкой.
|
||||
[assembly: AssemblyTitle("RoutesInfoLibrary")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("RoutesInfoLibrary")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2025")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми
|
||||
// для компонентов COM. Если необходимо обратиться к типу в этой сборке через
|
||||
// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
|
||||
[assembly: Guid("f7218ed6-826a-422a-85a8-747d0bec804b")]
|
||||
|
||||
// Сведения о версии сборки состоят из указанных ниже четырех значений:
|
||||
//
|
||||
// Основной номер версии
|
||||
// Дополнительный номер версии
|
||||
// Номер сборки
|
||||
// Редакция
|
||||
//
|
||||
// Можно задать все значения или принять номера сборки и редакции по умолчанию
|
||||
// используя "*", как показано ниже:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
BIN
RoutesInfoLibrary/Resources/1.png
Normal file
|
After Width: | Height: | Size: 86 KiB |
BIN
RoutesInfoLibrary/Resources/10.png
Normal file
|
After Width: | Height: | Size: 328 KiB |
BIN
RoutesInfoLibrary/Resources/2.png
Normal file
|
After Width: | Height: | Size: 320 KiB |
BIN
RoutesInfoLibrary/Resources/3.png
Normal file
|
After Width: | Height: | Size: 243 KiB |
BIN
RoutesInfoLibrary/Resources/4.png
Normal file
|
After Width: | Height: | Size: 539 KiB |
BIN
RoutesInfoLibrary/Resources/5.png
Normal file
|
After Width: | Height: | Size: 344 KiB |
BIN
RoutesInfoLibrary/Resources/6.png
Normal file
|
After Width: | Height: | Size: 400 KiB |
BIN
RoutesInfoLibrary/Resources/7.png
Normal file
|
After Width: | Height: | Size: 298 KiB |
BIN
RoutesInfoLibrary/Resources/8.png
Normal file
|
After Width: | Height: | Size: 189 KiB |
BIN
RoutesInfoLibrary/Resources/9.png
Normal file
|
After Width: | Height: | Size: 345 KiB |
BIN
RoutesInfoLibrary/Resources/Stops/1.png
Normal file
|
After Width: | Height: | Size: 338 KiB |
BIN
RoutesInfoLibrary/Resources/Stops/10.png
Normal file
|
After Width: | Height: | Size: 529 KiB |
BIN
RoutesInfoLibrary/Resources/Stops/11.png
Normal file
|
After Width: | Height: | Size: 218 KiB |
BIN
RoutesInfoLibrary/Resources/Stops/12.png
Normal file
|
After Width: | Height: | Size: 718 KiB |
BIN
RoutesInfoLibrary/Resources/Stops/13.png
Normal file
|
After Width: | Height: | Size: 774 KiB |
BIN
RoutesInfoLibrary/Resources/Stops/14.png
Normal file
|
After Width: | Height: | Size: 586 KiB |
BIN
RoutesInfoLibrary/Resources/Stops/15.png
Normal file
|
After Width: | Height: | Size: 763 KiB |
BIN
RoutesInfoLibrary/Resources/Stops/16.png
Normal file
|
After Width: | Height: | Size: 526 KiB |
BIN
RoutesInfoLibrary/Resources/Stops/2.png
Normal file
|
After Width: | Height: | Size: 297 KiB |
BIN
RoutesInfoLibrary/Resources/Stops/3.png
Normal file
|
After Width: | Height: | Size: 285 KiB |
BIN
RoutesInfoLibrary/Resources/Stops/4.png
Normal file
|
After Width: | Height: | Size: 760 KiB |
BIN
RoutesInfoLibrary/Resources/Stops/5.png
Normal file
|
After Width: | Height: | Size: 467 KiB |
BIN
RoutesInfoLibrary/Resources/Stops/6.png
Normal file
|
After Width: | Height: | Size: 290 KiB |
BIN
RoutesInfoLibrary/Resources/Stops/7.png
Normal file
|
After Width: | Height: | Size: 725 KiB |
BIN
RoutesInfoLibrary/Resources/Stops/8.png
Normal file
|
After Width: | Height: | Size: 846 KiB |
BIN
RoutesInfoLibrary/Resources/Stops/9.png
Normal file
|
After Width: | Height: | Size: 818 KiB |
82
RoutesInfoLibrary/RoutesInfoLibrary.csproj
Normal file
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{F7218ED6-826A-422A-85A8-747D0BEC804B}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>RoutesInfoLibrary</RootNamespace>
|
||||
<AssemblyName>RoutesInfoLibrary</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Models\IModel.cs" />
|
||||
<Compile Include="Models\Route.cs" />
|
||||
<Compile Include="Models\Stop.cs" />
|
||||
<Compile Include="Models\Transport.cs" />
|
||||
<Compile Include="Services\DBService.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\1.png" />
|
||||
<Content Include="Resources\10.png" />
|
||||
<Content Include="Resources\2.png" />
|
||||
<Content Include="Resources\3.png" />
|
||||
<Content Include="Resources\4.png" />
|
||||
<Content Include="Resources\5.png" />
|
||||
<Content Include="Resources\6.png" />
|
||||
<Content Include="Resources\7.png" />
|
||||
<Content Include="Resources\8.png" />
|
||||
<Content Include="Resources\9.png" />
|
||||
<Content Include="Resources\Stops\1.png" />
|
||||
<Content Include="Resources\Stops\10.png" />
|
||||
<Content Include="Resources\Stops\11.png" />
|
||||
<Content Include="Resources\Stops\12.png" />
|
||||
<Content Include="Resources\Stops\13.png" />
|
||||
<Content Include="Resources\Stops\14.png" />
|
||||
<Content Include="Resources\Stops\15.png" />
|
||||
<Content Include="Resources\Stops\16.png" />
|
||||
<Content Include="Resources\Stops\2.png" />
|
||||
<Content Include="Resources\Stops\3.png" />
|
||||
<Content Include="Resources\Stops\4.png" />
|
||||
<Content Include="Resources\Stops\5.png" />
|
||||
<Content Include="Resources\Stops\6.png" />
|
||||
<Content Include="Resources\Stops\7.png" />
|
||||
<Content Include="Resources\Stops\8.png" />
|
||||
<Content Include="Resources\Stops\9.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
62
RoutesInfoLibrary/Services/DBService.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using RoutesInfoLibrary.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RoutesInfoLibrary.Services
|
||||
{
|
||||
public class DBService
|
||||
{
|
||||
private static DBService _instance;
|
||||
|
||||
public static DBService Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
_instance = new DBService();
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly Dictionary<Type, List<IModel>> _modelsData = new Dictionary<Type, List<IModel>>();
|
||||
|
||||
private DBService()
|
||||
{
|
||||
InitData();
|
||||
}
|
||||
|
||||
public List<T> GetModelData<T>()
|
||||
{
|
||||
if (_modelsData.ContainsKey(typeof(T)))
|
||||
return _modelsData[typeof(T)].Cast<T>().ToList();
|
||||
return null;
|
||||
}
|
||||
|
||||
public void AddItem<T>(T item)
|
||||
{
|
||||
var data = GetModelData<T>();
|
||||
data.Add(item);
|
||||
}
|
||||
|
||||
public void RemoveItem<T>(T item)
|
||||
{
|
||||
var data = GetModelData<T>();
|
||||
data.Remove(item);
|
||||
}
|
||||
|
||||
private void RegisterModel(IModel model)
|
||||
{
|
||||
_modelsData.Add(model.GetType(), model.GenerateData());
|
||||
}
|
||||
|
||||
private void InitData()
|
||||
{
|
||||
RegisterModel(new Route());
|
||||
RegisterModel(new Transport());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
|
||||
@@ -0,0 +1 @@
|
||||
55e9211dd7c1abee614119eeeb8cb9978e905104
|
||||
@@ -0,0 +1,2 @@
|
||||
Z:\ISRPO\Вариативные части\2025\RoutesInfoLibrary\RoutesInfoLibrary\obj\Debug\RoutesInfoLibrary.csproj.AssemblyReference.cache
|
||||
Z:\ISRPO\Вариативные части\2025\RoutesInfoLibrary\RoutesInfoLibrary\obj\Debug\RoutesInfoLibrary.csproj.CoreCompileInputs.cache
|
||||