Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

218 changes: 81 additions & 137 deletions sources/CandidatesParser/CandidateForms/CandidatesParserMainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,190 +21,134 @@ public CandidatesParserMainForm()
{
InitializeComponent();

form1OrigHight = this.Height;
form1OrigWidth = this.Width;
form1MainLayoutOrigHeight = this.layoutControl1.Height;
form1MainLayoutOrigWidth = this.layoutControl1.Width;
origHeight = this.Height;
origWidth = this.Width;
mainLayoutOrigHeight = this.layoutControl.Height;
mainLayoutOrigWidth = this.layoutControl.Width;


}

private void Form1_Button_OK_Click(object sender, EventArgs e)

//////////////////////////////////// FormResizeStyle \\\\\\\\\\\\\\\\\\\\\\\\\++
private void ResizeFormInside(object sender, EventArgs e)
{
if (File.Exists(Form1_TextField_FilePath.Text) == true)
{
manager.Read(Form1_TextField_FilePath.Text);
CandidatesParserSelectData modalForm1 = new CandidatesParserSelectData(manager);
modalForm1.ShowDialog();
}
else
{
showErrorMessage_FlieDoesNotExist();
}
}
float percent1 = (float)this.Height / origHeight;
float percent2 = (float)this.Width / origWidth;

float percent = (percent1 < percent2) ? (percent1) : (percent2);

this.layoutControl.Height = (int)(percent * mainLayoutOrigHeight);
this.layoutControl.Width = (int)(percent * mainLayoutOrigWidth);

//////////////////////////////////// FormResizeStyle \\\\\\\\\\\\\\\\\\\\\\\\\++
private void resizeFormInsisePutToCenter()
TextResize(percent);
ResizeFormInsidePutToCenter();
}
private void TextResize(float percent)
{
this.textField_FilePath.Font = new System.Drawing.Font("Tahoma", (float)(8.25 * percent));
this.layoutControl_Button_Unused.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 2, this.layoutControl_Button_Unused.Height - (button_FilePath.Height));
}
private void ResizeFormInsidePutToCenter()
{
if(this.Width > form1OrigWidth)
if (this.Width > origWidth)
{
this.layoutControl1.Left = 0
+ (this.Width
- (this.form1OrigWidth - form1MainLayoutOrigWidth)
- this.layoutControl1.Width) / 2;
this.layoutControl.Left = 0
+ (this.Width
- (this.origWidth - mainLayoutOrigWidth)
- this.layoutControl.Width) / 2;
}
else
{
this.layoutControl1.Left = 0;
this.layoutControl.Left = 0;
}

if (this.Height > form1OrigHight)
if (this.Height > origHeight)
{
this.layoutControl1.Top = 0
this.layoutControl.Top = 0
+ (this.Height
- (this.form1OrigHight - form1MainLayoutOrigHeight)
- this.layoutControl1.Height) / 2;
- (this.origHeight - mainLayoutOrigHeight)
- this.layoutControl.Height) / 2;
}
else
{
this.layoutControl1.Top = 0;
this.layoutControl.Top = 0;
}


}
private void textResize(float percent)
{
this.Form1_TextField_FilePath.Font = new System.Drawing.Font("Tahoma", (float)(8.25 * percent));
this.layoutControlItem5.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 2, this.layoutControlItem5.Height - (Form1_Button_FilePath.Height));
}
private void resizeFormInside(object sender, EventArgs e)
{
float percent1 = (float)this.Height / form1OrigHight;
float percent2 = (float)this.Width / form1OrigWidth;

float percent = (percent1 < percent2) ? (percent1) : (percent2);

this.layoutControl1.Height = (int)(percent * form1MainLayoutOrigHeight);
this.layoutControl1.Width = (int)(percent * form1MainLayoutOrigWidth);

textResize(percent);
resizeFormInsisePutToCenter();
}
private void XtraForm1_ResizeEnd(object sender, EventArgs e)

private void ResizeFormEnd(object sender, EventArgs e)
{

float percent1 = (float)this.Height / this.form1OrigHight;
float percent2 = (float)this.Width / this.form1OrigWidth;
float percent1 = (float)this.Height / this.origHeight;
float percent2 = (float)this.Width / this.origWidth;

float percent = (percent1 < percent2) ? (percent1) : (percent2);

this.Height = (int)(percent * this.form1OrigHight);
this.Width = (int)(percent * this.form1OrigWidth);

this.Height = (int)(percent * this.origHeight);
this.Width = (int)(percent * this.origWidth);
}

private void Form1_Button_FilePath_Click(object sender, EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();

openFileDialog1.InitialDirectory = "c:\\";
openFileDialog1.Filter = "txt files (*.txt)|*.txt";
openFileDialog1.FilterIndex = 2;
openFileDialog1.RestoreDirectory = true;

if (openFileDialog1.ShowDialog() == DialogResult.OK)
//////////////////////////////////// Buttons and Actions \\\\\\\\\\\\\\\\\\\\\\\\\++
private void Button_OK_Click(object sender, EventArgs e)
{
if (File.Exists(textField_FilePath.Text))
{
Form1_TextField_FilePath.Text = openFileDialog1.FileName;


bool error = false;
try
{
manager.Read(textField_FilePath.Text);
}
catch
{
MessageBox.Show(this.msgErrorIncorrectStruct);
error = true;
// Maybe it not a good method, but program is working :)
}
if (!error)
{
CandidatesParserSelectData modalFormForSelectData = new CandidatesParserSelectData(manager);
modalFormForSelectData.ShowDialog();
}
}
else
{
showErrorMessage_FlieDoesNotExist();
if (textField_FilePath.Text == emptyFilePathString)
{
MessageBox.Show(this.msgErrorEmptyFilePath);
}
else
{
MessageBox.Show(this.msgErrorIncorrectFilePath);
}
}

}

private void showErrorMessage_FlieDoesNotExist()
private void Button_FilePath_Click(object sender, EventArgs e)
{
MessageBox.Show("Ошибка: Невозможно считать файл с диска!!!");
}
OpenFileDialog openFileDialog = new OpenFileDialog();

private void Form1_TextField_FilePath_Leave(object sender, EventArgs e)
{
if (Form1_TextField_FilePath.Text == "")
openFileDialog.InitialDirectory = "c:\\";
openFileDialog.Filter = this.fileFormatFilter;
openFileDialog.FilterIndex = 2;
openFileDialog.RestoreDirectory = true;

if (openFileDialog.ShowDialog() == DialogResult.OK)
{
Form1_TextField_FilePath.Text = "Путь к файлу...";
textField_FilePath.Text = openFileDialog.FileName;
}
}

private void Form1_TextField_FilePath_MouseClick(object sender, EventArgs e)
private void TextField_FilePath_Leave(object sender, EventArgs e)
{
Form1_TextField_FilePath.Text = "";
}
//////// Just Copy
/*
private void resizeFormInsisePutToCenter()
{
if(this.Width > form1OrigWidth)
{
this.layoutControl1.Left = 0
+ (this.Width
- (this.form1OrigWidth - form1MainLayoutOrigWidth)
- this.layoutControl1.Width) / 2;
}
else
if (textField_FilePath.Text == "")
{
this.layoutControl1.Left = 0;
textField_FilePath.Text = emptyFilePathString;
}

if (this.Height > form1OrigHight)
{
this.layoutControl1.Top = 0
+ (this.Height
- (this.form1OrigHight - form1MainLayoutOrigHeight)
- this.layoutControl1.Height) / 2;
}
else
{
this.layoutControl1.Top = 0;
}


}
private void textResize(float percent)
private void TextField_FilePath_MouseClick(object sender, EventArgs e)
{
this.Form1_TextField_FilePath.Font = new System.Drawing.Font("Tahoma", (float)(8.25 * percent));
this.layoutControlItem5.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 2, this.layoutControlItem5.Height - (Form1_Button_FilePath.Height));
textField_FilePath.Text = "";
}
private void resizeFormInside(object sender, EventArgs e)
{
float percent1 = (float)this.Height / form1OrigHight;
float percent2 = (float)this.Width / form1OrigWidth;

float percent = (percent1 < percent2) ? (percent1) : (percent2);

this.layoutControl1.Height = (int)(percent * form1MainLayoutOrigHeight);
this.layoutControl1.Width = (int)(percent * form1MainLayoutOrigWidth);

textResize(percent);
resizeFormInsisePutToCenter();
}

private void XtraForm1_ResizeEnd(object sender, EventArgs e)
{

float percent1 = (float)this.Height / this.form1OrigHight;
float percent2 = (float)this.Width / this.form1OrigWidth;

float percent = (percent1 < percent2) ? (percent1) : (percent2);

this.Height = (int)(percent * this.form1OrigHight);
this.Width = (int)(percent * this.form1OrigWidth);

}
*/
///////////////////////////////////////////////////////////////////////////////////////
}
}
Loading