10 Commits

Author SHA1 Message Date
c13dbee6b3 done 2024-09-27 14:33:35 +04:00
7408afe8aa упс, 2 и начало 3 лабы 2024-09-26 12:51:52 +04:00
9e89370e0c done and sdano 2024-09-13 14:40:22 +04:00
09263c1e14 done 2024-09-13 10:54:15 +04:00
2d2a534a39 is it ok? 2024-09-13 10:52:27 +04:00
037a67c1d2 process of rename 2024-09-13 10:51:37 +04:00
eac3b572d7 rename branch 2024-09-13 10:48:51 +04:00
2766f696df done 2024-09-13 10:46:40 +04:00
4cadabee22 rename valoa -> valova 2024-09-08 14:23:03 +04:00
7a727f4099 process, create projects and start work on combobox 2024-09-08 14:21:20 +04:00
51 changed files with 2899 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
using EmployeesContracts.BindingModels;
using EmployeesContracts.BusinessLogicsContracts;
using EmployeesContracts.StorageContracts;
using EmployeesContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeeLogic.BusinessLogics
{
public class EmployeeLogic : IEmployeeLogic
{
private readonly IEmployeeStorage _employeeStorage;
public EmployeeLogic(IEmployeeStorage employeeStorage)
{
_employeeStorage = employeeStorage;
}
public void CreateOrUpdate(EmployeeBindingModel model)
{
var element = _employeeStorage.GetElement(
new EmployeeBindingModel
{
Autobiography = model.Autobiography,
Name = model.Name,
Post = model.Post,
Upgrade = model.Upgrade
});
if (element != null && element.Id != model.Id)
{
throw new Exception("Сотрудник с таким именем уже существует");
}
if (model.Id.HasValue)
{
_employeeStorage.Update(model);
}
else
{
_employeeStorage.Insert(model);
}
}
public void Delete(EmployeeBindingModel model)
{
var element = _employeeStorage.GetElement(new EmployeeBindingModel { Id = model.Id });
if (element == null)
{
throw new Exception("Сотрудник не найден");
}
_employeeStorage.Delete(model);
}
public List<EmployeeViewModel> Read(EmployeeBindingModel model)
{
if (model == null)
{
return _employeeStorage.GetFullList();
}
if (model.Id.HasValue)
{
return new List<EmployeeViewModel> { _employeeStorage.GetElement(model) };
}
return _employeeStorage.GetFilteredList(model);
}
}
}

View File

@@ -0,0 +1,66 @@
using EmployeesContracts.BindingModels;
using EmployeesContracts.BusinessLogicsContracts;
using EmployeesContracts.StorageContracts;
using EmployeesContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeeLogic.BusinessLogics
{
public class PostLogic : IPostLogic
{
private readonly IPostStorage _postStorage;
public PostLogic(IPostStorage postStorage)
{
_postStorage = postStorage;
}
public void CreateOrUpdate(PostBindingModel model)
{
var element = _postStorage.GetElement(
new PostBindingModel
{
Name = model.Name
});
if (element != null && element.Id != model.Id)
{
throw new Exception("Такая должность уже существует");
}
if (model.Id.HasValue)
{
_postStorage.Update(model);
}
else
{
_postStorage.Insert(model);
}
}
public void Delete(PostBindingModel model)
{
var element = _postStorage.GetElement(new PostBindingModel { Id = model.Id });
if (element == null)
{
throw new Exception("Должность не найдена");
}
_postStorage.Delete(model);
}
public List<PostViewModel> Read(PostBindingModel model)
{
if (model == null)
{
return _postStorage.GetFullList();
}
if (model.Id.HasValue)
{
return new List<PostViewModel> { _postStorage.GetElement(model) };
}
return _postStorage.GetFilteredList(model);
}
}
}

View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\EmployeesContracts\EmployeesContracts.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeesContracts.BindingModels
{
public class EmployeeBindingModel
{
public int? Id { get; set; }
public string Name { get; set; }
public string Autobiography { get; set; }
public string Post { get; set; }
public DateTime? Upgrade { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeesContracts.BindingModels
{
public class PostBindingModel
{
public int? Id { get; set; }
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using EmployeesContracts.BindingModels;
using EmployeesContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeesContracts.BusinessLogicsContracts
{
public interface IEmployeeLogic
{
List<EmployeeViewModel> Read(EmployeeBindingModel model);
void CreateOrUpdate(EmployeeBindingModel model);
void Delete(EmployeeBindingModel model);
}
}

View File

@@ -0,0 +1,17 @@
using EmployeesContracts.BindingModels;
using EmployeesContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeesContracts.BusinessLogicsContracts
{
public interface IPostLogic
{
List<PostViewModel> Read(PostBindingModel model);
void CreateOrUpdate(PostBindingModel model);
void Delete(PostBindingModel model);
}
}

View File

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,21 @@
using EmployeesContracts.BindingModels;
using EmployeesContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeesContracts.StorageContracts
{
public interface IEmployeeStorage
{
List<EmployeeViewModel> GetFullList();
List<EmployeeViewModel> GetFilteredList(EmployeeBindingModel model);
EmployeeViewModel GetElement(EmployeeBindingModel model);
void Insert(EmployeeBindingModel model);
void Update(EmployeeBindingModel model);
void Delete(EmployeeBindingModel model);
}
}

View File

@@ -0,0 +1,21 @@
using EmployeesContracts.BindingModels;
using EmployeesContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeesContracts.StorageContracts
{
public interface IPostStorage
{
List<PostViewModel> GetFullList();
List<PostViewModel> GetFilteredList(PostBindingModel model);
PostViewModel GetElement(PostBindingModel model);
void Insert(PostBindingModel model);
void Update(PostBindingModel model);
void Delete(PostBindingModel model);
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeesContracts.ViewModels
{
public class EmployeeViewModel
{
public int? Id { get; set; }
[DisplayName("Название")]
public string Name { get; set; }
[DisplayName("Автобиография")]
public string Autobiography { get; set; }
[DisplayName("Должность")]
public string Post { get; set; }
[DisplayName("Дата повышения квалификации")]
public DateTime? Upgrade { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeesContracts.ViewModels
{
public class PostViewModel
{
public int? Id { get; set; }
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
using EmployeesDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
namespace EmployeesDatabaseImplement
{
public class EmployeesDatabase : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=DatabaseEmployees;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}
public virtual DbSet<Employee> Employees { set; get; }
public virtual DbSet<Post> Posts { set; get; }
}
}

View File

@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.17" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.17">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.17" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.17">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EmployeesContracts\EmployeesContracts.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,125 @@
using EmployeesContracts.BindingModels;
using EmployeesContracts.StorageContracts;
using EmployeesContracts.ViewModels;
using EmployeesDatabaseImplement.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeesDatabaseImplement.Implements
{
public class EmployeeStorage : IEmployeeStorage
{
public void Delete(EmployeeBindingModel model)
{
var context = new EmployeesDatabase();
var employee = context.Employees.FirstOrDefault(rec => rec.Id == model.Id);
if (employee != null)
{
context.Employees.Remove(employee);
context.SaveChanges();
}
else
{
throw new Exception("Сотрудник не найден");
}
}
public EmployeeViewModel GetElement(EmployeeBindingModel model)
{
if (model == null)
{
return null;
}
using var context = new EmployeesDatabase();
var employee = context.Employees
.ToList()
.FirstOrDefault(rec => rec.Id == model.Id);
return employee != null ? CreateModel(employee) : null;
}
public List<EmployeeViewModel> GetFilteredList(EmployeeBindingModel model)
{
var context = new EmployeesDatabase();
return context.Employees
.Where(employee => employee.Name.Contains(model.Name) && employee.Post.Contains(model.Post))
.ToList()
.Select(CreateModel)
.ToList();
}
public List<EmployeeViewModel> GetFullList()
{
using (var context = new EmployeesDatabase())
{
return context.Employees
.ToList()
.Select(CreateModel)
.ToList();
}
}
public void Insert(EmployeeBindingModel model)
{
var context = new EmployeesDatabase();
var transaction = context.Database.BeginTransaction();
try
{
context.Employees.Add(CreateModel(model, new Employee()));
context.SaveChanges();
transaction.Commit();
}
catch
{
transaction.Rollback();
throw;
}
}
public void Update(EmployeeBindingModel model)
{
var context = new EmployeesDatabase();
var transaction = context.Database.BeginTransaction();
try
{
var employee = context.Employees.FirstOrDefault(rec => rec.Id == model.Id);
if (employee == null)
{
throw new Exception("Сотрудник не найден");
}
CreateModel(model, employee);
context.SaveChanges();
transaction.Commit();
}
catch
{
transaction.Rollback();
throw;
}
}
private static Employee CreateModel(EmployeeBindingModel model, Employee employee)
{
employee.Upgrade = model.Upgrade;
employee.Name = model.Name;
employee.Post = model.Post;
employee.Autobiography = model.Autobiography;
return employee;
}
private EmployeeViewModel CreateModel(Employee employee)
{
return new EmployeeViewModel
{
Id = employee.Id,
Upgrade = employee.Upgrade,
Name = employee.Name,
Post = employee.Post,
Autobiography = employee.Autobiography
};
}
}
}

View File

@@ -0,0 +1,120 @@
using EmployeesContracts.BindingModels;
using EmployeesContracts.StorageContracts;
using EmployeesContracts.ViewModels;
using EmployeesDatabaseImplement.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeesDatabaseImplement.Implements
{
public class PostStorage : IPostStorage
{
public void Delete(PostBindingModel model)
{
var context = new EmployeesDatabase();
var post = context.Posts.FirstOrDefault(rec => rec.Id == model.Id);
if (post != null)
{
context.Posts.Remove(post);
context.SaveChanges();
}
else
{
throw new Exception("Должность не найдена");
}
}
public PostViewModel GetElement(PostBindingModel model)
{
if (model == null)
{
return null;
}
using var context = new EmployeesDatabase();
var post = context.Posts
.ToList()
.FirstOrDefault(rec => rec.Id == model.Id || rec.Name == model.Name);
return post != null ? CreateModel(post) : null;
}
public List<PostViewModel> GetFilteredList(PostBindingModel model)
{
if (model == null)
{
return null;
}
using var context = new EmployeesDatabase();
return context.Posts
.Where(rec => rec.Name.Contains(model.Name))
.Select(CreateModel)
.ToList();
}
public List<PostViewModel> GetFullList()
{
using var context = new EmployeesDatabase();
return context.Posts
.Select(CreateModel)
.ToList();
}
public void Insert(PostBindingModel model)
{
var context = new EmployeesDatabase();
var transaction = context.Database.BeginTransaction();
try
{
context.Posts.Add(CreateModel(model, new Post()));
context.SaveChanges();
transaction.Commit();
}
catch
{
transaction.Rollback();
throw;
}
}
public void Update(PostBindingModel model)
{
var context = new EmployeesDatabase();
var transaction = context.Database.BeginTransaction();
try
{
var post = context.Posts.FirstOrDefault(rec => rec.Id == model.Id);
if (post == null)
{
throw new Exception("Должность не найдена");
}
CreateModel(model, post);
context.SaveChanges();
transaction.Commit();
}
catch
{
transaction.Rollback();
throw;
}
}
private static Post CreateModel(PostBindingModel model, Post post)
{
post.Name = model.Name;
return post;
}
private static PostViewModel CreateModel(Post post)
{
return new PostViewModel
{
Id = post.Id,
Name = post.Name
};
}
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeesDatabaseImplement.Models
{
public class Employee
{
public int Id { get; set; }
[Required]
public string Name { get; set; }
[Required]
public string Autobiography { get; set; }
[Required]
public string Post { get; set; }
public DateTime? Upgrade { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EmployeesDatabaseImplement.Models
{
public class Post
{
public int Id { get; set; }
[Required]
public string Name { get; set; }
}
}

21
Valova_App/Book.cs Normal file
View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace custom_App
{
public class Book
{
public string Name { get; set; }
public string Author { get; set; }
public Book(string author, string name)
{
Author = author;
Name = name;
}
public Book() { }
}
}

258
Valova_App/Form1.Designer.cs generated Normal file
View File

@@ -0,0 +1,258 @@
namespace custom_App
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
customComboBox = new Valova_VisualComponents.customComboBox();
customTextBox = new Valova_VisualComponents.customTextBox();
customListBox = new Valova_VisualComponents.customListBox();
buttonAddToComboBox = new Button();
buttonClearComboBox = new Button();
textBoxForComboBox = new TextBox();
buttonCheckComboBox = new Button();
buttonGetTextBox = new Button();
textBoxAuthor = new TextBox();
textBoxName = new TextBox();
textBoxRow = new TextBox();
textBoxPar = new TextBox();
button1 = new Button();
buttonGet = new Button();
ButtonDocumentWithContextTextPdf = new Button();
ButtonDocumentWithChartLinePdf = new Button();
ButtonDocumentWithTableHeaderRowPdf = new Button();
componentTextToPdf = new Valova_VisualComponents.ComponentTextToPdf(components);
componentTableToPdf = new Valova_VisualComponents.ComponentTableToPdf(components);
componentDiagramToPdf = new Valova_VisualComponents.ComponentDiagramToPdf(components);
SuspendLayout();
//
// customComboBox
//
customComboBox.BorderStyle = BorderStyle.FixedSingle;
customComboBox.Location = new Point(31, 12);
customComboBox.Name = "customComboBox";
customComboBox.Size = new Size(152, 150);
customComboBox.TabIndex = 0;
//
// customTextBox
//
customTextBox.BorderStyle = BorderStyle.FixedSingle;
customTextBox.Location = new Point(236, 12);
customTextBox.Name = "customTextBox";
customTextBox.Pattern = null;
customTextBox.Size = new Size(161, 148);
customTextBox.TabIndex = 1;
customTextBox.Load += customTextBox1_Load;
//
// customListBox
//
customListBox.BorderStyle = BorderStyle.FixedSingle;
customListBox.Location = new Point(456, 12);
customListBox.Name = "customListBox";
customListBox.SelectedIndex = -1;
customListBox.Size = new Size(321, 150);
customListBox.TabIndex = 2;
customListBox.Load += customListBox_Load;
//
// buttonAddToComboBox
//
buttonAddToComboBox.Location = new Point(31, 196);
buttonAddToComboBox.Name = "buttonAddToComboBox";
buttonAddToComboBox.Size = new Size(152, 32);
buttonAddToComboBox.TabIndex = 3;
buttonAddToComboBox.Text = "Add item";
buttonAddToComboBox.UseVisualStyleBackColor = true;
buttonAddToComboBox.Click += buttonAddToComboBox_Click;
//
// buttonClearComboBox
//
buttonClearComboBox.Location = new Point(31, 234);
buttonClearComboBox.Name = "buttonClearComboBox";
buttonClearComboBox.Size = new Size(152, 32);
buttonClearComboBox.TabIndex = 4;
buttonClearComboBox.Text = "Clear";
buttonClearComboBox.UseVisualStyleBackColor = true;
buttonClearComboBox.Click += buttonClearComboBox_Click;
//
// textBoxForComboBox
//
textBoxForComboBox.Location = new Point(31, 168);
textBoxForComboBox.Name = "textBoxForComboBox";
textBoxForComboBox.Size = new Size(152, 23);
textBoxForComboBox.TabIndex = 5;
//
// buttonCheckComboBox
//
buttonCheckComboBox.Location = new Point(31, 272);
buttonCheckComboBox.Name = "buttonCheckComboBox";
buttonCheckComboBox.Size = new Size(152, 32);
buttonCheckComboBox.TabIndex = 6;
buttonCheckComboBox.Text = "Check";
buttonCheckComboBox.UseVisualStyleBackColor = true;
buttonCheckComboBox.Click += buttonCheckComboBox_Click;
//
// buttonGetTextBox
//
buttonGetTextBox.Location = new Point(236, 168);
buttonGetTextBox.Name = "buttonGetTextBox";
buttonGetTextBox.Size = new Size(161, 32);
buttonGetTextBox.TabIndex = 8;
buttonGetTextBox.Text = "Get";
buttonGetTextBox.UseVisualStyleBackColor = true;
buttonGetTextBox.Click += buttonGetTextBox_Click;
//
// textBoxAuthor
//
textBoxAuthor.Location = new Point(456, 177);
textBoxAuthor.Name = "textBoxAuthor";
textBoxAuthor.Size = new Size(148, 23);
textBoxAuthor.TabIndex = 9;
//
// textBoxName
//
textBoxName.Location = new Point(610, 177);
textBoxName.Name = "textBoxName";
textBoxName.Size = new Size(167, 23);
textBoxName.TabIndex = 10;
//
// textBoxRow
//
textBoxRow.Location = new Point(456, 240);
textBoxRow.Name = "textBoxRow";
textBoxRow.Size = new Size(32, 23);
textBoxRow.TabIndex = 11;
//
// textBoxPar
//
textBoxPar.Location = new Point(494, 240);
textBoxPar.Name = "textBoxPar";
textBoxPar.Size = new Size(148, 23);
textBoxPar.TabIndex = 12;
//
// button1
//
button1.Location = new Point(648, 234);
button1.Name = "button1";
button1.Size = new Size(100, 32);
button1.TabIndex = 13;
button1.Text = "Add";
button1.UseVisualStyleBackColor = true;
button1.Click += button1_Click;
//
// buttonGet
//
buttonGet.Location = new Point(567, 287);
buttonGet.Name = "buttonGet";
buttonGet.Size = new Size(100, 32);
buttonGet.TabIndex = 14;
buttonGet.Text = "Get";
buttonGet.UseVisualStyleBackColor = true;
buttonGet.Click += buttonGet_Click;
//
// ButtonDocumentWithContextTextPdf
//
ButtonDocumentWithContextTextPdf.Location = new Point(190, 402);
ButtonDocumentWithContextTextPdf.Name = "ButtonDocumentWithContextTextPdf";
ButtonDocumentWithContextTextPdf.Size = new Size(124, 36);
ButtonDocumentWithContextTextPdf.TabIndex = 15;
ButtonDocumentWithContextTextPdf.Text = "Текст";
ButtonDocumentWithContextTextPdf.UseVisualStyleBackColor = true;
ButtonDocumentWithContextTextPdf.Click += ButtonDocumentWithContextTextPdf_Click;
//
// ButtonDocumentWithChartLinePdf
//
ButtonDocumentWithChartLinePdf.Location = new Point(450, 402);
ButtonDocumentWithChartLinePdf.Name = "ButtonDocumentWithChartLinePdf";
ButtonDocumentWithChartLinePdf.Size = new Size(124, 36);
ButtonDocumentWithChartLinePdf.TabIndex = 16;
ButtonDocumentWithChartLinePdf.Text = "Диаграмма";
ButtonDocumentWithChartLinePdf.UseVisualStyleBackColor = true;
ButtonDocumentWithChartLinePdf.Click += ButtonDocumentWithChartLinePdf_Click;
//
// ButtonDocumentWithTableHeaderRowPdf
//
ButtonDocumentWithTableHeaderRowPdf.Location = new Point(320, 402);
ButtonDocumentWithTableHeaderRowPdf.Name = "ButtonDocumentWithTableHeaderRowPdf";
ButtonDocumentWithTableHeaderRowPdf.Size = new Size(124, 36);
ButtonDocumentWithTableHeaderRowPdf.TabIndex = 17;
ButtonDocumentWithTableHeaderRowPdf.Text = "Таблица";
ButtonDocumentWithTableHeaderRowPdf.UseVisualStyleBackColor = true;
ButtonDocumentWithTableHeaderRowPdf.Click += ButtonDocumentWithTableHeaderRowPdf_Click;
//
// Form1
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(ButtonDocumentWithTableHeaderRowPdf);
Controls.Add(ButtonDocumentWithChartLinePdf);
Controls.Add(ButtonDocumentWithContextTextPdf);
Controls.Add(buttonGet);
Controls.Add(button1);
Controls.Add(textBoxPar);
Controls.Add(textBoxRow);
Controls.Add(textBoxName);
Controls.Add(textBoxAuthor);
Controls.Add(buttonGetTextBox);
Controls.Add(buttonCheckComboBox);
Controls.Add(textBoxForComboBox);
Controls.Add(buttonClearComboBox);
Controls.Add(buttonAddToComboBox);
Controls.Add(customListBox);
Controls.Add(customTextBox);
Controls.Add(customComboBox);
Name = "Form1";
Text = "Form1";
ResumeLayout(false);
PerformLayout();
}
#endregion
private Valova_VisualComponents.customComboBox customComboBox;
private Valova_VisualComponents.customTextBox customTextBox;
private Valova_VisualComponents.customListBox customListBox;
private Button buttonAddToComboBox;
private Button buttonClearComboBox;
private TextBox textBoxForComboBox;
private Button buttonCheckComboBox;
private Button buttonGetTextBox;
private TextBox textBoxAuthor;
private TextBox textBoxName;
private TextBox textBoxRow;
private TextBox textBoxPar;
private Button button1;
private Button buttonGet;
private Button ButtonDocumentWithContextTextPdf;
private Button ButtonDocumentWithChartLinePdf;
private Button ButtonDocumentWithTableHeaderRowPdf;
private Valova_VisualComponents.ComponentTextToPdf componentTextToPdf;
private Valova_VisualComponents.ComponentTableToPdf componentTableToPdf;
private Valova_VisualComponents.ComponentDiagramToPdf componentDiagramToPdf;
}
}

136
Valova_App/Form1.cs Normal file
View File

@@ -0,0 +1,136 @@
using System.Text;
using Valova_VisualComponents;
using Valova_VisualComponents.Models;
namespace custom_App
{
public partial class Form1 : Form
{
List<Book> books = new List<Book>();
public Form1()
{
InitializeComponent();
customComboBox.Items.AddRange(new String[] { "1 example", "2 example", "3 example", "4 example" });
customTextBox.Pattern = @"^\+7\(\d{3}\)\d{3}-\d{2}-\d{2}$";
customTextBox.SetExample("+7(927)000-00-00");
customListBox.SetLayout("My favorite book is {Author} {Name}", "{", "}");
books.AddRange(new List<Book> { new Book("a", "A"), new Book("b", "B") });
}
private void customTextBox1_Load(object sender, EventArgs e)
{
}
private void buttonAddToComboBox_Click(object sender, EventArgs e)
{
if (!String.IsNullOrEmpty(textBoxForComboBox.Text))
{
customComboBox.Items.Add(textBoxForComboBox.Text);
textBoxForComboBox.Clear();
}
else
{
MessageBox.Show("Insert text");
}
}
private void buttonClearComboBox_Click(object sender, EventArgs e)
{
customComboBox.Clear();
}
private void buttonCheckComboBox_Click(object sender, EventArgs e)
{
textBoxForComboBox.Text = customComboBox.SelectedValue;
}
private void buttonGetTextBox_Click(object sender, EventArgs e)
{
MessageBox.Show(customTextBox.TextBoxValue);
}
private void customListBox_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Book newBook = new Book(textBoxAuthor.Text, textBoxName.Text);
customListBox.AddItemInList(newBook, int.Parse(textBoxRow.Text), textBoxPar.Text);
}
private void buttonGet_Click(object sender, EventArgs e)
{
Book b = customListBox.GetItemFromList<Book>();
MessageBox.Show(b.Author + " " + b.Name);
}
private void ButtonDocumentWithContextTextPdf_Click(object sender, EventArgs e)
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
(sender as Control).BackColor = Color.White; componentTextToPdf.CreateDoc(new ComponentTextToPdfConfig
{
FilePath = "C:\\Users\\User\\Desktop\\PdfDocumentWithContextTextPdf.pdf",
Header = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
Paragraphs = new List<string>
{
"2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2024 <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><>. <20><><EFBFBD><EFBFBD><EFBFBD>, <20>. 6/4, <20><><EFBFBD>. 1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, " +
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2024-2025 <20><><EFBFBD><EFBFBD>. 350 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!"}
});
(sender as Control).BackColor = Color.AliceBlue;
}
private void ButtonDocumentWithTableHeaderRowPdf_Click(object sender, EventArgs e)
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
(sender as Control).BackColor = Color.White;
componentTableToPdf.CreateDoc(new ComponentTableToPdfConfig<Book>
{
FilePath = "C:\\Users\\User\\Desktop\\PdfDocumentWithTableHeaderRow.pdf",
Header = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
UseUnion = true,
ColumnsRowsWidth = new List<(int, int)> { (20, 0), (20, 0), (15, 0), (15, 0) },
ColumnUnion = new List<(int StartIndex, int Count)> { (0, 2)},
Headers = new List<(int ColumnIndex, int RowIndex, string Header, string PropertyName)>
{
(0, 0, "<22><><EFBFBD><EFBFBD><EFBFBD>", "Books"),
(2, 0, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>", "Author"),
(3, 0, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "Name"),
(0, 1, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "Name"),
(1, 1, "<22><><EFBFBD><EFBFBD><EFBFBD>", "Author")
},
Data = books
});
(sender as Control).BackColor = Color.AliceBlue;
}
private void ButtonDocumentWithChartLinePdf_Click(object sender, EventArgs e)
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
(sender as Control).BackColor = Color.White;
componentDiagramToPdf.CreateDoc(new ComponentDiagramToPdfConfig
{
FilePath = "C:\\Users\\User\\Desktop\\PdfDocumentWithChartLine.pdf",
Header = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
ChartTitle = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
LegendLocation = Valova_VisualComponents.Models.Location.Top,
Data = new Dictionary<string, List<(string Name, double Value)>>
{
{ "0-20", new() { ("2021", 30), ("2022", 15), ("2023", 18) } },
{ "20-40", new(){ ("2021", 15), ("2022", 24), ("2023", 10) } },
{ "40+", new() { ("2021", 5), ("2022", 20), ("2023", 1) } }
}
});
(sender as Control).BackColor = Color.AliceBlue;
}
}
}

129
Valova_App/Form1.resx Normal file
View File

@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="componentTextToPdf.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="componentTableToPdf.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>184, 17</value>
</metadata>
<metadata name="componentDiagramToPdf.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>357, 17</value>
</metadata>
</root>

17
Valova_App/Program.cs Normal file
View File

@@ -0,0 +1,17 @@
namespace custom_App
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
}
}
}

View File

@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.12" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Valova_VisualComponents\Valova_VisualComponents\Valova_VisualComponents.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,49 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34723.18
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Valova_VisualComponents", "Valova_VisualComponents\Valova_VisualComponents.csproj", "{23CBD69E-2876-4A20-996F-4230AD3E642A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Valova_App", "..\Valova_App\Valova_App.csproj", "{EF001CCD-92F6-4A12-AC58-39CFF673A16B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmployeesDatabaseImplement", "..\EmployeesDatabaseImplement\EmployeesDatabaseImplement.csproj", "{A088FD57-FB19-46F5-9334-33D33FD6B388}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmployeeLogic", "..\EmployeeLogic\EmployeeLogic.csproj", "{25C68FC9-1CA2-4D48-B02D-5CA6B42F51E2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EmployeesContracts", "..\EmployeesContracts\EmployeesContracts.csproj", "{D8029FF9-4EF1-479B-80FB-0AC04CBB5471}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{23CBD69E-2876-4A20-996F-4230AD3E642A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23CBD69E-2876-4A20-996F-4230AD3E642A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23CBD69E-2876-4A20-996F-4230AD3E642A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23CBD69E-2876-4A20-996F-4230AD3E642A}.Release|Any CPU.Build.0 = Release|Any CPU
{EF001CCD-92F6-4A12-AC58-39CFF673A16B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EF001CCD-92F6-4A12-AC58-39CFF673A16B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF001CCD-92F6-4A12-AC58-39CFF673A16B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF001CCD-92F6-4A12-AC58-39CFF673A16B}.Release|Any CPU.Build.0 = Release|Any CPU
{A088FD57-FB19-46F5-9334-33D33FD6B388}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A088FD57-FB19-46F5-9334-33D33FD6B388}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A088FD57-FB19-46F5-9334-33D33FD6B388}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A088FD57-FB19-46F5-9334-33D33FD6B388}.Release|Any CPU.Build.0 = Release|Any CPU
{25C68FC9-1CA2-4D48-B02D-5CA6B42F51E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25C68FC9-1CA2-4D48-B02D-5CA6B42F51E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25C68FC9-1CA2-4D48-B02D-5CA6B42F51E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25C68FC9-1CA2-4D48-B02D-5CA6B42F51E2}.Release|Any CPU.Build.0 = Release|Any CPU
{D8029FF9-4EF1-479B-80FB-0AC04CBB5471}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D8029FF9-4EF1-479B-80FB-0AC04CBB5471}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D8029FF9-4EF1-479B-80FB-0AC04CBB5471}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D8029FF9-4EF1-479B-80FB-0AC04CBB5471}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8560DD17-BEB9-41F4-9FC5-FA6D16222CB6}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,36 @@
namespace Valova_VisualComponents
{
partial class ComponentDiagramToPdf
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@@ -0,0 +1,117 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MigraDoc.DocumentObjectModel;
using MigraDoc.DocumentObjectModel.Shapes;
using MigraDoc.DocumentObjectModel.Shapes.Charts;
using MigraDoc.DocumentObjectModel.Tables;
using MigraDoc.Rendering;
using Valova_VisualComponents.Helpers;
using Valova_VisualComponents.Models;
namespace Valova_VisualComponents
{
public partial class ComponentDiagramToPdf : Component
{
public ComponentDiagramToPdf()
{
InitializeComponent();
}
public ComponentDiagramToPdf(IContainer container)
{
container.Add(this);
InitializeComponent();
}
private Document _document;
private Chart _chart;
private Document Document
{
get
{
if (this._document == null)
{
this._document = new Document();
}
return this._document;
}
}
public void CreateHeader(string header)
{
var section = this.Document.AddSection();
var paragraph = section.AddParagraph(header);
paragraph.Format.Font.Color = Colors.Black;
paragraph.Format.Font.Bold = true;
}
private void ConfigChart(ComponentDiagramToPdfConfig config)
{
((Shape)this._chart).Width = Unit.FromCentimeter(16.0);
((Shape)this._chart).Height = Unit.FromCentimeter(12.0);
this._chart.TopArea.AddParagraph(config.ChartTitle);
this._chart.XAxis.MajorTickMark = (TickMarkType)2;
this._chart.YAxis.MajorTickMark = (TickMarkType)2;
this._chart.YAxis.HasMajorGridlines = true;
this._chart.PlotArea.LineFormat.Width = new Unit(1);
this._chart.PlotArea.LineFormat.Visible = true;
switch (config.LegendLocation)
{
case Location.Left:
this._chart.LeftArea.AddLegend();
break;
case Location.Rigth:
this._chart.RightArea.AddLegend();
break;
case Location.Top:
this._chart.TopArea.AddLegend();
break;
case Location.Bottom:
this._chart.BottomArea.AddLegend();
break;
}
}
public void CreateLineChart(ComponentDiagramToPdfConfig config)
{
this._chart = new Chart((ChartType)0);
foreach (string key in config.Data.Keys)
{
Series series = this._chart.SeriesCollection.AddSeries();
series.Name = key;
series.Add(config.Data[key].Select(x => x.Item2).ToArray());
}
this._chart.XValues.AddXSeries().Add(config.Data.First().Value.Select(x => x.Item1.ToString()).ToArray());
this.ConfigChart(config);
}
public void SaveDoc(string filepath)
{
if (filepath.IsEmpty())
throw new ArgumentNullException("Имя файла не задано");
if (this._document == null)
throw new ArgumentNullException("Документ не сформирован, сохранять нечего");
if (this._chart != null)
this._document.LastSection.Add(this._chart);
PdfDocumentRenderer documentRenderer = new PdfDocumentRenderer(true)
{
Document = this._document
};
documentRenderer.RenderDocument();
documentRenderer.PdfDocument.Save(filepath);
}
public void CreateDoc(ComponentDiagramToPdfConfig config)
{
config.CheckFields();
CreateHeader(config.Header);
CreateLineChart(config);
SaveDoc(config.FilePath);
}
}
}

View File

@@ -0,0 +1,36 @@
namespace Valova_VisualComponents
{
partial class ComponentTableToPdf
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@@ -0,0 +1,159 @@
using MigraDoc.DocumentObjectModel.Tables;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Valova_VisualComponents.Helpers;
using Valova_VisualComponents.Models;
using MigraDoc.DocumentObjectModel;
using MigraDoc.DocumentObjectModel.Shapes;
using MigraDoc.DocumentObjectModel.Shapes.Charts;
using MigraDoc.Rendering;
namespace Valova_VisualComponents
{
public partial class ComponentTableToPdf : Component
{
private Document _document;
private Table _table;
public ComponentTableToPdf()
{
InitializeComponent();
}
public ComponentTableToPdf(IContainer container)
{
container.Add(this);
InitializeComponent();
}
private Document Document
{
get
{
if (this._document == null)
{
this._document = new Document();
}
return this._document;
}
}
private Table Table
{
get
{
if (this._table == null)
this._table = new Table();
return this._table;
}
}
public void CreateHeader(string header)
{
var section = this.Document.AddSection();
var paragraph = section.AddParagraph(header);
paragraph.Format.Font.Color = Colors.Black;
paragraph.Format.Font.Bold = true;
}
public void CreateTableWithHeader() => this.Table.Borders.Width = new Unit(0.75);
private static void AddRowHeaderCellMergeByRows(int columnIndex, string header, Row row)
{
SetHeaderCell(columnIndex, header, row);
row.Cells[columnIndex].MergeDown = 1;
}
private static void SetHeaderCell(int columnIndex, string header, Row row)
{
row.Cells[columnIndex].AddParagraph(header);
row.Cells[columnIndex].Format.Font.Bold = true;
row.Cells[columnIndex].Format.Alignment = (ParagraphAlignment)1;
row.Cells[columnIndex].VerticalAlignment = (VerticalAlignment)1;
}
public void CreateRowHeader(ComponentDocumentWithTableHeaderConfig config)
{
foreach ((int Column, int Row) tuple in config.ColumnsRowsWidth)
this.Table.AddColumn(new Unit(tuple.Column * 5));
Row row1 = this.Table.AddRow();
Row row2 = this.Table.AddRow();
for (int i = 0; i < config.ColumnUnion[0].StartIndex; ++i)
AddRowHeaderCellMergeByRows(i, config.Headers.FirstOrDefault(x => x.Item1 == i).Item3, row1);
for (int i = 0; i < config.ColumnUnion.Count; i++)
{
SetHeaderCell(config.ColumnUnion[i].StartIndex, config.Headers.FirstOrDefault(x => x.Item1 == config.ColumnUnion[i].StartIndex && x.Item2 == 0).Item3, row1);
row1.Cells[config.ColumnUnion[i].StartIndex].MergeRight = config.ColumnUnion[i].Count - 1;
for (int j = config.ColumnUnion[i].StartIndex; j < config.ColumnUnion[i].StartIndex + config.ColumnUnion[i].Count; ++j)
SetHeaderCell(j, config.Headers.FirstOrDefault(x => x.Item1 == j && x.Item2 == 1).Item3, row2);
if (i < config.ColumnUnion.Count - 1)
{
for (int j = config.ColumnUnion[i].StartIndex + config.ColumnUnion[i].Count; j < config.ColumnUnion[i + 1].StartIndex; ++j)
AddRowHeaderCellMergeByRows(j, config.Headers.FirstOrDefault(x => x.Item1 == j).Item3, row1);
}
}
List<(int StartIndex, int Count)> columnUnion1 = config.ColumnUnion;
int startIndex = columnUnion1[columnUnion1.Count - 1].StartIndex;
List<(int StartIndex, int Count)> columnUnion2 = config.ColumnUnion;
int count = columnUnion2[columnUnion2.Count - 1].Count;
int num = startIndex + count;
for (int i = num; i < config.ColumnsRowsWidth.Count; ++i)
AddRowHeaderCellMergeByRows(i, config.Headers.FirstOrDefault(x => x.Item1 == i).Item3, row1);
}
public void LoadDataToTableWithRowHeader(string[,] data)
{
for (int index1 = 0; index1 < data.GetLength(0); ++index1)
{
Row row = this.Table.AddRow();
for (int index2 = 0; index2 < data.GetLength(1); ++index2)
row.Cells[index2].AddParagraph(data[index1, index2]);
}
}
public void SaveDoc(string filepath)
{
if (filepath.IsEmpty())
throw new ArgumentNullException("Имя файла не задано");
if (this._document == null)
throw new ArgumentNullException("Документ не сформирован, сохранять нечего");
if (this._table != null)
this._document.LastSection.Add(this._table);
PdfDocumentRenderer documentRenderer = new PdfDocumentRenderer(true)
{
Document = this._document
};
documentRenderer.RenderDocument();
documentRenderer.PdfDocument.Save(filepath);
}
public void CreateDoc<T>(ComponentTableToPdfConfig<T> config)
{
config.CheckFields();
config.ColumnsRowsDataCount = (config.ColumnsRowsWidth.Count, config.Data.Count + 2);
CreateHeader(config.Header);
CreateTableWithHeader();
CreateRowHeader(config);
string[,] array = new string[config.Data.Count, config.ColumnsRowsWidth.Count];
for (int j = 0; j < config.Data.Count; j++)
{
int i;
for (i = 0; i < config.ColumnsRowsWidth.Count; i++)
{
(int, int, string, string) tuple = config.Headers.FirstOrDefault<(int, int, string, string)>(((int ColumnIndex, int RowIndex, string Header, string PropertyName) x) => x.ColumnIndex == i && x.RowIndex == 1);
if (tuple.Equals(default((int, int, string, string))))
{
tuple = config.Headers.FirstOrDefault<(int, int, string, string)>(((int ColumnIndex, int RowIndex, string Header, string PropertyName) x) => x.ColumnIndex == i && x.RowIndex == 0);
}
array[j, i] = config.Data[j].GetType().GetProperty(tuple.Item4)!.GetValue(config.Data[j], null)!.ToString();
}
}
LoadDataToTableWithRowHeader(array);
SaveDoc(config.FilePath);
}
}
}

View File

@@ -0,0 +1,36 @@
namespace Valova_VisualComponents
{
partial class ComponentTextToPdf
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MigraDoc.DocumentObjectModel;
using MigraDoc.DocumentObjectModel.Shapes;
using MigraDoc.DocumentObjectModel.Shapes.Charts;
using MigraDoc.DocumentObjectModel.Tables;
using MigraDoc.Rendering;
using Valova_VisualComponents.Models;
namespace Valova_VisualComponents
{
public partial class ComponentTextToPdf : Component
{
private Document _document;
public ComponentTextToPdf()
{
InitializeComponent();
}
public ComponentTextToPdf(IContainer container)
{
container.Add(this);
InitializeComponent();
}
private Document Document
{
get
{
if (_document == null)
{
_document = new Document();
}
return _document;
}
}
public void SaveDoc(string filepath)
{
if (filepath == null)
throw new ArgumentNullException("Имя файла не задано");
if (this._document == null)
throw new ArgumentNullException("Документ не сформирован");
PdfDocumentRenderer documentRenderer = new PdfDocumentRenderer(true)
{
Document = this._document
};
documentRenderer.RenderDocument();
documentRenderer.PdfDocument.Save(filepath);
}
public void CreateDoc(ComponentTextToPdfConfig config)
{
CreateHeader(config.Header);
foreach (string paragraph in config.Paragraphs)
{
CreateParagraph(paragraph);
}
SaveDoc(config.FilePath);
}
public void CreateHeader(string header)
{
var section = this.Document.AddSection();
var paragraph = section.AddParagraph(header);
paragraph.Format.Font.Color = Colors.Black;
paragraph.Format.Font.Size = 30;
paragraph.Format.Font.Bold = true;
}
public void CreateParagraph(string text) => this.Document.LastSection.AddParagraph(text, "Normal");
}
}

View File

@@ -0,0 +1,166 @@
using Valova_VisualComponents.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace Valova_VisualComponents.Helpers
{
public static class ExtensionConfig
{
public static void CheckFields(this ComponentDocumentConfig config)
{
if (config.FilePath.IsEmpty())
{
throw new ArgumentNullException("Имя файла не задано");
}
if (config.Header.IsEmpty())
{
throw new ArgumentNullException("Заголовок документа не задан");
}
}
public static void CheckFields(this ComponentTextToPdfConfig config)
{
if (config.Header.IsEmpty() || config.FilePath.IsEmpty() || (config.Paragraphs != null && config.Paragraphs.Count == 0) || (config.Paragraphs != null && config.Paragraphs.All((string x) => x.IsEmpty())))
{
throw new ArgumentNullException("Нет текста для вставки в документ");
}
}
public static void CheckFields<T>(this ComponentTableToPdfConfig<T> config)
{
ComponentTableToPdfConfig<T> config2 = config;
((ComponentDocumentConfig)config2).CheckFields();
if (config2.ColumnsRowsWidth == null || config2.ColumnsRowsWidth.Count == 0)
{
throw new ArgumentNullException("Нет данных по ширине колонок таблицы");
}
if (config2.UseUnion && (config2.ColumnUnion == null || config2.ColumnUnion.Count == 0))
{
throw new ArgumentNullException("Нет данных по объединению колонок таблицы");
}
if (config2.Headers == null || config2.Headers.Count == 0 || config2.Headers.Any<(int, int, string, string)>(((int ColumnIndex, int RowIndex, string Header, string PropertyName) x) => x.Header.IsEmpty()))
{
throw new ArgumentNullException("Нет данных по заголовкам таблицы");
}
if (config2.Data == null || config2.Data.Count == 0)
{
throw new ArgumentNullException("Нет данных для заполнения таблицы");
}
if (!config2.UseUnion)
{
return;
}
if (config2.ColumnsRowsWidth.Count < config2.ColumnUnion[config2.ColumnUnion.Count - 1].StartIndex + config2.ColumnUnion[config2.ColumnUnion.Count - 1].Count - 1)
{
throw new IndexOutOfRangeException("Последнее объединение ячеек выходит за границы таблицы");
}
int k;
for (k = 0; k < config2.ColumnUnion[0].StartIndex; k++)
{
int num = config2.Headers.Where<(int, int, string, string)>(((int ColumnIndex, int RowIndex, string Header, string PropertyName) x) => x.ColumnIndex == k).Count();
if (num == 0)
{
DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(34, 1);
defaultInterpolatedStringHandler.AppendLiteral("Для ");
defaultInterpolatedStringHandler.AppendFormatted(k);
defaultInterpolatedStringHandler.AppendLiteral(" колонки отсутствует заголовок");
throw new ArgumentNullException(defaultInterpolatedStringHandler.ToStringAndClear());
}
if (num > 1)
{
DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(37, 1);
defaultInterpolatedStringHandler.AppendLiteral("Для ");
defaultInterpolatedStringHandler.AppendFormatted(k);
defaultInterpolatedStringHandler.AppendLiteral(" колонки задано более 1 заголовка");
throw new ArgumentNullException(defaultInterpolatedStringHandler.ToStringAndClear());
}
}
int j;
for (j = 0; j < config2.ColumnUnion.Count; j++)
{
if (j < config2.ColumnUnion.Count - 1 && config2.ColumnUnion[j].StartIndex + config2.ColumnUnion[j].Count - 1 > config2.ColumnUnion[j + 1].StartIndex)
{
throw new IndexOutOfRangeException("Имеется накладка в объединении ячеек");
}
int num2 = config2.Headers.Where<(int, int, string, string)>(((int ColumnIndex, int RowIndex, string Header, string PropertyName) x) => x.ColumnIndex >= config2.ColumnUnion[j].StartIndex && x.ColumnIndex <= config2.ColumnUnion[j].StartIndex + config2.ColumnUnion[j].Count - 1 && x.RowIndex == 0).Count();
if (num2 == 0)
{
throw new ArgumentNullException("Для колонок 0 строки отсутствует заголовок");
}
if (num2 > 1)
{
throw new ArgumentNullException("Для колонок 0 строки задано более 1 заголовка");
}
num2 = config2.Headers.Where<(int, int, string, string)>(((int ColumnIndex, int RowIndex, string Header, string PropertyName) x) => x.ColumnIndex >= config2.ColumnUnion[j].StartIndex && x.ColumnIndex <= config2.ColumnUnion[j].StartIndex + config2.ColumnUnion[j].Count - 1 && x.RowIndex == 1).Count();
if (num2 < config2.ColumnUnion[j].Count)
{
throw new ArgumentNullException("Для колонок 1 строки не хватает заголовков");
}
if (num2 > config2.ColumnUnion[j].Count)
{
throw new ArgumentNullException("Для колонок 1 строки задано более требуемого числа заголовков");
}
if (j < config2.ColumnUnion.Count - 1)
{
num2 = config2.Headers.Where<(int, int, string, string)>(((int ColumnIndex, int RowIndex, string Header, string PropertyName) x) => x.ColumnIndex >= config2.ColumnUnion[j].StartIndex + config2.ColumnUnion[j].Count && x.ColumnIndex < config2.ColumnUnion[j + 1].StartIndex && x.RowIndex == 0).Count();
if (num2 < config2.ColumnUnion[j + 1].StartIndex - (config2.ColumnUnion[j].StartIndex + config2.ColumnUnion[j].Count))
{
throw new ArgumentNullException("Для колонок не хватает заголовков");
}
if (num2 > config2.ColumnUnion[j + 1].StartIndex - (config2.ColumnUnion[j].StartIndex + config2.ColumnUnion[j].Count))
{
throw new ArgumentNullException("Для колонок задано более требуемого числа заголовков");
}
num2 = config2.Headers.Where<(int, int, string, string)>(((int ColumnIndex, int RowIndex, string Header, string PropertyName) x) => x.ColumnIndex >= config2.ColumnUnion[j].StartIndex + config2.ColumnUnion[j].Count && x.ColumnIndex < config2.ColumnUnion[j + 1].StartIndex && x.RowIndex == 1).Count();
if (num2 > 0)
{
throw new ArgumentNullException("Для колонок заданы заголовки 2 уровня, чего быть не должно");
}
}
}
int i;
for (i = config2.ColumnUnion[config2.ColumnUnion.Count - 1].StartIndex + config2.ColumnUnion[config2.ColumnUnion.Count - 1].Count; i < config2.ColumnsRowsWidth.Count; i++)
{
int num3 = config2.Headers.Where<(int, int, string, string)>(((int ColumnIndex, int RowIndex, string Header, string PropertyName) x) => x.ColumnIndex == i).Count();
if (num3 == 0)
{
DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(34, 1);
defaultInterpolatedStringHandler.AppendLiteral("Для ");
defaultInterpolatedStringHandler.AppendFormatted(i);
defaultInterpolatedStringHandler.AppendLiteral(" колонки отсутствует заголовок");
throw new ArgumentNullException(defaultInterpolatedStringHandler.ToStringAndClear());
}
if (num3 > 1)
{
DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(37, 1);
defaultInterpolatedStringHandler.AppendLiteral("Для ");
defaultInterpolatedStringHandler.AppendFormatted(i);
defaultInterpolatedStringHandler.AppendLiteral(" колонки задано более 1 заголовка");
throw new ArgumentNullException(defaultInterpolatedStringHandler.ToStringAndClear());
}
}
}
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Valova_VisualComponents.Helpers
{
public static class ExtensionString
{
public static bool HaveText(this string str)
{
return !string.IsNullOrEmpty(str);
}
public static bool IsEmpty(this string str)
{
return string.IsNullOrEmpty(str);
}
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Valova_VisualComponents
{
public class InvalidLayoutException : ApplicationException
{
public InvalidLayoutException() : base("Значение не соответсвует шаблону") { }
public InvalidLayoutException(string message) : base(message) { }
public InvalidLayoutException(string message, Exception exception) : base(message, exception) { }
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Valova_VisualComponents.Models
{
public class ComponentDiagramToPdfConfig : ComponentDocumentConfig
{
public string ChartTitle
{
get;
set;
}
public Location LegendLocation
{
get;
set;
}
public Dictionary<string, List<(string Name, double Value)>> Data
{
get;
set;
}
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Valova_VisualComponents.Models
{
public class ComponentDocumentConfig
{
public string FilePath
{
get;
set;
}
public string Header
{
get;
set;
}
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Valova_VisualComponents.Models
{
public class ComponentDocumentWithTableHeaderConfig : ComponentDocumentConfig
{
public bool UseUnion { get; set; }
public (int Columns, int Rows) ColumnsRowsDataCount { get; set; }
public List<(int Column, int Row)> ColumnsRowsWidth { get; set; }
public List<(int StartIndex, int Count)> ColumnUnion { get; set; }
public List<(int ColumnIndex, int RowIndex, string Header, string PropertyName)> Headers { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Valova_VisualComponents.Models
{
public class ComponentTableToPdfConfig<T> : ComponentDocumentWithTableHeaderConfig
{
public List<T> Data
{
get;
set;
}
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Valova_VisualComponents.Models
{
public class ComponentTextToPdfConfig : ComponentDocumentConfig
{
public List<string> Paragraphs
{
get;
set;
}
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Valova_VisualComponents.Models
{
public enum Location
{
Left,
Rigth,
Top,
Bottom
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Valova_VisualComponents
{
public class PatternNotSetException : ApplicationException
{
public PatternNotSetException() : base("Шаблон не задан") { }
public PatternNotSetException(string message) : base(message) { }
public PatternNotSetException(string message, Exception exception) : base(message, exception) { }
}
}

View File

@@ -0,0 +1,57 @@
namespace Valova_VisualComponents
{
partial class customComboBox
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
comboBox = new ComboBox();
SuspendLayout();
//
// comboBox
//
comboBox.FormattingEnabled = true;
comboBox.Location = new Point(3, 3);
comboBox.Name = "comboBox";
comboBox.Size = new Size(144, 23);
comboBox.TabIndex = 0;
comboBox.SelectedIndexChanged += comboBox_SelectedIndexChanged;
//
// customComboBox
//
BorderStyle = BorderStyle.FixedSingle;
Controls.Add(comboBox);
Name = "customComboBox";
Size = new Size(148, 148);
ResumeLayout(false);
}
#endregion
private ComboBox comboBox;
}
}

View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Valova_VisualComponents
{
public partial class customComboBox : UserControl
{
public ComboBox.ObjectCollection Items => comboBox.Items;
public event EventHandler _сhangeEvent;
public event EventHandler ChangeEvent
{
add
{
_сhangeEvent += value;
}
remove
{
_сhangeEvent -= value;
}
}
public customComboBox()
{
InitializeComponent();
}
public string SelectedValue
{
get
{
return comboBox.SelectedItem.ToString() ?? string.Empty;
}
set
{
comboBox.SelectedIndex = comboBox.Items.IndexOf(value);
}
}
public void Clear()
{
Items.Clear();
}
private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
{
_сhangeEvent?.Invoke(this, e);
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,58 @@
namespace Valova_VisualComponents
{
partial class customListBox
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
listBox = new ListBox();
SuspendLayout();
//
// listBox
//
listBox.FormattingEnabled = true;
listBox.ItemHeight = 15;
listBox.Location = new Point(2, 11);
listBox.Name = "listBox";
listBox.Size = new Size(314, 109);
listBox.TabIndex = 0;
//
// customListBox
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BorderStyle = BorderStyle.FixedSingle;
Controls.Add(listBox);
Name = "customListBox";
Size = new Size(319, 148);
ResumeLayout(false);
}
#endregion
private ListBox listBox;
}
}

View File

@@ -0,0 +1,113 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Valova_VisualComponents
{
public partial class customListBox : UserControl
{
private string LayoutString;
private string StartS;
private string EndS;
private int SelectedStr;
public customListBox()
{
InitializeComponent();
}
public int SelectedIndex
{
get
{
if (listBox.SelectedIndex == -1)
{
return -1;
}
return listBox.SelectedIndex;
}
set
{
if (listBox.Items.Count != 0)
{
listBox.SelectedIndex = value;
}
}
}
public void SetLayout(string layoutString, string startS, string endS)
{
if (layoutString == null || startS == null || endS == null) return;
LayoutString = layoutString;
StartS = startS;
EndS = endS;
}
public void AddItemInList<T>(T obj, int rowIndex, string propertyName)
{
if (obj == null)
{
throw new ArgumentNullException();
}
if (listBox.Items.Count <= rowIndex)
{
for (int i = listBox.Items.Count; i <= rowIndex; i++)
{
listBox.Items.Add(LayoutString);
}
}
string str = listBox.Items[rowIndex].ToString();
var properties = obj.GetType().GetProperties();
var prop = properties.FirstOrDefault(p => p.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase));
if (prop != null)
{
string str1 = $"{StartS}{prop.Name}{EndS}";
str = str.Replace(str1, $"{StartS}{prop.GetValue(obj)?.ToString()}{EndS}");
}
else
{
throw new ArgumentException($"Свойство с именем '{propertyName}' не найдено в объекте.");
}
listBox.Items[rowIndex] = str;
}
public T GetItemFromList<T>() where T : class, new()
{
string SelectedStr = "";
if (listBox.SelectedIndex != -1)
{
SelectedStr = listBox.SelectedItem.ToString();
}
T currentObject = new T();
foreach (var prop in typeof(T).GetProperties())
{
if (!prop.CanWrite)
{
continue;
}
int startS = SelectedStr.IndexOf(StartS);
int endS = SelectedStr.IndexOf(EndS);
if (startS == -1 || endS == -1)
{
break;
}
string propValue = SelectedStr.Substring(startS + 1, endS - startS - 1);
SelectedStr = SelectedStr.Substring(endS + 1);
prop.SetValue(currentObject, Convert.ChangeType(propValue, prop.PropertyType));
}
return currentObject;
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,59 @@
namespace Valova_VisualComponents
{
partial class customTextBox
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
textBox = new TextBox();
SuspendLayout();
//
// textBox
//
textBox.Location = new Point(-1, 18);
textBox.Name = "textBox";
textBox.Size = new Size(161, 23);
textBox.TabIndex = 0;
textBox.TextChanged += textBox_TextChanged;
textBox.Enter += textBox_Enter;
//
// customTextBox
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BorderStyle = BorderStyle.FixedSingle;
Controls.Add(textBox);
Name = "customTextBox";
Size = new Size(159, 146);
ResumeLayout(false);
PerformLayout();
}
#endregion
private TextBox textBox;
}
}

View File

@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Valova_VisualComponents
{
public partial class customTextBox : UserControl
{
private string? pattern;
private string example = "+7(XXX)XXX-XX-XX";
public customTextBox()
{
InitializeComponent();
}
public string? Pattern
{
get { return pattern; }
set { pattern = value; }
}
public string TextBoxValue
{
get
{
if (string.IsNullOrEmpty(Pattern))
throw new PatternNotSetException();
Regex regex = new Regex(Pattern);
bool isValid = regex.IsMatch(textBox.Text);
if (isValid)
{
return textBox.Text;
}
else throw new InvalidLayoutException();
}
set
{
Regex regex = new Regex(Pattern);
bool isValid = regex.IsMatch(value);
if (isValid)
{
textBox.Text = value;
}
else
{
Error = "Неправильно";
}
}
}
public string Error
{
get; private set;
}
public void SetExample(string exampleStr)
{
Regex regex = new Regex(Pattern);
bool isValid = regex.IsMatch(exampleStr);
if (isValid)
{
example = exampleStr;
}
}
private void textBox_Enter(object sender, EventArgs e)
{
ToolTip tt = new ToolTip();
tt.Show(example, textBox, 20, -21, 2000);
}
private void textBox_TextChanged(object sender, EventArgs e)
{
_changeEvent?.Invoke(sender, e);
}
private EventHandler _changeEvent;
public event EventHandler ChangeEvent
{
add
{
_changeEvent += value;
}
remove
{
_changeEvent -= value;
}
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.12" />
</ItemGroup>
</Project>