6 years ago
parent
commit
eb8b6f414c
  1. 1
      Vlimport/Form1.Designer.cs
  2. 6
      Vlimport/Form1.cs
  3. 27
      Vlimport/Transporter.cs

1
Vlimport/Form1.Designer.cs generated

@ -62,6 +62,7 @@
this.AcceptButton.TabIndex = 2;
this.AcceptButton.Text = "Добавить значения";
this.AcceptButton.UseVisualStyleBackColor = true;
this.AcceptButton.Click += new System.EventHandler(this.AcceptButton_Click);
//
// FilePathBox
//

6
Vlimport/Form1.cs

@ -39,5 +39,11 @@ namespace Vlimport
Transporter tr = new Transporter();
tr.CollectItems(filename, ItemList);
}
private void AcceptButton_Click(object sender, EventArgs e)
{
Transporter trr = new Transporter();
trr.addItems();
}
}
}

27
Vlimport/Transporter.cs

@ -14,6 +14,8 @@ namespace Vlimport
{
public class Transporter
{
static List<Operations> operations = new List<Operations>(); //Объявляю список
public void CollectItems(string filePath, ListBox Itemlist)
{
@ -28,7 +30,6 @@ namespace Vlimport
foreach (XmlNode oper in mySearch)
{
List<Operations> operations = new List<Operations>(); //Объявляю список
//Operations operation = new Operations();
@ -37,8 +38,6 @@ namespace Vlimport
var operId = oper.XPath2SelectSingleNode("//Attribute[@Name='indexoper']").Attributes["Value"].Value;
var operName = oper.XPath2SelectSingleNode("//Attribute[@Name='nameoper']").Attributes["Value"].Value;
//Itemlist.Items.Add($"{operId} {operName}"); // Тут мы добавляем название операций прямо в листвью
operations.Add(new Operations(operId, operName));
foreach (XmlNode step in oper.XPath2SelectNodes("//Object[ends-with(@Name,'_step')]"))
@ -46,18 +45,28 @@ namespace Vlimport
var stepNum = step.XPath2SelectSingleNode("//Attribute[@Name='numstep']").Attributes["Value"].Value;
var stepName = step.XPath2SelectSingleNode("//Attribute[@Name='name']").Attributes["Value"].Value;
//Itemlist.Items.Add($" {stepNum}. {stepName}"); // Тут добавляем название переходов в листвью
operations.Add(new Operations(stepNum, stepName));
}
foreach (Operations op in operations)
{
Itemlist.Items.Add(op);
}
}
foreach (Operations op in operations)
{
Itemlist.Items.Add(op);
}
}
public void addItems()
{
using (TextWriter tw = new StreamWriter("SavedList.txt"))
{
foreach (Operations oop in operations)
tw.WriteLine(oop);
}
}
}
}

Loading…
Cancel
Save