Merge pull request #35 from IngenerkaTeamCenter/ArkLightning-patch-1

Добавил сохранение и редактирование
This commit is contained in:
Mikhail Abramov 2018-04-11 12:37:40 +04:00 committed by GitHub
commit f780509b66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,13 +23,17 @@ namespace WindowsFormsApplication1
public String coord; public String coord;
public String coord2; public String coord2;
public String adress; public String adress;
public String time1;
public String time2;
public String sprite;
public String moveside;
}; };
Person[] persons = new Person[200]; Person[] persons = new Person[200];
int yPersa = 300; int yPersa = 300;
int nomerPersa = 0; int nomerPersa = 0;
int pNomer = 0;
PictureBox[] pic1 = new PictureBox[1000]; PictureBox[] pic1 = new PictureBox[1000];
public MainForm() public MainForm()
@ -45,6 +49,7 @@ namespace WindowsFormsApplication1
private void buttonAddCharClick(object sender, EventArgs e) private void buttonAddCharClick(object sender, EventArgs e)
{ {
panel3.Visible = true; panel3.Visible = true;
pNomer = -120;
} }
private string PersonName(int nomer) private string PersonName(int nomer)
@ -97,15 +102,14 @@ namespace WindowsFormsApplication1
private void SaveCharButtonClick(object sender, EventArgs e) private void SaveCharButtonClick(object sender, EventArgs e)
{ {
String[] arr = TextBoxWall1.Text.Split(new String[] { " " }, StringSplitOptions.None); if (pNomer == -120)
MessageBox.Show(arr[0]); {
persons[nomerPersa].l1 = new Label(); persons[nomerPersa].l1 = new Label();
persons[nomerPersa].l1.Top = yPersa; persons[nomerPersa].l1.Top = yPersa;
persons[nomerPersa].l1.Left = 30; persons[nomerPersa].l1.Left = 30;
persons[nomerPersa].l1.Width = 20; persons[nomerPersa].l1.Width = 20;
persons[nomerPersa].l1.Visible = true; persons[nomerPersa].l1.Visible = true;
persons[nomerPersa].l1.Text = nomerPersa.ToString()+1; persons[nomerPersa].l1.Text = (nomerPersa + 1).ToString();
this.panel1.Controls.Add(persons[nomerPersa].l1); this.panel1.Controls.Add(persons[nomerPersa].l1);
persons[nomerPersa].l2 = new Label(); persons[nomerPersa].l2 = new Label();
@ -113,7 +117,7 @@ namespace WindowsFormsApplication1
persons[nomerPersa].l2.Left = 60; persons[nomerPersa].l2.Left = 60;
persons[nomerPersa].l2.Width = 60; persons[nomerPersa].l2.Width = 60;
persons[nomerPersa].l2.Visible = true; persons[nomerPersa].l2.Visible = true;
persons[nomerPersa].l2.Text = "Перс " + nomerPersa.ToString()+1; persons[nomerPersa].l2.Text = "Перс" + (nomerPersa + 1).ToString();
this.panel1.Controls.Add(persons[nomerPersa].l2); this.panel1.Controls.Add(persons[nomerPersa].l2);
persons[nomerPersa].l3 = new Label(); persons[nomerPersa].l3 = new Label();
@ -129,7 +133,7 @@ namespace WindowsFormsApplication1
persons[nomerPersa].b1.Left = 170; persons[nomerPersa].b1.Left = 170;
persons[nomerPersa].b1.Width = 50; persons[nomerPersa].b1.Width = 50;
persons[nomerPersa].b1.Visible = true; persons[nomerPersa].b1.Visible = true;
persons[nomerPersa].b1.Text = "view" + nomerPersa.ToString(); persons[nomerPersa].b1.Text = "Edit";
persons[nomerPersa].b1.MouseClick += persons[nomerPersa].b1.MouseClick +=
new MouseEventHandler(this.button1_Click_2); new MouseEventHandler(this.button1_Click_2);
this.panel1.Controls.Add(persons[nomerPersa].b1); this.panel1.Controls.Add(persons[nomerPersa].b1);
@ -160,12 +164,30 @@ namespace WindowsFormsApplication1
persons[nomerPersa].coord = TextBoxWall1.Text; persons[nomerPersa].coord = TextBoxWall1.Text;
persons[nomerPersa].coord2 = TextBoxWall2.Text; persons[nomerPersa].coord2 = TextBoxWall2.Text;
persons[nomerPersa].time1 = TextBoxTime1.Text;
persons[nomerPersa].time2 = TextBoxTime2.Text;
persons[nomerPersa].sprite = SpriteNumberTextBox.Text;
persons[nomerPersa].moveside = ComboBoxMove.Text;
persons[nomerPersa].nomer = nomerPersa; persons[nomerPersa].nomer = nomerPersa;
nomerPersa++; nomerPersa++;
yPersa = yPersa + 30; yPersa = yPersa + 30;
openSpace.Image = null; openSpace.Image = null;
} }
else
{
persons[pNomer].coord = TextBoxWall1.Text;
persons[pNomer].coord2 = TextBoxWall2.Text;
persons[pNomer].time1 = TextBoxTime1.Text;
persons[pNomer].time2 = TextBoxTime2.Text;
persons[pNomer].sprite = SpriteNumberTextBox.Text;
persons[pNomer].moveside = ComboBoxMove.Text;
persons[pNomer].nomer = pNomer;
}
String[] arr = TextBoxWall1.Text.Split(new String[] { " " }, StringSplitOptions.None);
//MessageBox.Show(arr[0]);
}
private void circle_create_person(string filename, string name) private void circle_create_person(string filename, string name)
{ {
@ -227,8 +249,15 @@ namespace WindowsFormsApplication1
if (openFileDialog1.ShowDialog() == DialogResult.Cancel) if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
return; return;
openSpace.Image = Image.FromFile(openFileDialog1.FileName); openSpace.Image = Image.FromFile(openFileDialog1.FileName);
if (pNomer == -120)
{
persons[nomerPersa].adress = openFileDialog1.FileName; persons[nomerPersa].adress = openFileDialog1.FileName;
} }
else
{
persons[pNomer].adress = openFileDialog1.FileName;
}
}
private void AddBackArtClick(object sender, EventArgs e) private void AddBackArtClick(object sender, EventArgs e)
{ {
@ -305,6 +334,11 @@ namespace WindowsFormsApplication1
{ {
TextBoxWall1.Text = persons[nomer].coord; TextBoxWall1.Text = persons[nomer].coord;
TextBoxWall2.Text = persons[nomer].coord2; TextBoxWall2.Text = persons[nomer].coord2;
TextBoxTime1.Text = persons[nomer].time1;
TextBoxTime2.Text = persons[nomer].time2;
SpriteNumberTextBox.Text = persons[nomer].sprite;
ComboBoxMove.Text = persons[nomer].moveside;
pNomer = persons[nomer].nomer;
if (!String.IsNullOrEmpty(persons[nomer].adress)) if (!String.IsNullOrEmpty(persons[nomer].adress))
{ {
@ -320,7 +354,6 @@ namespace WindowsFormsApplication1
private void LabelBackground_Click(object sender, EventArgs e) private void LabelBackground_Click(object sender, EventArgs e)
{ {
} }
private void label1_Click(object sender, EventArgs e) private void label1_Click(object sender, EventArgs e)