Initial commit
This commit is contained in:
commit
13d3b1c1b2
400
.gitignore
vendored
Normal file
400
.gitignore
vendored
Normal file
@ -0,0 +1,400 @@
|
|||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
##
|
||||||
|
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.rsuser
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Mono auto generated files
|
||||||
|
mono_crash.*
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
[Ww][Ii][Nn]32/
|
||||||
|
[Aa][Rr][Mm]/
|
||||||
|
[Aa][Rr][Mm]64/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
[Ll]ogs/
|
||||||
|
[Bb]inaries/
|
||||||
|
[Ii]ntermediate/
|
||||||
|
|
||||||
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# Visual Studio 2017 auto generated files
|
||||||
|
Generated\ Files/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUnit
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
nunit-*.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# Benchmark Results
|
||||||
|
BenchmarkDotNet.Artifacts/
|
||||||
|
|
||||||
|
# .NET Core
|
||||||
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
# ASP.NET Scaffolding
|
||||||
|
ScaffoldingReadMe.txt
|
||||||
|
|
||||||
|
# StyleCop
|
||||||
|
StyleCopReport.xml
|
||||||
|
|
||||||
|
# Files built by Visual Studio
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_h.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.iobj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.ipdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*_wpftmp.csproj
|
||||||
|
*.log
|
||||||
|
*.tlog
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# Visual Studio Trace Files
|
||||||
|
*.e2e
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# AxoCover is a Code Coverage Tool
|
||||||
|
.axoCover/*
|
||||||
|
!.axoCover/settings.json
|
||||||
|
|
||||||
|
# Coverlet is a free, cross platform Code Coverage Tool
|
||||||
|
coverage*.json
|
||||||
|
coverage*.xml
|
||||||
|
coverage*.info
|
||||||
|
|
||||||
|
# Visual Studio code coverage results
|
||||||
|
*.coverage
|
||||||
|
*.coveragexml
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# NuGet Symbol Packages
|
||||||
|
*.snupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/[Pp]ackages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/[Pp]ackages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/[Pp]ackages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
*.appx
|
||||||
|
*.appxbundle
|
||||||
|
*.appxupload
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!?*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Including strong name files can present a security risk
|
||||||
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||||
|
#*.snk
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
ServiceFabricBackup/
|
||||||
|
*.rptproj.bak
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
*.ndf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
*.rptproj.rsuser
|
||||||
|
*- [Bb]ackup.rdl
|
||||||
|
*- [Bb]ackup ([0-9]).rdl
|
||||||
|
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
|
*.vbw
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
||||||
|
*.vbp
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||||
|
*.dsw
|
||||||
|
*.dsp
|
||||||
|
|
||||||
|
# Visual Studio 6 technical files
|
||||||
|
*.ncb
|
||||||
|
*.aps
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# CodeRush personal settings
|
||||||
|
.cr/personal
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Cake - Uncomment if you are using it
|
||||||
|
# tools/**
|
||||||
|
# !tools/packages.config
|
||||||
|
|
||||||
|
# Tabs Studio
|
||||||
|
*.tss
|
||||||
|
|
||||||
|
# Telerik's JustMock configuration file
|
||||||
|
*.jmconfig
|
||||||
|
|
||||||
|
# BizTalk build output
|
||||||
|
*.btp.cs
|
||||||
|
*.btm.cs
|
||||||
|
*.odx.cs
|
||||||
|
*.xsd.cs
|
||||||
|
|
||||||
|
# OpenCover UI analysis results
|
||||||
|
OpenCover/
|
||||||
|
|
||||||
|
# Azure Stream Analytics local run output
|
||||||
|
ASALocalRun/
|
||||||
|
|
||||||
|
# MSBuild Binary and Structured Log
|
||||||
|
*.binlog
|
||||||
|
|
||||||
|
# NVidia Nsight GPU debugger configuration file
|
||||||
|
*.nvuser
|
||||||
|
|
||||||
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
|
.mfractor/
|
||||||
|
|
||||||
|
# Local History for Visual Studio
|
||||||
|
.localhistory/
|
||||||
|
|
||||||
|
# Visual Studio History (VSHistory) files
|
||||||
|
.vshistory/
|
||||||
|
|
||||||
|
# BeatPulse healthcheck temp database
|
||||||
|
healthchecksdb
|
||||||
|
|
||||||
|
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||||
|
MigrationBackup/
|
||||||
|
|
||||||
|
# Ionide (cross platform F# VS Code tools) working folder
|
||||||
|
.ionide/
|
||||||
|
|
||||||
|
# Fody - auto-generated XML schema
|
||||||
|
FodyWeavers.xsd
|
||||||
|
|
||||||
|
# VS Code files for those working on multiple tools
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
*.code-workspace
|
||||||
|
|
||||||
|
# Local History for Visual Studio Code
|
||||||
|
.history/
|
||||||
|
|
||||||
|
# Windows Installer files from build outputs
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msix
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# JetBrains Rider
|
||||||
|
*.sln.iml
|
163
FormsTesting/Form1.Designer.cs
generated
Normal file
163
FormsTesting/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,163 @@
|
|||||||
|
namespace FormsTesting
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
SelectComponent = new ShabComponentsLibrary.ShabSelectComponent();
|
||||||
|
InputComponent = new ShabComponentsLibrary.ShabInputComponent();
|
||||||
|
GridComponent = new ShabComponentsLibrary.ShabListOutputComponent();
|
||||||
|
groupBox1 = new GroupBox();
|
||||||
|
ClearListButton = new Button();
|
||||||
|
groupBox2 = new GroupBox();
|
||||||
|
ShowIntButton = new Button();
|
||||||
|
groupBox3 = new GroupBox();
|
||||||
|
PrintObjectButton = new Button();
|
||||||
|
groupBox1.SuspendLayout();
|
||||||
|
groupBox2.SuspendLayout();
|
||||||
|
groupBox3.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// SelectComponent
|
||||||
|
//
|
||||||
|
SelectComponent.Location = new Point(6, 22);
|
||||||
|
SelectComponent.Margin = new Padding(0);
|
||||||
|
SelectComponent.Name = "SelectComponent";
|
||||||
|
SelectComponent.SelectedItem = "";
|
||||||
|
SelectComponent.Size = new Size(200, 86);
|
||||||
|
SelectComponent.TabIndex = 0;
|
||||||
|
SelectComponent.ItemSelected += SelectComponent_ItemSelected;
|
||||||
|
//
|
||||||
|
// InputComponent
|
||||||
|
//
|
||||||
|
InputComponent.Location = new Point(6, 22);
|
||||||
|
InputComponent.Margin = new Padding(0);
|
||||||
|
InputComponent.Name = "InputComponent";
|
||||||
|
InputComponent.Size = new Size(182, 30);
|
||||||
|
InputComponent.TabIndex = 1;
|
||||||
|
InputComponent.ValueChanged += InputComponent_ValueChanged;
|
||||||
|
//
|
||||||
|
// GridComponent
|
||||||
|
//
|
||||||
|
GridComponent.Location = new Point(6, 22);
|
||||||
|
GridComponent.Name = "GridComponent";
|
||||||
|
GridComponent.SelectedRow = -1;
|
||||||
|
GridComponent.Size = new Size(505, 213);
|
||||||
|
GridComponent.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// groupBox1
|
||||||
|
//
|
||||||
|
groupBox1.Controls.Add(ClearListButton);
|
||||||
|
groupBox1.Controls.Add(SelectComponent);
|
||||||
|
groupBox1.Location = new Point(12, 12);
|
||||||
|
groupBox1.Name = "groupBox1";
|
||||||
|
groupBox1.Size = new Size(407, 113);
|
||||||
|
groupBox1.TabIndex = 3;
|
||||||
|
groupBox1.TabStop = false;
|
||||||
|
groupBox1.Text = "Компонент выбора";
|
||||||
|
//
|
||||||
|
// ClearListButton
|
||||||
|
//
|
||||||
|
ClearListButton.Location = new Point(215, 38);
|
||||||
|
ClearListButton.Name = "ClearListButton";
|
||||||
|
ClearListButton.Size = new Size(107, 48);
|
||||||
|
ClearListButton.TabIndex = 1;
|
||||||
|
ClearListButton.Text = "Очистить";
|
||||||
|
ClearListButton.UseVisualStyleBackColor = true;
|
||||||
|
ClearListButton.Click += ClearListButton_Click;
|
||||||
|
//
|
||||||
|
// groupBox2
|
||||||
|
//
|
||||||
|
groupBox2.Controls.Add(ShowIntButton);
|
||||||
|
groupBox2.Controls.Add(InputComponent);
|
||||||
|
groupBox2.Location = new Point(12, 143);
|
||||||
|
groupBox2.Name = "groupBox2";
|
||||||
|
groupBox2.Size = new Size(293, 100);
|
||||||
|
groupBox2.TabIndex = 4;
|
||||||
|
groupBox2.TabStop = false;
|
||||||
|
groupBox2.Text = "Компонент ввода";
|
||||||
|
//
|
||||||
|
// ShowIntButton
|
||||||
|
//
|
||||||
|
ShowIntButton.Location = new Point(6, 58);
|
||||||
|
ShowIntButton.Name = "ShowIntButton";
|
||||||
|
ShowIntButton.Size = new Size(172, 36);
|
||||||
|
ShowIntButton.TabIndex = 2;
|
||||||
|
ShowIntButton.Text = "Вывести на экран";
|
||||||
|
ShowIntButton.UseVisualStyleBackColor = true;
|
||||||
|
ShowIntButton.Click += ShowIntButton_Click;
|
||||||
|
//
|
||||||
|
// groupBox3
|
||||||
|
//
|
||||||
|
groupBox3.Controls.Add(PrintObjectButton);
|
||||||
|
groupBox3.Controls.Add(GridComponent);
|
||||||
|
groupBox3.Location = new Point(12, 260);
|
||||||
|
groupBox3.Name = "groupBox3";
|
||||||
|
groupBox3.Size = new Size(517, 280);
|
||||||
|
groupBox3.TabIndex = 5;
|
||||||
|
groupBox3.TabStop = false;
|
||||||
|
groupBox3.Text = "Компонент вывода списков";
|
||||||
|
//
|
||||||
|
// PrintObjectButton
|
||||||
|
//
|
||||||
|
PrintObjectButton.Location = new Point(6, 241);
|
||||||
|
PrintObjectButton.Name = "PrintObjectButton";
|
||||||
|
PrintObjectButton.Size = new Size(182, 33);
|
||||||
|
PrintObjectButton.TabIndex = 3;
|
||||||
|
PrintObjectButton.Text = "Вывести выбранный объект";
|
||||||
|
PrintObjectButton.UseVisualStyleBackColor = true;
|
||||||
|
PrintObjectButton.Click += PrintObjectButton_Click;
|
||||||
|
//
|
||||||
|
// Form1
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(637, 581);
|
||||||
|
Controls.Add(groupBox3);
|
||||||
|
Controls.Add(groupBox2);
|
||||||
|
Controls.Add(groupBox1);
|
||||||
|
Name = "Form1";
|
||||||
|
Text = "Тест компонентов";
|
||||||
|
groupBox1.ResumeLayout(false);
|
||||||
|
groupBox2.ResumeLayout(false);
|
||||||
|
groupBox3.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ShabComponentsLibrary.ShabSelectComponent SelectComponent;
|
||||||
|
private ShabComponentsLibrary.ShabInputComponent InputComponent;
|
||||||
|
private ShabComponentsLibrary.ShabListOutputComponent GridComponent;
|
||||||
|
private GroupBox groupBox1;
|
||||||
|
private Button ClearListButton;
|
||||||
|
private GroupBox groupBox2;
|
||||||
|
private Button ShowIntButton;
|
||||||
|
private GroupBox groupBox3;
|
||||||
|
private Button PrintObjectButton;
|
||||||
|
}
|
||||||
|
}
|
101
FormsTesting/Form1.cs
Normal file
101
FormsTesting/Form1.cs
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
using ShabComponentsLibrary;
|
||||||
|
using ShabComponentsLibrary.Exceptions;
|
||||||
|
|
||||||
|
namespace FormsTesting
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
InitializeSelectComponent();
|
||||||
|
InitializeInputComponent();
|
||||||
|
InitializeGridComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeSelectComponent()
|
||||||
|
{
|
||||||
|
SelectComponent.SetItems(new List<string>
|
||||||
|
{
|
||||||
|
"Çíà÷åíèå 1",
|
||||||
|
"Çíà÷åíèå 2",
|
||||||
|
"Çíà÷åíèå 3",
|
||||||
|
"Çíà÷åíèå 4",
|
||||||
|
"Çíà÷åíèå 5",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeInputComponent()
|
||||||
|
{
|
||||||
|
InputComponent.IntValue = 1848;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitializeGridComponent()
|
||||||
|
{
|
||||||
|
GridComponent.ConfigureColumns(new List<ColumnInfo>
|
||||||
|
{
|
||||||
|
new ColumnInfo("", 0, false, "Id"),
|
||||||
|
new ColumnInfo("Ôàìèëèÿ", 150, true, "LastName"),
|
||||||
|
new ColumnInfo("Èìÿ", 150, true, "FirstName"),
|
||||||
|
new ColumnInfo("Âîçðàñò", 100, true, "Age"),
|
||||||
|
});
|
||||||
|
|
||||||
|
List<TestPerson> Persons = new List<TestPerson>
|
||||||
|
{
|
||||||
|
new TestPerson(1, "Èâàí", "Èâàíîâ", 34),
|
||||||
|
new TestPerson(2, "Ïåòð", "Ïåòðîâ", 44),
|
||||||
|
new TestPerson(3, "Ñåðãåé", "Ñåðãååâ", 55),
|
||||||
|
new TestPerson(4, "Îëüãà", "Èâàíîâà", 34),
|
||||||
|
new TestPerson(5, "Òàòüÿíà", "Ïåòðîâà", 44),
|
||||||
|
};
|
||||||
|
|
||||||
|
GridComponent.InsertValues(Persons);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectComponent_ItemSelected(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
MessageBox.Show(SelectComponent.SelectedItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InputComponent_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClearListButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SelectComponent.ClearList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowIntButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int? Value = InputComponent.IntValue;
|
||||||
|
if (Value != null)
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Ââåäåííîå ÷èñëî: {Value}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Çíà÷åíèå - null");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (MalformedIntegralException ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
}
|
||||||
|
catch (EmptyValueException ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PrintObjectButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var Test = GridComponent.GetSelectedObject<TestPerson>();
|
||||||
|
MessageBox.Show(Test.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
FormsTesting/Form1.resx
Normal file
120
FormsTesting/Form1.resx
Normal 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>
|
15
FormsTesting/FormsTesting.csproj
Normal file
15
FormsTesting/FormsTesting.csproj
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ShabComponentsLibrary\ShabComponentsLibrary.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
17
FormsTesting/Program.cs
Normal file
17
FormsTesting/Program.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
namespace FormsTesting
|
||||||
|
{
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
FormsTesting/TestPerson.cs
Normal file
29
FormsTesting/TestPerson.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
namespace ShabComponentsLibrary
|
||||||
|
{
|
||||||
|
public class TestPerson
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string FirstName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string LastName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Age { get; set; }
|
||||||
|
|
||||||
|
public TestPerson()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
public TestPerson(int Id, string FirstName, string LastName, int Age)
|
||||||
|
{
|
||||||
|
this.Id = Id;
|
||||||
|
this.FirstName = FirstName;
|
||||||
|
this.LastName = LastName;
|
||||||
|
this.Age = Age;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"[{Id}] {FirstName} {LastName}. Возраст: {Age}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
README.md
Normal file
6
README.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Компонентно-ориентированное программирование
|
||||||
|
Библиотека компонентов.
|
||||||
|
Вариант 21.
|
||||||
|
|
||||||
|
*Автор: Шабунов Олег, ПИбд-32*
|
||||||
|
|
31
ShabComponentsLibrary.sln
Normal file
31
ShabComponentsLibrary.sln
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.8.34511.84
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShabComponentsLibrary", "ShabComponentsLibrary\ShabComponentsLibrary.csproj", "{DB0A9BE4-E285-413E-88B0-7D70261702D6}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormsTesting", "FormsTesting\FormsTesting.csproj", "{6AE149F2-88C0-42BE-A198-2B59A4280B2D}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{DB0A9BE4-E285-413E-88B0-7D70261702D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{DB0A9BE4-E285-413E-88B0-7D70261702D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{DB0A9BE4-E285-413E-88B0-7D70261702D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{DB0A9BE4-E285-413E-88B0-7D70261702D6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{6AE149F2-88C0-42BE-A198-2B59A4280B2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{6AE149F2-88C0-42BE-A198-2B59A4280B2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{6AE149F2-88C0-42BE-A198-2B59A4280B2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{6AE149F2-88C0-42BE-A198-2B59A4280B2D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {01C6DE7D-113E-47E6-8C9E-E570FE377AD4}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
21
ShabComponentsLibrary/ColumnInfo.cs
Normal file
21
ShabComponentsLibrary/ColumnInfo.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
namespace ShabComponentsLibrary
|
||||||
|
{
|
||||||
|
public class ColumnInfo
|
||||||
|
{
|
||||||
|
public string Header = string.Empty;
|
||||||
|
|
||||||
|
public int Width;
|
||||||
|
|
||||||
|
public bool IsVisible;
|
||||||
|
|
||||||
|
public string Name = string.Empty;
|
||||||
|
|
||||||
|
public ColumnInfo(string Header, int Width, bool IsVisible, string Name)
|
||||||
|
{
|
||||||
|
this.Header = Header;
|
||||||
|
this.Width = Width;
|
||||||
|
this.IsVisible = IsVisible;
|
||||||
|
this.Name = Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
ShabComponentsLibrary/Exceptions/EmptyValueException.cs
Normal file
9
ShabComponentsLibrary/Exceptions/EmptyValueException.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace ShabComponentsLibrary.Exceptions
|
||||||
|
{
|
||||||
|
public class EmptyValueException : ApplicationException
|
||||||
|
{
|
||||||
|
public EmptyValueException()
|
||||||
|
: base("Значение не введено")
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
namespace ShabComponentsLibrary.Exceptions
|
||||||
|
{
|
||||||
|
public class MalformedIntegralException : ApplicationException
|
||||||
|
{
|
||||||
|
public MalformedIntegralException()
|
||||||
|
: base("Введенное значение не является целочисленным")
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
10
ShabComponentsLibrary/ShabComponentsLibrary.csproj
Normal file
10
ShabComponentsLibrary/ShabComponentsLibrary.csproj
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
74
ShabComponentsLibrary/ShabInputComponent.Designer.cs
generated
Normal file
74
ShabComponentsLibrary/ShabInputComponent.Designer.cs
generated
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
namespace ShabComponentsLibrary
|
||||||
|
{
|
||||||
|
partial class ShabInputComponent
|
||||||
|
{
|
||||||
|
/// <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 Component 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()
|
||||||
|
{
|
||||||
|
IsNullCheckBox = new CheckBox();
|
||||||
|
MainTextBox = new TextBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// IsNullCheckBox
|
||||||
|
//
|
||||||
|
IsNullCheckBox.AutoSize = true;
|
||||||
|
IsNullCheckBox.Location = new Point(3, 7);
|
||||||
|
IsNullCheckBox.Name = "IsNullCheckBox";
|
||||||
|
IsNullCheckBox.Size = new Size(15, 14);
|
||||||
|
IsNullCheckBox.TabIndex = 0;
|
||||||
|
IsNullCheckBox.UseVisualStyleBackColor = true;
|
||||||
|
IsNullCheckBox.CheckedChanged += IsNullCheckBox_CheckedChanged;
|
||||||
|
//
|
||||||
|
// MainTextBox
|
||||||
|
//
|
||||||
|
MainTextBox.Location = new Point(20, 3);
|
||||||
|
MainTextBox.Margin = new Padding(0);
|
||||||
|
MainTextBox.MaxLength = 10;
|
||||||
|
MainTextBox.Name = "MainTextBox";
|
||||||
|
MainTextBox.PlaceholderText = "0";
|
||||||
|
MainTextBox.Size = new Size(153, 23);
|
||||||
|
MainTextBox.TabIndex = 1;
|
||||||
|
MainTextBox.TextChanged += MainTextBox_TextChanged;
|
||||||
|
//
|
||||||
|
// ShabInputComponent
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(MainTextBox);
|
||||||
|
Controls.Add(IsNullCheckBox);
|
||||||
|
Margin = new Padding(0);
|
||||||
|
Name = "ShabInputComponent";
|
||||||
|
Size = new Size(175, 29);
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private CheckBox IsNullCheckBox;
|
||||||
|
private TextBox MainTextBox;
|
||||||
|
}
|
||||||
|
}
|
97
ShabComponentsLibrary/ShabInputComponent.cs
Normal file
97
ShabComponentsLibrary/ShabInputComponent.cs
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
using ShabComponentsLibrary.Exceptions;
|
||||||
|
|
||||||
|
namespace ShabComponentsLibrary
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Текстовый визуальный компонент для ввода значения определенного типа
|
||||||
|
/// </summary>
|
||||||
|
public partial class ShabInputComponent : UserControl
|
||||||
|
{
|
||||||
|
private event EventHandler? _valueChanged;
|
||||||
|
|
||||||
|
public ShabInputComponent()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Установка и получение введенного значения
|
||||||
|
/// </summary>
|
||||||
|
public int? IntValue
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (IsNullCheckBox.Checked)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(MainTextBox.Text))
|
||||||
|
{
|
||||||
|
throw new EmptyValueException();
|
||||||
|
}
|
||||||
|
|
||||||
|
int ParsedInt;
|
||||||
|
if (Int32.TryParse(MainTextBox.Text, out ParsedInt))
|
||||||
|
{
|
||||||
|
return ParsedInt;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new MalformedIntegralException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value is null)
|
||||||
|
{
|
||||||
|
SetNullState(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetNullState(false);
|
||||||
|
MainTextBox.Text = value.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Событие, вызываемое при смене значения (либо при смене CheckBox)
|
||||||
|
/// </summary>
|
||||||
|
public event EventHandler? ValueChanged
|
||||||
|
{
|
||||||
|
add { _valueChanged += value; }
|
||||||
|
remove { _valueChanged -= value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetNullState(bool IsNull, bool ClearText = false)
|
||||||
|
{
|
||||||
|
if (IsNull)
|
||||||
|
{
|
||||||
|
IsNullCheckBox.Checked = true;
|
||||||
|
MainTextBox.Enabled = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IsNullCheckBox.Checked = false;
|
||||||
|
MainTextBox.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ClearText)
|
||||||
|
{
|
||||||
|
MainTextBox.Text = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void IsNullCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SetNullState(IsNullCheckBox.Checked);
|
||||||
|
_valueChanged?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MainTextBox_TextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_valueChanged?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
ShabComponentsLibrary/ShabInputComponent.resx
Normal file
120
ShabComponentsLibrary/ShabInputComponent.resx
Normal 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>
|
63
ShabComponentsLibrary/ShabListOutputComponent.Designer.cs
generated
Normal file
63
ShabComponentsLibrary/ShabListOutputComponent.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
namespace ShabComponentsLibrary
|
||||||
|
{
|
||||||
|
partial class ShabListOutputComponent
|
||||||
|
{
|
||||||
|
/// <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 Component 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()
|
||||||
|
{
|
||||||
|
Grid = new DataGridView();
|
||||||
|
((System.ComponentModel.ISupportInitialize)Grid).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// Grid
|
||||||
|
//
|
||||||
|
Grid.AllowUserToAddRows = false;
|
||||||
|
Grid.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
Grid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
Grid.Location = new Point(3, 3);
|
||||||
|
Grid.MultiSelect = false;
|
||||||
|
Grid.Name = "Grid";
|
||||||
|
Grid.RowHeadersVisible = false;
|
||||||
|
Grid.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
Grid.Size = new Size(380, 243);
|
||||||
|
Grid.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// ShabListOutputComponent
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(Grid);
|
||||||
|
Name = "ShabListOutputComponent";
|
||||||
|
Size = new Size(386, 249);
|
||||||
|
((System.ComponentModel.ISupportInitialize)Grid).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView Grid;
|
||||||
|
}
|
||||||
|
}
|
107
ShabComponentsLibrary/ShabListOutputComponent.cs
Normal file
107
ShabComponentsLibrary/ShabListOutputComponent.cs
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
namespace ShabComponentsLibrary
|
||||||
|
{
|
||||||
|
public partial class ShabListOutputComponent : UserControl
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Установка и получение индекса выбранной строки
|
||||||
|
/// </summary>
|
||||||
|
public int SelectedRow
|
||||||
|
{
|
||||||
|
get => Grid.SelectedRows.Count == 1 ? Grid.SelectedRows[0].Index : -1;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value >= 0)
|
||||||
|
{
|
||||||
|
Grid.Rows[value].Selected = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ShabListOutputComponent()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Конфигурация столбцов.
|
||||||
|
/// Для каждого столбца указываются заголовок, ширина, видимость и имя свойства/поля объекта
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Columns">Информация о столбцах</param>
|
||||||
|
public void ConfigureColumns(List<ColumnInfo> Columns)
|
||||||
|
{
|
||||||
|
Grid.ColumnCount = Columns.Count;
|
||||||
|
|
||||||
|
for (int Index = 0; Index < Columns.Count; ++Index)
|
||||||
|
{
|
||||||
|
Grid.Columns[Index].HeaderText = Columns[Index].Header;
|
||||||
|
Grid.Columns[Index].Width = Columns[Index].Width;
|
||||||
|
Grid.Columns[Index].Visible = Columns[Index].IsVisible;
|
||||||
|
Grid.Columns[Index].Name = Columns[Index].Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Очистка строк
|
||||||
|
/// </summary>
|
||||||
|
public void ClearGrid()
|
||||||
|
{
|
||||||
|
Grid.Rows.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Получение объекта из выбранной строки
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">Тип получаемого объекта</typeparam>
|
||||||
|
/// <returns></returns>
|
||||||
|
public T GetSelectedObject<T>() where T : new()
|
||||||
|
{
|
||||||
|
T RetVal = new T();
|
||||||
|
var Properties = typeof(T).GetProperties();
|
||||||
|
|
||||||
|
var Cells = Grid.SelectedRows[0].Cells;
|
||||||
|
for (int Index = 0; Index < Grid.ColumnCount; ++Index)
|
||||||
|
{
|
||||||
|
DataGridViewColumn Column = Grid.Columns[Index];
|
||||||
|
var Cell = Cells[Index];
|
||||||
|
|
||||||
|
var Property = Properties.FirstOrDefault(x => x.Name == Column.Name);
|
||||||
|
Property?.SetValue(RetVal, Cell.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return RetVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Заполнение таблицы через передаваемый список объектов класса T
|
||||||
|
/// </summary>
|
||||||
|
public void InsertValues<T>(List<T> Objects)
|
||||||
|
{
|
||||||
|
ClearGrid();
|
||||||
|
|
||||||
|
var Type = typeof(T);
|
||||||
|
var Properties = Type.GetProperties();
|
||||||
|
|
||||||
|
foreach (var Object in Objects)
|
||||||
|
{
|
||||||
|
int NewRowIndex = Grid.Rows.Add();
|
||||||
|
|
||||||
|
foreach (DataGridViewColumn Column in Grid.Columns)
|
||||||
|
{
|
||||||
|
var Property = Properties.FirstOrDefault(x => x.Name == Column.Name);
|
||||||
|
if (Property == null)
|
||||||
|
throw new InvalidOperationException($"В типе {Type.Name} не найдено свойство с именем {Column.Name}");
|
||||||
|
|
||||||
|
var Value = Property.GetValue(Object);
|
||||||
|
Grid.Rows[NewRowIndex].Cells[Column.Index].Value = Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (DataGridViewColumn Column in Grid.Columns)
|
||||||
|
{
|
||||||
|
var Property = Properties.FirstOrDefault(x => x.Name == Column.Name);
|
||||||
|
if (Property == null)
|
||||||
|
throw new InvalidOperationException($"В типе {Type.Name} не найдено свойство с именем {Column.Name}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
ShabComponentsLibrary/ShabListOutputComponent.resx
Normal file
120
ShabComponentsLibrary/ShabListOutputComponent.resx
Normal 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>
|
61
ShabComponentsLibrary/ShabSelectComponent.Designer.cs
generated
Normal file
61
ShabComponentsLibrary/ShabSelectComponent.Designer.cs
generated
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
namespace ShabComponentsLibrary
|
||||||
|
{
|
||||||
|
partial class ShabSelectComponent
|
||||||
|
{
|
||||||
|
/// <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 Component 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()
|
||||||
|
{
|
||||||
|
MainListBox = new ListBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// MainListBox
|
||||||
|
//
|
||||||
|
MainListBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
MainListBox.FormattingEnabled = true;
|
||||||
|
MainListBox.ItemHeight = 15;
|
||||||
|
MainListBox.Location = new Point(0, 0);
|
||||||
|
MainListBox.Margin = new Padding(0);
|
||||||
|
MainListBox.Name = "MainListBox";
|
||||||
|
MainListBox.Size = new Size(200, 94);
|
||||||
|
MainListBox.TabIndex = 0;
|
||||||
|
MainListBox.SelectedIndexChanged += MainListBox_SelectedIndexChanged;
|
||||||
|
//
|
||||||
|
// ShabSelectComponent
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(MainListBox);
|
||||||
|
Margin = new Padding(0);
|
||||||
|
Name = "ShabSelectComponent";
|
||||||
|
Size = new Size(200, 94);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ListBox MainListBox;
|
||||||
|
}
|
||||||
|
}
|
58
ShabComponentsLibrary/ShabSelectComponent.cs
Normal file
58
ShabComponentsLibrary/ShabSelectComponent.cs
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
namespace ShabComponentsLibrary
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Визуальный компонент для выбора из обычного списка
|
||||||
|
/// </summary>
|
||||||
|
public partial class ShabSelectComponent : UserControl
|
||||||
|
{
|
||||||
|
private event EventHandler? _itemSelected;
|
||||||
|
|
||||||
|
public ShabSelectComponent()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Метод, у которого в передаваемых параметрах идет список строк
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Items">Список строк</param>
|
||||||
|
public void SetItems(List<string> Items)
|
||||||
|
{
|
||||||
|
foreach (var Item in Items)
|
||||||
|
{
|
||||||
|
MainListBox.Items.Add(Item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Очистка списка
|
||||||
|
/// </summary>
|
||||||
|
public void ClearList()
|
||||||
|
{
|
||||||
|
MainListBox.Items.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Установка и получение выбранного значения
|
||||||
|
/// </summary>
|
||||||
|
public string SelectedItem
|
||||||
|
{
|
||||||
|
get { return (string?)MainListBox.SelectedItem ?? string.Empty; }
|
||||||
|
set { MainListBox.SelectedItem = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Событие, вызываемое при смене значения в ListBox
|
||||||
|
/// </summary>
|
||||||
|
public event EventHandler? ItemSelected
|
||||||
|
{
|
||||||
|
add { _itemSelected += value; }
|
||||||
|
remove { _itemSelected -= value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MainListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_itemSelected?.Invoke(this, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
ShabComponentsLibrary/ShabSelectComponent.resx
Normal file
120
ShabComponentsLibrary/ShabSelectComponent.resx
Normal 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>
|
Loading…
Reference in New Issue
Block a user