Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <iostream>
- #include <string>
- #include <fstream>
- #include <cstdlib>
- #include <vector>
- #include <algorithm>
- #include <ctime>
- #include <msclr\marshal_cppstd.h>
- #include <Windows.h>
- int manual_filling = 0;
- //std::string path = "text_new.dat";
- struct Information
- {
- std::string Name;
- std::string Date;
- std::string Problem;
- std::string Status;
- Information(std::string = "", std::string = "", std::string = "", std::string = "");
- };
- //--------------------------
- Information::Information(std::string Name, std::string Date, std::string Problem, std::string Status) {
- this->Name = Name;
- this->Date = Date;
- this->Problem = Problem;
- this->Status = Status;
- }
- std::string randName() {
- size_t size = rand() % 7 + 2;
- std::string s(size, ' ');
- s[0] = static_cast<char>(rand() % ('2' - 'A') + 'A');
- for (size_t i = 1; i < size; i++)
- {
- s[i] = static_cast<char>(rand() % ('z' - 'a') + 'a');
- }
- return s;
- }
- std::string randDate() {
- size_t size = rand() % 7 + 2;
- std::string s(size, ' ');
- s[0] = static_cast<char>(rand() % ('2' - 'A') + 'A');
- for (size_t i = 1; i < size; i++)
- {
- s[i] = static_cast<char>(rand() % ('z' - 'a') + 'a');
- }
- return s;
- }
- std::string randProblem() {
- size_t size = rand() % 7 + 2;
- std::string s(size, ' ');
- s[0] = static_cast<char>(rand() % ('2' - 'A') + 'A');
- for (size_t i = 1; i < size; i++)
- {
- s[i] = static_cast<char>(rand() % ('z' - 'a') + 'a');
- }
- return s;
- }
- std::string randStatus() {
- size_t size = rand() % 7 + 2;
- std::string s(size, ' ');
- s[0] = static_cast<char>(rand() % ('2' - 'A') + 'A');
- for (size_t i = 1; i < size; i++)
- {
- s[i] = static_cast<char>(rand() % ('z' - 'a') + 'a');
- }
- return s;
- }
- void randFill(std::vector<Information>& list) {
- srand(static_cast<unsigned int>(time(nullptr)));
- for (size_t i = 0; i < list.size(); i++) {
- list[i].Name = randName();
- list[i].Date = randDate();
- list[i].Problem = randProblem();
- list[i].Status = randStatus();
- }
- }
- void del_from_vector(std::vector<Information> & list, int in) {
- for (size_t k = 0; k < list.size(); k++)
- {
- if (k==in)
- {
- list.erase(list.begin() + k);
- }
- }
- }
- bool save_list_to_file(std::string path, std::vector<Information> list) {
- std::ofstream file;
- file.open(path.c_str(), std::ios_base::binary | std::ios::out | std::ios::trunc);
- if (file) {
- for (size_t i = 0; i < list.size(); i++) {
- size_t lnlen = list[i].Name.length();
- file.write(reinterpret_cast<char*>(&lnlen), sizeof(lnlen));
- file.write(list[i].Name.c_str(), static_cast<long long>(lnlen));
- size_t lnlen1 = list[i].Date.length();
- file.write(reinterpret_cast<char*>(&lnlen1), sizeof(lnlen1));
- file.write(list[i].Date.c_str(), static_cast<long long>(lnlen1));
- size_t lnlen2 = list[i].Problem.length();
- file.write(reinterpret_cast<char*>(&lnlen2), sizeof(lnlen2));
- file.write(list[i].Problem.c_str(), static_cast<long long>(lnlen2));
- size_t lnlen3 = list[i].Status.length();
- file.write(reinterpret_cast<char*>(&lnlen3), sizeof(lnlen3));
- file.write(list[i].Status.c_str(), static_cast<long long>(lnlen3));
- }
- file.close();
- return true;
- }
- return false;
- }
- bool load_list_from_file(std::string path, std::vector<Information>& list) {
- std::ifstream file;
- list.clear();
- file.open(path.c_str(), std::ios::binary | std::ios::in);
- if (file) {
- while (!file.eof()) {
- std::string Name;
- size_t lnlen;
- file.read(reinterpret_cast<char*>(&lnlen), sizeof(lnlen));
- if (!file.fail()) {
- Name.resize(lnlen);
- file.read(&Name[0], static_cast<long long>(lnlen));
- std::string Date;
- size_t lnlen1;
- file.read(reinterpret_cast<char*>(&lnlen1), sizeof(lnlen1));
- Date.resize(lnlen1);
- file.read(&Date[0], static_cast<long long>(lnlen1));
- std::string Problem;
- size_t lnlen2;
- file.read(reinterpret_cast<char*>(&lnlen2), sizeof(lnlen2));
- Problem.resize(lnlen2);
- file.read(&Problem[0], static_cast<long long>(lnlen2));
- std::string Status;
- size_t lnlen3;
- file.read(reinterpret_cast<char*>(&lnlen3), sizeof(lnlen3));
- Status.resize(lnlen3);
- file.read(&Status[0], static_cast<long long>(lnlen3));
- list.push_back(Information(Name, Date, Problem, Status));
- }
- }
- file.close();
- return true;
- }
- return false;
- }
- namespace mypain {
- using namespace System;
- using namespace System::ComponentModel;
- using namespace System::Collections;
- using namespace System::Windows::Forms;
- using namespace System::Data;
- using namespace System::Drawing;
- /// <summary>
- /// Сводка для MyForm
- /// </summary>
- public ref class MyForm : public System::Windows::Forms::Form
- {
- public:
- MyForm(void)
- {
- InitializeComponent();
- //
- //TODO: добавьте код конструктора
- //
- }
- protected:
- /// <summary>
- /// Освободить все используемые ресурсы.
- /// </summary>
- ~MyForm()
- {
- if (components)
- {
- delete components;
- }
- }
- private: System::Windows::Forms::ContextMenuStrip^ contextMenuStrip1;
- protected:
- private: System::Windows::Forms::ToolStrip^ toolStrip1;
- private: System::Windows::Forms::MenuStrip^ menuStrip1;
- private: System::Windows::Forms::ToolStripMenuItem^ fileToolStripMenuItem1;
- private: System::Windows::Forms::ToolStripMenuItem^ saveToolStripMenuItem1;
- private: System::Windows::Forms::OpenFileDialog^ openFileDialog1;
- private: System::Windows::Forms::SaveFileDialog^ saveFileDialog1;
- private: System::Windows::Forms::DataGridView^ dataGridView1;
- private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column1;
- private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column2;
- private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column3;
- private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column4;
- private: System::Windows::Forms::ToolStripMenuItem^ openToolStripMenuItem;
- private: System::Windows::Forms::ToolStripButton^ toolStripButton1;
- private: System::Windows::Forms::ToolStripButton^ toolStripButton2;
- private: System::Windows::Forms::ToolStripButton^ toolStripButton3;
- private: System::Windows::Forms::ToolStripMenuItem^ actionsToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ increaseRowCountToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ randomToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ reduceRowCountToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ currentRowToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ processedPositionsToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ manualFillToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ deleteToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ clearAllToolStripMenuItem1;
- private: System::Windows::Forms::ToolStripMenuItem^ findProcessedPositionToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ highlightNotProcessedToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ highlightingToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ highlightProcessedToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ highlightDelayedPositionsToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ highlightCurrentPositionsToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ highlightAllToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ deleteHighlightingToolStripMenuItem;
- private: System::Windows::Forms::ToolStripMenuItem^ addManualFillToolStripMenuItem;
- private: System::ComponentModel::IContainer^ components;
- private:
- /// <summary>
- /// Обязательная переменная конструктора.
- /// </summary>
- #pragma region Windows Form Designer generated code
- /// <summary>
- /// Требуемый метод для поддержки конструктора — не изменяйте
- /// содержимое этого метода с помощью редактора кода.
- /// </summary>
- void InitializeComponent(void)
- {
- this->components = (gcnew System::ComponentModel::Container());
- System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(MyForm::typeid));
- this->contextMenuStrip1 = (gcnew System::Windows::Forms::ContextMenuStrip(this->components));
- this->findProcessedPositionToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->highlightNotProcessedToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->toolStrip1 = (gcnew System::Windows::Forms::ToolStrip());
- this->toolStripButton1 = (gcnew System::Windows::Forms::ToolStripButton());
- this->toolStripButton2 = (gcnew System::Windows::Forms::ToolStripButton());
- this->toolStripButton3 = (gcnew System::Windows::Forms::ToolStripButton());
- this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
- this->fileToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->saveToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->openToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->clearAllToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->actionsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->increaseRowCountToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->randomToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->reduceRowCountToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->currentRowToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->processedPositionsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->deleteToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->manualFillToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->addManualFillToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->highlightingToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->highlightProcessedToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->highlightDelayedPositionsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->highlightCurrentPositionsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->highlightAllToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->deleteHighlightingToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
- this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
- this->saveFileDialog1 = (gcnew System::Windows::Forms::SaveFileDialog());
- this->dataGridView1 = (gcnew System::Windows::Forms::DataGridView());
- this->Column1 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
- this->Column2 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
- this->Column3 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
- this->Column4 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
- this->contextMenuStrip1->SuspendLayout();
- this->toolStrip1->SuspendLayout();
- this->menuStrip1->SuspendLayout();
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->dataGridView1))->BeginInit();
- this->SuspendLayout();
- //
- // contextMenuStrip1
- //
- this->contextMenuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {
- this->findProcessedPositionToolStripMenuItem,
- this->highlightNotProcessedToolStripMenuItem
- });
- this->contextMenuStrip1->Name = L"contextMenuStrip1";
- this->contextMenuStrip1->Size = System::Drawing::Size(215, 48);
- //
- // findProcessedPositionToolStripMenuItem
- //
- this->findProcessedPositionToolStripMenuItem->Name = L"findProcessedPositionToolStripMenuItem";
- this->findProcessedPositionToolStripMenuItem->Size = System::Drawing::Size(214, 22);
- this->findProcessedPositionToolStripMenuItem->Text = L"Delete Processed Positions";
- this->findProcessedPositionToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::processedPositionsToolStripMenuItem_Click);
- //
- // highlightNotProcessedToolStripMenuItem
- //
- this->highlightNotProcessedToolStripMenuItem->Name = L"highlightNotProcessedToolStripMenuItem";
- this->highlightNotProcessedToolStripMenuItem->Size = System::Drawing::Size(214, 22);
- this->highlightNotProcessedToolStripMenuItem->Text = L"Highlight Processed";
- this->highlightNotProcessedToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::highlightProcessedToolStripMenuItem_Click);
- //
- // toolStrip1
- //
- this->toolStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(3) {
- this->toolStripButton1,
- this->toolStripButton2, this->toolStripButton3
- });
- this->toolStrip1->Location = System::Drawing::Point(0, 24);
- this->toolStrip1->Name = L"toolStrip1";
- this->toolStrip1->Size = System::Drawing::Size(636, 25);
- this->toolStrip1->TabIndex = 1;
- this->toolStrip1->Text = L"toolStrip1";
- //
- // toolStripButton1
- //
- this->toolStripButton1->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
- this->toolStripButton1->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"toolStripButton1.Image")));
- this->toolStripButton1->ImageTransparentColor = System::Drawing::Color::Magenta;
- this->toolStripButton1->Name = L"toolStripButton1";
- this->toolStripButton1->Size = System::Drawing::Size(23, 22);
- this->toolStripButton1->Text = L"toolStripButton1";
- this->toolStripButton1->Click += gcnew System::EventHandler(this, &MyForm::saveToolStripMenuItem1_Click);
- //
- // toolStripButton2
- //
- this->toolStripButton2->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
- this->toolStripButton2->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"toolStripButton2.Image")));
- this->toolStripButton2->ImageTransparentColor = System::Drawing::Color::Magenta;
- this->toolStripButton2->Name = L"toolStripButton2";
- this->toolStripButton2->Size = System::Drawing::Size(23, 22);
- this->toolStripButton2->Text = L"toolStripButton2";
- this->toolStripButton2->Click += gcnew System::EventHandler(this, &MyForm::manualFillToolStripMenuItem_Click);
- //
- // toolStripButton3
- //
- this->toolStripButton3->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
- this->toolStripButton3->Image = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"toolStripButton3.Image")));
- this->toolStripButton3->ImageTransparentColor = System::Drawing::Color::Magenta;
- this->toolStripButton3->Name = L"toolStripButton3";
- this->toolStripButton3->Size = System::Drawing::Size(23, 22);
- this->toolStripButton3->Text = L"toolStripButton3";
- this->toolStripButton3->Click += gcnew System::EventHandler(this, &MyForm::openToolStripMenuItem_Click);
- //
- // menuStrip1
- //
- this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(3) {
- this->fileToolStripMenuItem1,
- this->actionsToolStripMenuItem, this->highlightingToolStripMenuItem
- });
- this->menuStrip1->Location = System::Drawing::Point(0, 0);
- this->menuStrip1->Name = L"menuStrip1";
- this->menuStrip1->Size = System::Drawing::Size(636, 24);
- this->menuStrip1->TabIndex = 2;
- this->menuStrip1->Text = L"menuStrip1";
- //
- // fileToolStripMenuItem1
- //
- this->fileToolStripMenuItem1->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(3) {
- this->saveToolStripMenuItem1,
- this->openToolStripMenuItem, this->clearAllToolStripMenuItem1
- });
- this->fileToolStripMenuItem1->Name = L"fileToolStripMenuItem1";
- this->fileToolStripMenuItem1->Size = System::Drawing::Size(37, 20);
- this->fileToolStripMenuItem1->Text = L"File";
- //
- // saveToolStripMenuItem1
- //
- this->saveToolStripMenuItem1->Name = L"saveToolStripMenuItem1";
- this->saveToolStripMenuItem1->ShortcutKeys = static_cast<System::Windows::Forms::Keys>((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::S));
- this->saveToolStripMenuItem1->Size = System::Drawing::Size(180, 22);
- this->saveToolStripMenuItem1->Text = L"Save";
- this->saveToolStripMenuItem1->Click += gcnew System::EventHandler(this, &MyForm::saveToolStripMenuItem1_Click);
- //
- // openToolStripMenuItem
- //
- this->openToolStripMenuItem->Name = L"openToolStripMenuItem";
- this->openToolStripMenuItem->ShortcutKeys = static_cast<System::Windows::Forms::Keys>((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::O));
- this->openToolStripMenuItem->Size = System::Drawing::Size(180, 22);
- this->openToolStripMenuItem->Text = L"Open";
- this->openToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::openToolStripMenuItem_Click);
- //
- // clearAllToolStripMenuItem1
- //
- this->clearAllToolStripMenuItem1->Name = L"clearAllToolStripMenuItem1";
- this->clearAllToolStripMenuItem1->Size = System::Drawing::Size(180, 22);
- this->clearAllToolStripMenuItem1->Text = L"Clean all";
- this->clearAllToolStripMenuItem1->Click += gcnew System::EventHandler(this, &MyForm::clearAllToolStripMenuItem1_Click);
- //
- // actionsToolStripMenuItem
- //
- this->actionsToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(5) {
- this->increaseRowCountToolStripMenuItem,
- this->randomToolStripMenuItem, this->reduceRowCountToolStripMenuItem, this->manualFillToolStripMenuItem, this->addManualFillToolStripMenuItem
- });
- this->actionsToolStripMenuItem->Name = L"actionsToolStripMenuItem";
- this->actionsToolStripMenuItem->Size = System::Drawing::Size(59, 20);
- this->actionsToolStripMenuItem->Text = L"Actions";
- //
- // increaseRowCountToolStripMenuItem
- //
- this->increaseRowCountToolStripMenuItem->Name = L"increaseRowCountToolStripMenuItem";
- this->increaseRowCountToolStripMenuItem->ShortcutKeys = static_cast<System::Windows::Forms::Keys>((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::I));
- this->increaseRowCountToolStripMenuItem->Size = System::Drawing::Size(216, 22);
- this->increaseRowCountToolStripMenuItem->Text = L"Increase Row Count";
- this->increaseRowCountToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::increaseRowCountToolStripMenuItem_Click);
- //
- // randomToolStripMenuItem
- //
- this->randomToolStripMenuItem->Name = L"randomToolStripMenuItem";
- this->randomToolStripMenuItem->ShortcutKeys = static_cast<System::Windows::Forms::Keys>((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::R));
- this->randomToolStripMenuItem->Size = System::Drawing::Size(216, 22);
- this->randomToolStripMenuItem->Text = L"Random Fill";
- this->randomToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::randomToolStripMenuItem_Click);
- //
- // reduceRowCountToolStripMenuItem
- //
- this->reduceRowCountToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(3) {
- this->currentRowToolStripMenuItem,
- this->processedPositionsToolStripMenuItem, this->deleteToolStripMenuItem
- });
- this->reduceRowCountToolStripMenuItem->Name = L"reduceRowCountToolStripMenuItem";
- this->reduceRowCountToolStripMenuItem->Size = System::Drawing::Size(216, 22);
- this->reduceRowCountToolStripMenuItem->Text = L"Reduce Row Count";
- this->reduceRowCountToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::reduceRowCountToolStripMenuItem_Click);
- //
- // currentRowToolStripMenuItem
- //
- this->currentRowToolStripMenuItem->Name = L"currentRowToolStripMenuItem";
- this->currentRowToolStripMenuItem->Size = System::Drawing::Size(178, 22);
- this->currentRowToolStripMenuItem->Text = L"Current Row";
- this->currentRowToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::currentRowToolStripMenuItem_Click);
- //
- // processedPositionsToolStripMenuItem
- //
- this->processedPositionsToolStripMenuItem->Name = L"processedPositionsToolStripMenuItem";
- this->processedPositionsToolStripMenuItem->Size = System::Drawing::Size(178, 22);
- this->processedPositionsToolStripMenuItem->Text = L"Processed Positions";
- this->processedPositionsToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::processedPositionsToolStripMenuItem_Click);
- //
- // deleteToolStripMenuItem
- //
- this->deleteToolStripMenuItem->Name = L"deleteToolStripMenuItem";
- this->deleteToolStripMenuItem->Size = System::Drawing::Size(178, 22);
- this->deleteToolStripMenuItem->Text = L"Delete";
- this->deleteToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::deleteToolStripMenuItem_Click);
- //
- // manualFillToolStripMenuItem
- //
- this->manualFillToolStripMenuItem->Name = L"manualFillToolStripMenuItem";
- this->manualFillToolStripMenuItem->ShortcutKeys = static_cast<System::Windows::Forms::Keys>((System::Windows::Forms::Keys::Control | System::Windows::Forms::Keys::M));
- this->manualFillToolStripMenuItem->Size = System::Drawing::Size(216, 22);
- this->manualFillToolStripMenuItem->Text = L"Manual Fill";
- this->manualFillToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::manualFillToolStripMenuItem_Click);
- //
- // addManualFillToolStripMenuItem
- //
- this->addManualFillToolStripMenuItem->Name = L"addManualFillToolStripMenuItem";
- this->addManualFillToolStripMenuItem->Size = System::Drawing::Size(216, 22);
- this->addManualFillToolStripMenuItem->Text = L"Add Manual Fill";
- this->addManualFillToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::addManualFillToolStripMenuItem_Click);
- //
- // highlightingToolStripMenuItem
- //
- this->highlightingToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(5) {
- this->highlightProcessedToolStripMenuItem,
- this->highlightDelayedPositionsToolStripMenuItem, this->highlightCurrentPositionsToolStripMenuItem, this->highlightAllToolStripMenuItem,
- this->deleteHighlightingToolStripMenuItem
- });
- this->highlightingToolStripMenuItem->Name = L"highlightingToolStripMenuItem";
- this->highlightingToolStripMenuItem->Size = System::Drawing::Size(86, 20);
- this->highlightingToolStripMenuItem->Text = L"Highlighting";
- //
- // highlightProcessedToolStripMenuItem
- //
- this->highlightProcessedToolStripMenuItem->Name = L"highlightProcessedToolStripMenuItem";
- this->highlightProcessedToolStripMenuItem->Size = System::Drawing::Size(231, 22);
- this->highlightProcessedToolStripMenuItem->Text = L"Highlight Processed Positions";
- this->highlightProcessedToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::highlightProcessedToolStripMenuItem_Click);
- //
- // highlightDelayedPositionsToolStripMenuItem
- //
- this->highlightDelayedPositionsToolStripMenuItem->Name = L"highlightDelayedPositionsToolStripMenuItem";
- this->highlightDelayedPositionsToolStripMenuItem->Size = System::Drawing::Size(231, 22);
- this->highlightDelayedPositionsToolStripMenuItem->Text = L"Highlight Delayed Positions";
- this->highlightDelayedPositionsToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::highlightDelayedPositionsToolStripMenuItem_Click);
- //
- // highlightCurrentPositionsToolStripMenuItem
- //
- this->highlightCurrentPositionsToolStripMenuItem->Name = L"highlightCurrentPositionsToolStripMenuItem";
- this->highlightCurrentPositionsToolStripMenuItem->Size = System::Drawing::Size(231, 22);
- this->highlightCurrentPositionsToolStripMenuItem->Text = L"Highlight Current Positions";
- this->highlightCurrentPositionsToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::highlightCurrentPositionsToolStripMenuItem_Click);
- //
- // highlightAllToolStripMenuItem
- //
- this->highlightAllToolStripMenuItem->Name = L"highlightAllToolStripMenuItem";
- this->highlightAllToolStripMenuItem->Size = System::Drawing::Size(231, 22);
- this->highlightAllToolStripMenuItem->Text = L"Highlight All";
- this->highlightAllToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::highlightAllToolStripMenuItem_Click);
- //
- // deleteHighlightingToolStripMenuItem
- //
- this->deleteHighlightingToolStripMenuItem->Name = L"deleteHighlightingToolStripMenuItem";
- this->deleteHighlightingToolStripMenuItem->Size = System::Drawing::Size(231, 22);
- this->deleteHighlightingToolStripMenuItem->Text = L"Delete Highlighting";
- this->deleteHighlightingToolStripMenuItem->Click += gcnew System::EventHandler(this, &MyForm::deleteHighlightingToolStripMenuItem_Click);
- //
- // openFileDialog1
- //
- this->openFileDialog1->FileName = L"openFileDialog1";
- //
- // dataGridView1
- //
- this->dataGridView1->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
- this->dataGridView1->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^ >(4) {
- this->Column1,
- this->Column2, this->Column3, this->Column4
- });
- this->dataGridView1->ContextMenuStrip = this->contextMenuStrip1;
- this->dataGridView1->Location = System::Drawing::Point(99, 69);
- this->dataGridView1->Name = L"dataGridView1";
- this->dataGridView1->Size = System::Drawing::Size(446, 177);
- this->dataGridView1->TabIndex = 3;
- //
- // Column1
- //
- this->Column1->HeaderText = L"Name";
- this->Column1->Name = L"Column1";
- //
- // Column2
- //
- this->Column2->HeaderText = L"Date";
- this->Column2->Name = L"Column2";
- //
- // Column3
- //
- this->Column3->HeaderText = L"Problem";
- this->Column3->Name = L"Column3";
- //
- // Column4
- //
- this->Column4->HeaderText = L"Status";
- this->Column4->Name = L"Column4";
- //
- // MyForm
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->ClientSize = System::Drawing::Size(636, 287);
- this->Controls->Add(this->dataGridView1);
- this->Controls->Add(this->toolStrip1);
- this->Controls->Add(this->menuStrip1);
- this->MainMenuStrip = this->menuStrip1;
- this->Name = L"MyForm";
- this->Text = L"MyForm";
- this->contextMenuStrip1->ResumeLayout(false);
- this->toolStrip1->ResumeLayout(false);
- this->toolStrip1->PerformLayout();
- this->menuStrip1->ResumeLayout(false);
- this->menuStrip1->PerformLayout();
- (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->dataGridView1))->EndInit();
- this->ResumeLayout(false);
- this->PerformLayout();
- }
- #pragma endregion
- private: System::Void increaseRowCountToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- dataGridView1->RowCount++;
- }
- void fill_grid(std::vector<Information>& list) {
- size_t sz = list.size();
- dataGridView1->RowCount = sz;
- for (size_t i = 0; i < sz; i++)
- {
- dataGridView1->Rows[i]->Cells[0]->Value = gcnew System::String(list[i].Name.c_str());
- dataGridView1->Rows[i]->Cells[1]->Value = gcnew System::String(list[i].Date.c_str());
- dataGridView1->Rows[i]->Cells[2]->Value = gcnew System::String(list[i].Problem.c_str());
- dataGridView1->Rows[i]->Cells[3]->Value = gcnew System::String(list[i].Status.c_str());
- }
- }
- void fill_list_by_grid(std::vector<Information>& list, int& manual_filling) {
- size_t sz = dataGridView1->RowCount;
- sz -= manual_filling;
- list.clear();
- list.resize(sz);
- for (size_t i = 0; i < sz; i++)
- {
- list[i].Name = msclr::interop::marshal_as<std::string>(dataGridView1->Rows[i]->Cells[0]->Value->ToString());
- list[i].Date = msclr::interop::marshal_as<std::string>(dataGridView1->Rows[i]->Cells[1]->Value->ToString());
- list[i].Problem = msclr::interop::marshal_as<std::string>(dataGridView1->Rows[i]->Cells[2]->Value->ToString());
- list[i].Status = msclr::interop::marshal_as<std::string>(dataGridView1->Rows[i]->Cells[3]->Value->ToString());
- }
- }
- private: System::Void randomToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- manual_filling = 0;
- int n = dataGridView1->RowCount;
- std::vector<Information> list(n);
- randFill(list);
- fill_grid(list);
- }
- private: System::Void reduceRowCountToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- dataGridView1->RowCount--;
- }
- private: System::Void currentRowToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- int n = dataGridView1->RowCount;
- std::vector<Information> list(n);
- fill_list_by_grid(list, manual_filling);
- int in = dataGridView1->CurrentRow->Index;
- del_from_vector(list, in);
- fill_grid(list);
- //fill_list_by_grid(list, manual_filling);
- }
- void fill_list_by_grid_manual(std::vector<Information>& list, int& manual_filling) {
- size_t sz = dataGridView1->RowCount;
- sz--;
- list.clear();
- list.resize(sz);
- for (size_t i = 0; i < sz; i++)
- {
- //if (msclr::interop::marshal_as<std::string>(dataGridView1->Rows[i]->Cells[0]->Value->ToString()) !=" ")
- list[i].Name = msclr::interop::marshal_as<std::string>(dataGridView1->Rows[i]->Cells[0]->Value->ToString());
- // if (msclr::interop::marshal_as<std::string>(dataGridView1->Rows[i]->Cells[1]->Value->ToString()) != " ")
- list[i].Date = msclr::interop::marshal_as<std::string>(dataGridView1->Rows[i]->Cells[1]->Value->ToString());
- //if (msclr::interop::marshal_as<std::string>(dataGridView1->Rows[i]->Cells[2]->Value->ToString()) != " ")
- list[i].Problem = msclr::interop::marshal_as<std::string>(dataGridView1->Rows[i]->Cells[2]->Value->ToString());
- // if (msclr::interop::marshal_as<std::string>(dataGridView1->Rows[i]->Cells[3]->Value->ToString()) != " ")
- list[i].Status = msclr::interop::marshal_as<std::string>(dataGridView1->Rows[i]->Cells[3]->Value->ToString());
- }
- }
- private: System::Void manualFillToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- //manual_filling = 1;
- int n = dataGridView1->RowCount;
- //n -= manual_filling;
- std::vector<Information> list(n);
- fill_list_by_grid_manual(list, manual_filling);
- for (int i = 0; i < dataGridView1->RowCount; i++) {
- if (dataGridView1->Rows[i]->Cells[0]->Value == L"") {
- //del_from_vector(list, n - 1);
- del_from_vector(list, i); //Удалять только пустую строку
- }
- }
- fill_grid(list);
- }
- private: System::Void deleteToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- dataGridView1->RowCount--;
- }
- private: System::Void saveToolStripMenuItem1_Click(System::Object^ sender, System::EventArgs^ e) {
- int n = dataGridView1->RowCount;
- n -= manual_filling;
- std::vector<Information> list(n);
- fill_list_by_grid(list, manual_filling); /////////////!!!!!!!!!!!!!!!!!!!!мб на одну запись меньше
- saveFileDialog1->ShowDialog();
- std::string path = msclr::interop::marshal_as<std::string>(saveFileDialog1->FileName);
- save_list_to_file(path, list);
- }
- private: System::Void openToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- openFileDialog1->ShowDialog();
- std::string path = msclr::interop::marshal_as<std::string>(openFileDialog1->FileName);
- std::vector<Information> list;
- load_list_from_file(path, list);
- dataGridView1->RowCount = list.size();
- fill_grid(list);///трабл мб с единицей
- }
- private: System::Void processedPositionsToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- /*int n = dataGridView1->RowCount;
- std::vector<Information> list(n);
- fill_list_by_grid(list, manual_filling);
- for (int i = 0; i < list.size(); i++)
- {
- if (list[i].Status == "обработано")
- {
- del_from_vector(list, i);
- }
- }
- fill_grid(list);*/
- int n = dataGridView1->RowCount;
- std::vector<Information> list(n);
- fill_list_by_grid(list, manual_filling);
- for (int i = 0; i < dataGridView1->ColumnCount; i++)
- {
- for (int j = 0; j < dataGridView1->RowCount; j++)
- {
- if (dataGridView1->Rows[j]->Cells[3]->Value->ToString() == "обработано")
- {
- fill_list_by_grid(list, manual_filling);
- del_from_vector(list, j);
- fill_grid(list);
- }
- }
- }
- fill_grid(list);
- }
- private: System::Void highlightProcessedToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- int n = dataGridView1->RowCount;
- std::vector<Information> list(n);
- fill_list_by_grid(list, manual_filling);
- for (int i = 0; i < dataGridView1->ColumnCount; i++)
- {
- for (int j = 0; j < dataGridView1->RowCount; j++)
- {
- if (dataGridView1->Rows[j]->Cells[3]->Value->ToString() == "обработано")
- {
- dataGridView1->Rows[j]->Cells[i]->Style->BackColor = Drawing::Color::Green;
- }
- }
- }
- fill_grid(list);
- }
- private: System::Void highlightDelayedPositionsToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- int n = dataGridView1->RowCount;
- std::vector<Information> list(n);
- fill_list_by_grid(list, manual_filling);
- for (int i = 0; i < dataGridView1->ColumnCount; i++)
- {
- for (int j = 0; j < dataGridView1->RowCount; j++)
- {
- if (dataGridView1->Rows[j]->Cells[3]->Value->ToString() == "отложено")
- {
- dataGridView1->Rows[j]->Cells[i]->Style->BackColor = Drawing::Color::Violet;
- }
- }
- }
- fill_grid(list);
- }
- private: System::Void highlightCurrentPositionsToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- int n = dataGridView1->RowCount;
- std::vector<Information> list(n);
- fill_list_by_grid(list, manual_filling);
- for (int i = 0; i < dataGridView1->ColumnCount; i++)
- {
- for (int j = 0; j < dataGridView1->RowCount; j++)
- {
- if (dataGridView1->Rows[j]->Cells[3]->Value->ToString() == "в процессе")
- {
- dataGridView1->Rows[j]->Cells[i]->Style->BackColor = Drawing::Color::Cyan;
- }
- }
- }
- fill_grid(list);
- }
- private: System::Void addNewManualPositionToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- //manual_filling = 1;
- int n = dataGridView1->RowCount;
- //n -= manual_filling;
- std::vector<Information> list(n);
- fill_list_by_grid_manual(list, manual_filling);
- fill_grid(list);
- }
- private: System::Void highlightAllToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- int n = dataGridView1->RowCount;
- std::vector<Information> list(n);
- fill_list_by_grid(list, manual_filling);
- for (int i = 0; i < dataGridView1->ColumnCount; i++)
- {
- for (int j = 0; j < dataGridView1->RowCount; j++)
- {
- if (dataGridView1->Rows[j]->Cells[3]->Value->ToString() == "в процессе")
- {
- dataGridView1->Rows[j]->Cells[i]->Style->BackColor = Drawing::Color::Cyan;
- }
- }
- for (int j = 0; j < dataGridView1->RowCount; j++)
- {
- if (dataGridView1->Rows[j]->Cells[3]->Value->ToString() == "отложено")
- {
- dataGridView1->Rows[j]->Cells[i]->Style->BackColor = Drawing::Color::Violet;
- }
- }
- for (int j = 0; j < dataGridView1->RowCount; j++)
- {
- if (dataGridView1->Rows[j]->Cells[3]->Value->ToString() == "обработано")
- {
- dataGridView1->Rows[j]->Cells[i]->Style->BackColor = Drawing::Color::Green;
- }
- }
- }
- fill_grid(list);
- }
- private: System::Void deleteHighlightingToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- int n = dataGridView1->RowCount;
- std::vector<Information> list(n);
- fill_list_by_grid(list, manual_filling);
- for (int i = 0; i < dataGridView1->ColumnCount; i++)
- {
- for (int j = 0; j < dataGridView1->RowCount; j++)
- {
- dataGridView1->Rows[j]->Cells[i]->Style->BackColor = Drawing::SystemColors::ControlLightLight;
- }
- }
- fill_grid(list);
- }
- private: System::Void addManualFillToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {
- int n = dataGridView1->RowCount;
- std::vector<Information> list(n+1);
- fill_list_by_grid_manual(list, manual_filling);
- fill_grid(list);
- }
- private: System::Void clearAllToolStripMenuItem1_Click(System::Object^ sender, System::EventArgs^ e) {
- int n = dataGridView1->RowCount;
- std::vector<Information> list(n);
- fill_list_by_grid(list, manual_filling);
- for (int i = 1; i < n; i++) {
- del_from_vector(list, i);
- }
- list[0].Name = "";
- list[0].Date = "";
- list[0].Problem = "";
- list[0].Status = "";
- fill_grid(list);
- }
- };
- }
Add Comment
Please, Sign In to add comment