commit a9c0e07cafcd07d1c7c1b5f4eb4f18936265b937 Author: Mikan <72257910+Mikan-DS@users.noreply.github.com> Date: Fri May 23 11:23:23 2025 +0300 initial diff --git a/.vs/RoutesInfoLibrary/v16/.suo b/.vs/RoutesInfoLibrary/v16/.suo new file mode 100644 index 0000000..a904596 Binary files /dev/null and b/.vs/RoutesInfoLibrary/v16/.suo differ diff --git a/RoutesInfoLibrary.sln b/RoutesInfoLibrary.sln new file mode 100644 index 0000000..a90a07a --- /dev/null +++ b/RoutesInfoLibrary.sln @@ -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 diff --git a/RoutesInfoLibrary/App.Config b/RoutesInfoLibrary/App.Config new file mode 100644 index 0000000..49cc43e --- /dev/null +++ b/RoutesInfoLibrary/App.Config @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/RoutesInfoLibrary/Model1.Designer.cs b/RoutesInfoLibrary/Model1.Designer.cs new file mode 100644 index 0000000..f933226 --- /dev/null +++ b/RoutesInfoLibrary/Model1.Designer.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// +// Этот код был создан из шаблона. +// +// Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения. +// Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода. +// +//------------------------------------------------------------------------------ + +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 Контексты + + /// + /// Нет доступной документации по метаданным. + /// + public partial class Model1Container : ObjectContext + { + #region Конструкторы + + /// + /// Инициализирует новый объект Model1Container, используя строку соединения из раздела "Model1Container" файла конфигурации приложения. + /// + public Model1Container() : base("name=Model1Container", "Model1Container") + { + this.ContextOptions.LazyLoadingEnabled = true; + OnContextCreated(); + } + + /// + /// Инициализация нового объекта Model1Container. + /// + public Model1Container(string connectionString) : base(connectionString, "Model1Container") + { + this.ContextOptions.LazyLoadingEnabled = true; + OnContextCreated(); + } + + /// + /// Инициализация нового объекта Model1Container. + /// + public Model1Container(EntityConnection connection) : base(connection, "Model1Container") + { + this.ContextOptions.LazyLoadingEnabled = true; + OnContextCreated(); + } + + #endregion + + #region Разделяемые методы + + partial void OnContextCreated(); + + #endregion + + } + + #endregion + +} diff --git a/RoutesInfoLibrary/Model1.edmx b/RoutesInfoLibrary/Model1.edmx new file mode 100644 index 0000000..c1a8a89 --- /dev/null +++ b/RoutesInfoLibrary/Model1.edmx @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RoutesInfoLibrary/Model1.edmx.diagram b/RoutesInfoLibrary/Model1.edmx.diagram new file mode 100644 index 0000000..14a834c --- /dev/null +++ b/RoutesInfoLibrary/Model1.edmx.diagram @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/RoutesInfoLibrary/Models/IModel.cs b/RoutesInfoLibrary/Models/IModel.cs new file mode 100644 index 0000000..ff3f67b --- /dev/null +++ b/RoutesInfoLibrary/Models/IModel.cs @@ -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 GenerateData(); + } +} diff --git a/RoutesInfoLibrary/Models/Route.cs b/RoutesInfoLibrary/Models/Route.cs new file mode 100644 index 0000000..435f68d --- /dev/null +++ b/RoutesInfoLibrary/Models/Route.cs @@ -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 Stops { get; set; } + public int TransportId { get; set; } + public Transport Transport + { + get + { + return DBService.Instance.GetModelData().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 stops, int transportId) + { + Id = id; + Name = name; + Stops = stops; + TransportId = transportId; + } + + public List GenerateData() + { + List data = new List(); + data.Add(new Route(1, "30", new List() { new Stop(1, "Урицкого"), new Stop(2, "Железнодорожный вокзал"), new Stop(3, "Чернышевского") }, 1)); + data.Add(new Route(2, "45", new List() { new Stop(4, "Парк победы"), new Stop(5, "Разъезд восстания") }, 1)); + data.Add(new Route(3, "2", new List() { new Stop(1, "Урицкого"), new Stop(2, "Железнодорожный вокзал") }, 1)); + data.Add(new Route(4, "12", new List() { new Stop(6, "Площадь Тукая"), new Stop(7, "Филармония") }, 2)); + data.Add(new Route(5, "8", new List() { new Stop(6, "Площадь Тукая"), new Stop(7, "Филармония") }, 2)); + data.Add(new Route(6, "10", new List() { new Stop(8, "Саид Галеева"), new Stop(6, "Площадь Тукая") }, 1)); + data.Add(new Route(7, "63", new List() { new Stop(9, "Советская площадь"), new Stop(10, "Парк Горького") }, 1)); + data.Add(new Route(8, "91", new List() { new Stop(11, "Высокая гора"), new Stop(16, "Улица мира"), }, 1)); + data.Add(new Route(9, "7", new List() { new Stop(12, "Дворец спорта"), new Stop(13, "ЦУМ") }, 2)); + data.Add(new Route(10, "6", new List() { new Stop(14, "Театр кукол"), new Stop(15, "Улица Халева") }, 2)); + return data; + } + } +} diff --git a/RoutesInfoLibrary/Models/Stop.cs b/RoutesInfoLibrary/Models/Stop.cs new file mode 100644 index 0000000..8019609 --- /dev/null +++ b/RoutesInfoLibrary/Models/Stop.cs @@ -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; + } + } +} diff --git a/RoutesInfoLibrary/Models/Transport.cs b/RoutesInfoLibrary/Models/Transport.cs new file mode 100644 index 0000000..ae6da55 --- /dev/null +++ b/RoutesInfoLibrary/Models/Transport.cs @@ -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 GenerateData() + { + List data = new List(); + data.Add(new Transport() { Id = 1, Name = "Автобус" }); + data.Add(new Transport() { Id = 2, Name = "Троллейбус" }); + return data; + } + } +} diff --git a/RoutesInfoLibrary/Properties/AssemblyInfo.cs b/RoutesInfoLibrary/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f3331b1 --- /dev/null +++ b/RoutesInfoLibrary/Properties/AssemblyInfo.cs @@ -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")] diff --git a/RoutesInfoLibrary/Resources/1.png b/RoutesInfoLibrary/Resources/1.png new file mode 100644 index 0000000..85cc409 Binary files /dev/null and b/RoutesInfoLibrary/Resources/1.png differ diff --git a/RoutesInfoLibrary/Resources/10.png b/RoutesInfoLibrary/Resources/10.png new file mode 100644 index 0000000..5479fc0 Binary files /dev/null and b/RoutesInfoLibrary/Resources/10.png differ diff --git a/RoutesInfoLibrary/Resources/2.png b/RoutesInfoLibrary/Resources/2.png new file mode 100644 index 0000000..b90fd51 Binary files /dev/null and b/RoutesInfoLibrary/Resources/2.png differ diff --git a/RoutesInfoLibrary/Resources/3.png b/RoutesInfoLibrary/Resources/3.png new file mode 100644 index 0000000..1e34a3b Binary files /dev/null and b/RoutesInfoLibrary/Resources/3.png differ diff --git a/RoutesInfoLibrary/Resources/4.png b/RoutesInfoLibrary/Resources/4.png new file mode 100644 index 0000000..45efbfd Binary files /dev/null and b/RoutesInfoLibrary/Resources/4.png differ diff --git a/RoutesInfoLibrary/Resources/5.png b/RoutesInfoLibrary/Resources/5.png new file mode 100644 index 0000000..1b04300 Binary files /dev/null and b/RoutesInfoLibrary/Resources/5.png differ diff --git a/RoutesInfoLibrary/Resources/6.png b/RoutesInfoLibrary/Resources/6.png new file mode 100644 index 0000000..06ea2fe Binary files /dev/null and b/RoutesInfoLibrary/Resources/6.png differ diff --git a/RoutesInfoLibrary/Resources/7.png b/RoutesInfoLibrary/Resources/7.png new file mode 100644 index 0000000..feaf6ad Binary files /dev/null and b/RoutesInfoLibrary/Resources/7.png differ diff --git a/RoutesInfoLibrary/Resources/8.png b/RoutesInfoLibrary/Resources/8.png new file mode 100644 index 0000000..1041680 Binary files /dev/null and b/RoutesInfoLibrary/Resources/8.png differ diff --git a/RoutesInfoLibrary/Resources/9.png b/RoutesInfoLibrary/Resources/9.png new file mode 100644 index 0000000..8f4707d Binary files /dev/null and b/RoutesInfoLibrary/Resources/9.png differ diff --git a/RoutesInfoLibrary/Resources/Stops/1.png b/RoutesInfoLibrary/Resources/Stops/1.png new file mode 100644 index 0000000..696aa84 Binary files /dev/null and b/RoutesInfoLibrary/Resources/Stops/1.png differ diff --git a/RoutesInfoLibrary/Resources/Stops/10.png b/RoutesInfoLibrary/Resources/Stops/10.png new file mode 100644 index 0000000..97a40e1 Binary files /dev/null and b/RoutesInfoLibrary/Resources/Stops/10.png differ diff --git a/RoutesInfoLibrary/Resources/Stops/11.png b/RoutesInfoLibrary/Resources/Stops/11.png new file mode 100644 index 0000000..80a7183 Binary files /dev/null and b/RoutesInfoLibrary/Resources/Stops/11.png differ diff --git a/RoutesInfoLibrary/Resources/Stops/12.png b/RoutesInfoLibrary/Resources/Stops/12.png new file mode 100644 index 0000000..c2b4b06 Binary files /dev/null and b/RoutesInfoLibrary/Resources/Stops/12.png differ diff --git a/RoutesInfoLibrary/Resources/Stops/13.png b/RoutesInfoLibrary/Resources/Stops/13.png new file mode 100644 index 0000000..ad5e3f3 Binary files /dev/null and b/RoutesInfoLibrary/Resources/Stops/13.png differ diff --git a/RoutesInfoLibrary/Resources/Stops/14.png b/RoutesInfoLibrary/Resources/Stops/14.png new file mode 100644 index 0000000..e7f5218 Binary files /dev/null and b/RoutesInfoLibrary/Resources/Stops/14.png differ diff --git a/RoutesInfoLibrary/Resources/Stops/15.png b/RoutesInfoLibrary/Resources/Stops/15.png new file mode 100644 index 0000000..0afa8f5 Binary files /dev/null and b/RoutesInfoLibrary/Resources/Stops/15.png differ diff --git a/RoutesInfoLibrary/Resources/Stops/16.png b/RoutesInfoLibrary/Resources/Stops/16.png new file mode 100644 index 0000000..3fd2a50 Binary files /dev/null and b/RoutesInfoLibrary/Resources/Stops/16.png differ diff --git a/RoutesInfoLibrary/Resources/Stops/2.png b/RoutesInfoLibrary/Resources/Stops/2.png new file mode 100644 index 0000000..ace5871 Binary files /dev/null and b/RoutesInfoLibrary/Resources/Stops/2.png differ diff --git a/RoutesInfoLibrary/Resources/Stops/3.png b/RoutesInfoLibrary/Resources/Stops/3.png new file mode 100644 index 0000000..3913829 Binary files /dev/null and b/RoutesInfoLibrary/Resources/Stops/3.png differ diff --git a/RoutesInfoLibrary/Resources/Stops/4.png b/RoutesInfoLibrary/Resources/Stops/4.png new file mode 100644 index 0000000..7eb2323 Binary files /dev/null and b/RoutesInfoLibrary/Resources/Stops/4.png differ diff --git a/RoutesInfoLibrary/Resources/Stops/5.png b/RoutesInfoLibrary/Resources/Stops/5.png new file mode 100644 index 0000000..e7ef641 Binary files /dev/null and b/RoutesInfoLibrary/Resources/Stops/5.png differ diff --git a/RoutesInfoLibrary/Resources/Stops/6.png b/RoutesInfoLibrary/Resources/Stops/6.png new file mode 100644 index 0000000..1901db8 Binary files /dev/null and b/RoutesInfoLibrary/Resources/Stops/6.png differ diff --git a/RoutesInfoLibrary/Resources/Stops/7.png b/RoutesInfoLibrary/Resources/Stops/7.png new file mode 100644 index 0000000..113a69f Binary files /dev/null and b/RoutesInfoLibrary/Resources/Stops/7.png differ diff --git a/RoutesInfoLibrary/Resources/Stops/8.png b/RoutesInfoLibrary/Resources/Stops/8.png new file mode 100644 index 0000000..0ab0e07 Binary files /dev/null and b/RoutesInfoLibrary/Resources/Stops/8.png differ diff --git a/RoutesInfoLibrary/Resources/Stops/9.png b/RoutesInfoLibrary/Resources/Stops/9.png new file mode 100644 index 0000000..2562efe Binary files /dev/null and b/RoutesInfoLibrary/Resources/Stops/9.png differ diff --git a/RoutesInfoLibrary/RoutesInfoLibrary.csproj b/RoutesInfoLibrary/RoutesInfoLibrary.csproj new file mode 100644 index 0000000..a7d9fed --- /dev/null +++ b/RoutesInfoLibrary/RoutesInfoLibrary.csproj @@ -0,0 +1,82 @@ + + + + + Debug + AnyCPU + {F7218ED6-826A-422A-85A8-747D0BEC804B} + Library + Properties + RoutesInfoLibrary + RoutesInfoLibrary + v4.7.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RoutesInfoLibrary/Services/DBService.cs b/RoutesInfoLibrary/Services/DBService.cs new file mode 100644 index 0000000..609d2ea --- /dev/null +++ b/RoutesInfoLibrary/Services/DBService.cs @@ -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> _modelsData = new Dictionary>(); + + private DBService() + { + InitData(); + } + + public List GetModelData() + { + if (_modelsData.ContainsKey(typeof(T))) + return _modelsData[typeof(T)].Cast().ToList(); + return null; + } + + public void AddItem(T item) + { + var data = GetModelData(); + data.Add(item); + } + + public void RemoveItem(T item) + { + var data = GetModelData(); + data.Remove(item); + } + + private void RegisterModel(IModel model) + { + _modelsData.Add(model.GetType(), model.GenerateData()); + } + + private void InitData() + { + RegisterModel(new Route()); + RegisterModel(new Transport()); + } + + } +} diff --git a/RoutesInfoLibrary/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs b/RoutesInfoLibrary/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs new file mode 100644 index 0000000..3871b18 --- /dev/null +++ b/RoutesInfoLibrary/obj/Debug/.NETFramework,Version=v4.7.2.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] diff --git a/RoutesInfoLibrary/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/RoutesInfoLibrary/obj/Debug/DesignTimeResolveAssemblyReferences.cache new file mode 100644 index 0000000..e512e8a Binary files /dev/null and b/RoutesInfoLibrary/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/RoutesInfoLibrary/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/RoutesInfoLibrary/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..29f2c6a Binary files /dev/null and b/RoutesInfoLibrary/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/RoutesInfoLibrary/obj/Debug/RoutesInfoLibrary.csproj.AssemblyReference.cache b/RoutesInfoLibrary/obj/Debug/RoutesInfoLibrary.csproj.AssemblyReference.cache new file mode 100644 index 0000000..4b6f7a2 Binary files /dev/null and b/RoutesInfoLibrary/obj/Debug/RoutesInfoLibrary.csproj.AssemblyReference.cache differ diff --git a/RoutesInfoLibrary/obj/Debug/RoutesInfoLibrary.csproj.CoreCompileInputs.cache b/RoutesInfoLibrary/obj/Debug/RoutesInfoLibrary.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..aad7fca --- /dev/null +++ b/RoutesInfoLibrary/obj/Debug/RoutesInfoLibrary.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +55e9211dd7c1abee614119eeeb8cb9978e905104 diff --git a/RoutesInfoLibrary/obj/Debug/RoutesInfoLibrary.csproj.FileListAbsolute.txt b/RoutesInfoLibrary/obj/Debug/RoutesInfoLibrary.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..cf9a902 --- /dev/null +++ b/RoutesInfoLibrary/obj/Debug/RoutesInfoLibrary.csproj.FileListAbsolute.txt @@ -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 diff --git a/RoutesInfoLibrary/obj/Debug/TempPE/Model1.Designer.cs.dll b/RoutesInfoLibrary/obj/Debug/TempPE/Model1.Designer.cs.dll new file mode 100644 index 0000000..e69de29