Commit 0a43c77d authored by Maxime's avatar Maxime
Browse files

add open file dialog

parent 23870886
{
"ExpandedNodes": [
""
],
"SelectedNode": "\\Optimisation.sln",
"PreviewInSolutionExplorer": false
}
\ No newline at end of file
File added
#pragma once
#pragma comment(lib, "Comdlg32.lib")
#include <iostream>
#include <windows.h>
#include <commdlg.h>
#include <msclr\marshal.h>
namespace View {
using namespace std;
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
......@@ -14,6 +23,8 @@ namespace View {
/// </summary>
public ref class MainForm : public System::Windows::Forms::Form
{
public:
MainForm(void)
{
......@@ -34,18 +45,36 @@ namespace View {
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Button^ buttonStart;
protected:
private: System::Windows::Forms::OpenFileDialog^ openFileDialog1;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::TextBox^ textBoxEvaluation;
private: System::Windows::Forms::DataVisualization::Charting::Chart^ chart1;
private: System::Windows::Forms::Button^ buttonStop;
private: System::Windows::Forms::Button^ buttonFile;
private: System::Windows::Forms::TextBox^ textBoxFile;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::TextBox^ textBoxNbPart;
private: System::Windows::Forms::TextBox^ textBoxNbMachine;
protected:
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
System::ComponentModel::Container^ components;
#pragma region Windows Form Designer generated code
/// <summary>
......@@ -57,23 +86,30 @@ namespace View {
System::Windows::Forms::DataVisualization::Charting::ChartArea^ chartArea1 = (gcnew System::Windows::Forms::DataVisualization::Charting::ChartArea());
System::Windows::Forms::DataVisualization::Charting::Legend^ legend1 = (gcnew System::Windows::Forms::DataVisualization::Charting::Legend());
System::Windows::Forms::DataVisualization::Charting::Series^ series1 = (gcnew System::Windows::Forms::DataVisualization::Charting::Series());
this->button1 = (gcnew System::Windows::Forms::Button());
this->buttonStart = (gcnew System::Windows::Forms::Button());
this->openFileDialog1 = (gcnew System::Windows::Forms::OpenFileDialog());
this->label1 = (gcnew System::Windows::Forms::Label());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->textBoxEvaluation = (gcnew System::Windows::Forms::TextBox());
this->chart1 = (gcnew System::Windows::Forms::DataVisualization::Charting::Chart());
this->buttonStop = (gcnew System::Windows::Forms::Button());
this->buttonFile = (gcnew System::Windows::Forms::Button());
this->textBoxFile = (gcnew System::Windows::Forms::TextBox());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->label4 = (gcnew System::Windows::Forms::Label());
this->textBoxNbPart = (gcnew System::Windows::Forms::TextBox());
this->textBoxNbMachine = (gcnew System::Windows::Forms::TextBox());
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->chart1))->BeginInit();
this->SuspendLayout();
//
// button1
// buttonStart
//
this->button1->Location = System::Drawing::Point(12, 12);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 0;
this->button1->Text = L"Start";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &MainForm::button1_Click);
this->buttonStart->Location = System::Drawing::Point(12, 12);
this->buttonStart->Name = L"buttonStart";
this->buttonStart->Size = System::Drawing::Size(75, 23);
this->buttonStart->TabIndex = 0;
this->buttonStart->Text = L"Start";
this->buttonStart->UseVisualStyleBackColor = true;
//
// openFileDialog1
//
......@@ -89,13 +125,13 @@ namespace View {
this->label1->TabIndex = 1;
this->label1->Text = L"Number of evalutaions :";
//
// textBox1
// textBoxEvaluation
//
this->textBox1->Location = System::Drawing::Point(264, 9);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(56, 20);
this->textBox1->TabIndex = 2;
this->textBox1->Text = L"100";
this->textBoxEvaluation->Location = System::Drawing::Point(264, 9);
this->textBoxEvaluation->Name = L"textBoxEvaluation";
this->textBoxEvaluation->Size = System::Drawing::Size(56, 20);
this->textBoxEvaluation->TabIndex = 2;
this->textBoxEvaluation->Text = L"100";
//
// chart1
//
......@@ -115,22 +151,142 @@ namespace View {
this->chart1->TabIndex = 3;
this->chart1->Text = L"chart1";
//
// buttonStop
//
this->buttonStop->Location = System::Drawing::Point(12, 41);
this->buttonStop->Name = L"buttonStop";
this->buttonStop->Size = System::Drawing::Size(75, 23);
this->buttonStop->TabIndex = 4;
this->buttonStop->Text = L"Stop";
this->buttonStop->UseVisualStyleBackColor = true;
//
// buttonFile
//
this->buttonFile->Location = System::Drawing::Point(12, 142);
this->buttonFile->Name = L"buttonFile";
this->buttonFile->Size = System::Drawing::Size(75, 23);
this->buttonFile->TabIndex = 5;
this->buttonFile->Text = L"Select File";
this->buttonFile->UseVisualStyleBackColor = true;
this->buttonFile->Click += gcnew System::EventHandler(this, &MainForm::buttonFile_Click);
//
// textBoxFile
//
this->textBoxFile->Location = System::Drawing::Point(136, 175);
this->textBoxFile->Name = L"textBoxFile";
this->textBoxFile->ReadOnly = true;
this->textBoxFile->Size = System::Drawing::Size(131, 20);
this->textBoxFile->TabIndex = 7;
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(12, 178);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(72, 13);
this->label2->TabIndex = 6;
this->label2->Text = L"File selected :";
//
// label3
//
this->label3->AutoSize = true;
this->label3->Location = System::Drawing::Point(12, 204);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(88, 13);
this->label3->TabIndex = 8;
this->label3->Text = L"Number of parts :";
//
// label4
//
this->label4->AutoSize = true;
this->label4->Location = System::Drawing::Point(12, 230);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(110, 13);
this->label4->TabIndex = 9;
this->label4->Text = L"Number of machines :";
//
// textBoxNbPart
//
this->textBoxNbPart->Location = System::Drawing::Point(136, 201);
this->textBoxNbPart->Name = L"textBoxNbPart";
this->textBoxNbPart->ReadOnly = true;
this->textBoxNbPart->Size = System::Drawing::Size(56, 20);
this->textBoxNbPart->TabIndex = 10;
//
// textBoxNbMachine
//
this->textBoxNbMachine->Location = System::Drawing::Point(136, 227);
this->textBoxNbMachine->Name = L"textBoxNbMachine";
this->textBoxNbMachine->ReadOnly = true;
this->textBoxNbMachine->Size = System::Drawing::Size(56, 20);
this->textBoxNbMachine->TabIndex = 11;
//
// MainForm
//
this->ClientSize = System::Drawing::Size(649, 411);
this->Controls->Add(this->textBoxNbMachine);
this->Controls->Add(this->textBoxNbPart);
this->Controls->Add(this->label4);
this->Controls->Add(this->label3);
this->Controls->Add(this->textBoxFile);
this->Controls->Add(this->label2);
this->Controls->Add(this->buttonFile);
this->Controls->Add(this->buttonStop);
this->Controls->Add(this->chart1);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->textBoxEvaluation);
this->Controls->Add(this->label1);
this->Controls->Add(this->button1);
this->Controls->Add(this->buttonStart);
this->Name = L"MainForm";
(cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->chart1))->EndInit();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
private: System::Void buttonFile_Click(System::Object^ sender, System::EventArgs^ e) {
OPENFILENAME ofn;
// a another memory buffer to contain the file name
char szFile[1024];
char szFilter[] = "All\0*.*\0Text\0*.TXT\0";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL;
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = szFilter;
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
GetOpenFileName(&ofn);
string base_filename = string(szFile).substr(string(szFile).find_last_of("/\\") + 1);
textBoxFile->Text = charToString(base_filename);
}
private: String^ charToString(char* str) {
return gcnew String(str);
}
private: String^ charToString(string str) {
return gcnew String(&str[0]);
}
private: char* stringToChar(String^ string) {
IntPtr p = System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(string);
char* pNewCharStr = static_cast<char*>(p.ToPointer());
System::Runtime::InteropServices::Marshal::FreeHGlobal(p);
return pNewCharStr;
}
};
};
}
......@@ -46,7 +46,7 @@
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CLRSupport>true</CLRSupport>
<CharacterSet>Unicode</CharacterSet>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
......
c:\users\poula\downloads\oad-tp2\code\view\x64\debug\vc142.pdb
c:\users\poula\downloads\oad-tp2\code\view\x64\debug\.netframework,version=v4.7.2.assemblyattributes.obj
c:\users\poula\downloads\oad-tp2\code\view\x64\debug\mainform.obj
c:\users\poula\downloads\oad-tp2\code\view\x64\debug\entry.obj
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\vc142.pdb
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\.netframework,version=v4.7.2.assemblyattributes.obj
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\mainform.obj
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\entry.obj
c:\users\poula\downloads\oad-tp2\code\x64\debug\view.exe
c:\users\poula\downloads\oad-tp2\code\x64\debug\view.pdb
c:\users\poula\downloads\oad-tp2\code\view\x64\debug\view.mainform.resources
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.mainform.resources
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.vcxproj.assemblyreference.cache
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.vcxproj.generateresource.cache
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\x64\debug\view.pdb
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\cl.command.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\cl.read.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\cl.write.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\link.8812-cvtres.read.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\link.8812-cvtres.write.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\link.8812-rc.read.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\link.8812-rc.write.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\link.8812.read.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\link.8812.write.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\link.9764-cvtres.read.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\link.9764-cvtres.write.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\link.9764-rc.read.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\link.9764-rc.write.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\link.9764.read.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\link.9764.write.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\link.command.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\link.read.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\link.write.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\metagen.read.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\metagen.write.1.tlog
c:\users\poula\documents\travail\zz2\s3\aide décision\tp\tp2\oad-tp2\code\view\x64\debug\view.tlog\view.write.1u.tlog
......@@ -2,7 +2,7 @@
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\Users\poula\Downloads\oad-tp2\Code\x64\Debug\View.exe</FullPath>
<FullPath>C:\Users\poula\Documents\Travail\ZZ2\S3\Aide Décision\TP\TP2\oad-tp2\Code\x64\Debug\View.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
......
 Entry.cpp
MainForm.cpp
Generating Code...
Entry.obj : MSIL module encountered; incremental linking is disabled for MSIL; performing full link
View.vcxproj -> C:\Users\poula\Downloads\oad-tp2\Code\x64\Debug\View.exe
View.vcxproj -> C:\Users\poula\Documents\Travail\ZZ2\S3\Aide Décision\TP\TP2\oad-tp2\Code\x64\Debug\View.exe
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:TargetPlatformVersion=10.0.19041.0:TargetFrameworkVersion=v4.7.2::EnableManagedIncrementalBuild=true:
Debug|x64|C:\Users\poula\Downloads\oad-tp2\Code\|
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30133:VCServicingVersionATL=14.29.30136:VCServicingVersionCrtHeaders=14.29.30136:VCServicingVersionCompilers=14.29.30136:TargetPlatformVersion=10.0.19041.0:TargetFrameworkVersion=v4.7.2::EnableManagedIncrementalBuild=true:
Debug|x64|C:\Users\poula\Documents\Travail\ZZ2\S3\Aide Décision\TP\TP2\oad-tp2\Code\|
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment