2023-11-15 22:29:35 +04:00
|
|
|
|
using MigraDoc.DocumentObjectModel;
|
|
|
|
|
using System.IO;
|
2023-10-20 09:00:04 +04:00
|
|
|
|
using System.Windows.Forms;
|
2023-10-06 02:36:27 +04:00
|
|
|
|
using ViewComponents.Exeption;
|
2023-10-20 09:00:04 +04:00
|
|
|
|
using ViewComponents.NotVisualComponents;
|
2023-10-06 02:36:27 +04:00
|
|
|
|
|
|
|
|
|
namespace TestView
|
|
|
|
|
{
|
|
|
|
|
public partial class Form1 : Form
|
|
|
|
|
{
|
|
|
|
|
public Form1()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonAdd_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
2023-10-15 20:05:17 +04:00
|
|
|
|
list_with_choice.Fill_List("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
list_with_choice.Fill_List("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
list_with_choice.Fill_List("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
list_with_choice.Fill_List("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
2023-10-06 02:36:27 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonClear_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
list_with_choice.Clean_List();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonSelect_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(list_with_choice.Element ?? "null", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void list_with_choice_SelectedItemChange(string obj)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(obj, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonDip_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
input_text.MinLen = 5;
|
|
|
|
|
input_text.MaxLen = 25;
|
|
|
|
|
|
2023-10-15 20:05:17 +04:00
|
|
|
|
MessageBox.Show($"Min: {input_text.MinLen}; Max: {input_text.MaxLen}");
|
2023-10-06 02:36:27 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonVal_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2023-10-15 20:05:17 +04:00
|
|
|
|
input_text.Element = "Sample text";
|
2023-10-06 02:36:27 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void input_text_ItemChange(string obj)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(obj, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonCheck_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2023-10-15 20:05:17 +04:00
|
|
|
|
if (input_text.Element.Equals("Range exeption"))
|
|
|
|
|
throw new TextBoundsNotSetExeption("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
if (input_text.Element.Equals("Value exeption"))
|
|
|
|
|
throw new TextOutOfBoundsExeption("<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
2023-10-20 09:00:04 +04:00
|
|
|
|
|
2023-10-15 20:05:17 +04:00
|
|
|
|
MessageBox.Show(input_text.Element, "<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
2023-10-06 02:36:27 +04:00
|
|
|
|
}
|
|
|
|
|
catch (TextBoundsNotSetExeption ex)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
catch (TextOutOfBoundsExeption ex)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonIerarhy_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
myTreeView.setHierarchy(new List<(string, bool)> { ("Genre", false), ("Author", false), ("Title", true) });
|
|
|
|
|
MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonAddBook_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2023-10-20 09:00:04 +04:00
|
|
|
|
|
2023-10-06 02:36:27 +04:00
|
|
|
|
myTreeView.addItem(new Book("<22><><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>.<2E>.", "̸<><CCB8><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"));
|
|
|
|
|
myTreeView.addItem(new Book("<22><><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>.<2E>.", "<22><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>"));
|
|
|
|
|
myTreeView.addItem(new Book("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "1984"));
|
2023-10-06 02:50:26 +04:00
|
|
|
|
myTreeView.addItem(new Book("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
2023-10-06 02:36:27 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonGetValue_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Book? book = myTreeView.getSelecetedNodeValue<Book>();
|
|
|
|
|
if (book == null) return;
|
|
|
|
|
MessageBox.Show("<22><><EFBFBD><EFBFBD>: " + book.Genre + ", <20><><EFBFBD><EFBFBD><EFBFBD>: " + book.Author + ", <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: " + book.Title);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonGetIndex_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(myTreeView.SelectedNodeIndex.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonSetIndex_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2023-10-15 20:05:17 +04:00
|
|
|
|
myTreeView.SelectedNodeIndex = 1;
|
2023-10-06 02:36:27 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Form1_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2023-10-20 09:00:04 +04:00
|
|
|
|
|
|
|
|
|
private void buttonPdfImages_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var res = openFileDialog1.ShowDialog(this);
|
|
|
|
|
if (res != DialogResult.OK) return;
|
|
|
|
|
var files = openFileDialog1.FileNames;
|
|
|
|
|
openFileDialog1.Dispose();
|
|
|
|
|
string path = "C:\\Users\\xarla\\OneDrive\\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\test.pdf";
|
|
|
|
|
MessageBox.Show(path);
|
|
|
|
|
if (pdfImages1.CreatePdfDoc(new ImagesForPDF(path, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", files))) MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD>!");
|
|
|
|
|
else MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
2023-11-15 22:29:35 +04:00
|
|
|
|
|
|
|
|
|
private void buttonTestPdfTable_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
List<BookInfo> books = new List<BookInfo>
|
|
|
|
|
{
|
|
|
|
|
new BookInfo("<22><><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "1809-1852", "̸<><CCB8><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"),
|
|
|
|
|
new BookInfo("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "1818-1883", "<22><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>"),
|
|
|
|
|
new BookInfo("<22><><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "1903-1950", "1984"),
|
|
|
|
|
new BookInfo("<22><><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "1965 - <20>.<2E>.", "<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
List<(int, int)> merges = new List<(int, int)>();
|
|
|
|
|
merges.Add((2, 4));
|
2023-11-16 17:28:16 +04:00
|
|
|
|
|
|
|
|
|
List<int> heights = new List<int> { 10, 40, 60, 20, 25, 15, 20 };
|
2023-11-15 22:29:35 +04:00
|
|
|
|
|
|
|
|
|
string path = "C:\\Users\\xarla\\OneDrive\\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\test.pdf";
|
|
|
|
|
|
2023-11-29 20:58:13 +04:00
|
|
|
|
List<(string, string)> headers = new List<(string, string)> { ("id", "Id"), ("Redaction", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),
|
|
|
|
|
("", "<22><><EFBFBD><EFBFBD><EFBFBD>"), ("AuthorName", "<22><><EFBFBD>"),
|
|
|
|
|
("AuthorSurname", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"), ("AuthorLife", "<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>"),
|
|
|
|
|
("Title", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>") };
|
2023-11-15 22:29:35 +04:00
|
|
|
|
|
2023-11-16 17:28:16 +04:00
|
|
|
|
if (pdfTable1.createTable(new DataForPDFTable<BookInfo>(path, "test2", heights, merges, headers, books))) MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonChart_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string path = "C:\\Users\\xarla\\OneDrive\\<5C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\\chart.pdf";
|
|
|
|
|
List<(double, string)> elements = new List<(double, string)>
|
|
|
|
|
{
|
|
|
|
|
(200, "̸<><CCB8><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"),
|
|
|
|
|
(157, "<22><><EFBFBD><EFBFBD>"),
|
|
|
|
|
(344, "<22><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>"),
|
|
|
|
|
(588, "<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),
|
|
|
|
|
(286, "<22><><EFBFBD><EFBFBD><EFBFBD> 2033")
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if(pieChartpdf1.CreatePieChart(new DataForPDFPieChart(path, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", DiagramLegendEnum.Top ,"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>", elements))) MessageBox.Show("<22><><EFBFBD><EFBFBD><EFBFBD>");
|
2023-11-15 22:29:35 +04:00
|
|
|
|
}
|
2023-10-06 02:36:27 +04:00
|
|
|
|
}
|
|
|
|
|
}
|