сохранения

This commit is contained in:
klavirshik 2024-08-12 09:44:05 +02:00
parent 54c069946d
commit 7998086761
20 changed files with 297 additions and 172 deletions

View File

@ -7,6 +7,7 @@ using System.Threading.Tasks;
namespace Reseter2
{
[Serializable]
internal class CompId : IComp
{
private int imgIndex=1;

View File

@ -38,7 +38,6 @@
this.tabPage1 = new System.Windows.Forms.TabPage();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.flow_words = new System.Windows.Forms.FlowLayoutPanel();
this.cm_words = new System.Windows.Forms.ContextMenuStrip(this.components);
this.mi_newitem = new System.Windows.Forms.ToolStripMenuItem();
this.mi_edit = new System.Windows.Forms.ToolStripMenuItem();
@ -56,6 +55,7 @@
this.sm_SaveItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.bt_wordsBilder = new System.Windows.Forms.Button();
this.treeView1 = new System.Windows.Forms.TreeView();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout();
@ -108,6 +108,7 @@
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage4);
this.tabControl1.Location = new System.Drawing.Point(2, 39);
this.tabControl1.Multiline = true;
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(410, 714);
@ -138,7 +139,7 @@
//
// tabPage2
//
this.tabPage2.Controls.Add(this.flow_words);
this.tabPage2.Controls.Add(this.treeView1);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
@ -147,16 +148,6 @@
this.tabPage2.Text = "Справочник";
this.tabPage2.UseVisualStyleBackColor = true;
//
// flow_words
//
this.flow_words.AutoScroll = true;
this.flow_words.ContextMenuStrip = this.cm_words;
this.flow_words.Dock = System.Windows.Forms.DockStyle.Fill;
this.flow_words.Location = new System.Drawing.Point(3, 3);
this.flow_words.Name = "flow_words";
this.flow_words.Size = new System.Drawing.Size(396, 682);
this.flow_words.TabIndex = 0;
//
// cm_words
//
this.cm_words.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -319,6 +310,19 @@
this.bt_wordsBilder.UseVisualStyleBackColor = true;
this.bt_wordsBilder.Click += new System.EventHandler(this.bt_wordsBilder_Click);
//
// treeView1
//
this.treeView1.CheckBoxes = true;
this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeView1.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawAll;
this.treeView1.HideSelection = false;
this.treeView1.ItemHeight = 28;
this.treeView1.Location = new System.Drawing.Point(3, 3);
this.treeView1.Name = "treeView1";
this.treeView1.Size = new System.Drawing.Size(396, 682);
this.treeView1.TabIndex = 0;
this.treeView1.DrawNode += new System.Windows.Forms.DrawTreeNodeEventHandler(this.treeView1_DrawNode);
//
// Form1
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@ -331,6 +335,7 @@
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1";
this.Text = "Reseter2";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
this.Load += new System.EventHandler(this.Form1_Load);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
@ -366,13 +371,13 @@
private System.Windows.Forms.ContextMenuStrip cm_history;
private System.Windows.Forms.ToolStripMenuItem sm_RebootItem;
private System.Windows.Forms.ToolStripMenuItem sm_SaveItem;
private System.Windows.Forms.FlowLayoutPanel flow_words;
private System.Windows.Forms.ContextMenuStrip cm_words;
private System.Windows.Forms.ToolStripMenuItem mi_newitem;
private System.Windows.Forms.ToolStripMenuItem mi_edit;
private System.Windows.Forms.ToolStripMenuItem mi_delete;
private System.Windows.Forms.ToolStripMenuItem перезагрузитьОдинToolStripMenuItem;
private System.Windows.Forms.Button bt_wordsBilder;
private System.Windows.Forms.TreeView treeView1;
}
}

View File

@ -5,7 +5,9 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@ -20,7 +22,18 @@ namespace Reseter2
public Form1()
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
FileStream file = new FileStream("res.dat", FileMode.OpenOrCreate);
HistoryList.Hitem = (List<HistoryItem>)binaryFormatter.Deserialize(file);
file.Dispose();
file.Close();
binaryFormatter = new BinaryFormatter();
file = new FileStream("base.dat", FileMode.OpenOrCreate);
WordsList.MainCategory = (WordsCategory)binaryFormatter.Deserialize(file);
file.Dispose();
file.Close();
InitializeComponent();
flowLayoutPanel1.AutoScrollMinSize = new Size(0, 683) ;
@ -29,32 +42,10 @@ namespace Reseter2
HistoryList.Update += Update_lb;
lb_history.DataSource = HistoryList.Hitem;
lb_history.DisplayMember = "ToStr";
WordsCategoryControl wcc = new WordsCategoryControl();
flow_words.Controls.Add(wcc);
WordsItemControl wic1 = new WordsItemControl();
wcc.Add(wic1);
WordsItemControl wic2 = new WordsItemControl();
wcc.Add(wic2);
WordsItemControl wic3 = new WordsItemControl();
wcc.Add(wic3);
WordsItemControl wic4 = new WordsItemControl();
wcc.Add(wic4);
WordsItemControl wic5 = new WordsItemControl();
wcc.Add(wic5);
WordsItemControl wic6 = new WordsItemControl();
wcc.Add(wic6);
WordsItemControl wic10 = new WordsItemControl();
wcc.Add(wic10);
WordsItemControl wic11 = new WordsItemControl();
wcc.Add(wic11);
WordsCategoryControl wcc1 = new WordsCategoryControl();
flow_words.Controls.Add(wcc1);
WordsItemControl wic7 = new WordsItemControl();
wcc1.Add(wic7);
WordsItemControl wic8 = new WordsItemControl();
wcc1.Add(wic8);
treeView1.Nodes.AddRange(WordsList.ListNodes());
tabControl1.SelectedIndex = 1;
}
@ -150,5 +141,39 @@ namespace Reseter2
{
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
FileStream file = new FileStream("res.dat", FileMode.OpenOrCreate);
binaryFormatter.Serialize(file, HistoryList.Hitem);
file.Close();
}
private void treeView1_DrawNode(object sender, DrawTreeNodeEventArgs e)
{
Font font = new Font("Microsoft Sans Serif", 8, FontStyle.Regular);
if (e.Node.IsVisible)
{
if (e.Node.Tag is WordsCategory)
{
font = new Font("Microsoft Sans Serif", 14, FontStyle.Regular);
e.Graphics.FillRectangle(new SolidBrush(Color.LightBlue), e.Bounds.X, e.Bounds.Y, e.Node.TreeView.Width, e.Bounds.Height);
e.Graphics.DrawString(e.Node.Text, font, new SolidBrush(Color.Black), new PointF(e.Bounds.X + 33, e.Bounds.Y));
}
else
{
e.Graphics.DrawString(((WordsComp)e.Node.Tag).GetName(), font, new SolidBrush(Color.Black), new PointF(e.Bounds.X + 3, e.Bounds.Y));
e.Graphics.DrawString(((WordsComp)e.Node.Tag).GetIP(), font, new SolidBrush(Color.Black), new PointF(e.Bounds.X + 103, e.Bounds.Y));
e.Graphics.DrawString(((WordsComp)e.Node.Tag).GetDescription(), font, new SolidBrush(Color.Black), new PointF(e.Bounds.X + 3, e.Bounds.Y+12));
}
}
//e.Bounds
}
}
}

View File

@ -120,12 +120,12 @@
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>122, 17</value>
</metadata>
<metadata name="cm_words.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>319, 17</value>
</metadata>
<metadata name="cm_history.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>209, 17</value>
</metadata>
<metadata name="cm_words.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>319, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View File

@ -7,12 +7,14 @@ using System.Xml;
namespace Reseter2.History
{
[Serializable]
internal class HistoryItem
{
private IComp comp;
[NonSerialized]
private ReseterTask task;
[NonSerialized]
private AStatusTask statusTask;
private DateTime startTime;
private string statusName;

View File

@ -10,6 +10,7 @@ using System.Windows.Forms;
namespace Reseter2.History
{
[Serializable]
internal static class HistoryList
{
static public List<HistoryItem> Hitem = new List<HistoryItem>();

View File

@ -89,6 +89,7 @@
<Compile Include="Words\BilderWords.Designer.cs">
<DependentUpon>BilderWords.cs</DependentUpon>
</Compile>
<Compile Include="Words\IWordsContol.cs" />
<Compile Include="Words\IWordsItem.cs" />
<Compile Include="Words\Resource1.Designer.cs">
<AutoGen>True</AutoGen>

View File

@ -45,8 +45,7 @@
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.panel1);
this.groupBox1.Location = new System.Drawing.Point(225, 13);
@ -75,6 +74,7 @@
this.bt_close.TabIndex = 4;
this.bt_close.Text = "Закрыть";
this.bt_close.UseVisualStyleBackColor = true;
this.bt_close.Click += new System.EventHandler(this.bt_close_Click);
//
// bt_saveClose
//
@ -85,6 +85,7 @@
this.bt_saveClose.TabIndex = 5;
this.bt_saveClose.Text = "Сохранить и закрыть";
this.bt_saveClose.UseVisualStyleBackColor = true;
this.bt_saveClose.Click += new System.EventHandler(this.bt_saveClose_Click);
//
// bt_save
//
@ -95,6 +96,7 @@
this.bt_save.TabIndex = 6;
this.bt_save.Text = "Сохранить";
this.bt_save.UseVisualStyleBackColor = true;
this.bt_save.Click += new System.EventHandler(this.bt_save_Click);
//
// cb_create
//
@ -129,11 +131,13 @@
// treeView1
//
this.treeView1.AllowDrop = true;
this.treeView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.treeView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.treeView1.HideSelection = false;
this.treeView1.ImageIndex = 0;
this.treeView1.ImageList = this.imageList1;
this.treeView1.ItemHeight = 16;
this.treeView1.Location = new System.Drawing.Point(9, 41);
this.treeView1.Name = "treeView1";
this.treeView1.SelectedImageIndex = 1;
@ -172,6 +176,7 @@
this.Controls.Add(this.bt_close);
this.Controls.Add(this.groupBox1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MinimumSize = new System.Drawing.Size(520, 595);
this.Name = "BilderWords";
this.Text = "Редактор справочника";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BilderWords_FormClosing);

View File

@ -1,10 +1,15 @@
using System;
using Reseter2.History;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Odbc;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Security.Cryptography;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@ -15,32 +20,34 @@ namespace Reseter2.Words
internal partial class BilderWords : Form
{
private Control control;
private bool DragOn;
private bool DragOn;
WordsCategory ChangeCategory;
private byte[] hash;
MD5 Hash = MD5.Create();
public BilderWords()
{
InitializeComponent();
WordsList.MainCategory.
WordsCategory WCvebinar = new WordsCategory("Вебинарные");
WordsList.AddItem(WCvebinar, WordsList.MainCategory);
WordsList.AddItem(new WordsComp(new CompId("8.8..8")), WCvebinar);
WordsList.AddItem(new WordsComp(new CompId("8.8.3.8")), WCvebinar);
WordsList.AddItem(new WordsComp(new CompId("8.8.2.8")), WCvebinar);
WordsList.AddItem(new WordsComp(new CompId("8.8.1.8")), WCvebinar);
WordsList.AddItem(new WordsComp(new CompId("1ma00234")), WordsList.MainCategory);
WordsList.AddItem(new WordsComp(new CompId("1ma003333")), WordsList.MainCategory);
WordsCategory WCvebinar1 = new WordsCategory("Вебинарные");
WordsList.AddItem(WCvebinar1, WordsList.MainCategory);
WordsList.AddItem(new WordsComp(new CompId("8.8.8.8")), WCvebinar1);
WordsList.AddItem(new WordsComp(new CompId("8.8.8.2")), WCvebinar1);
WordsList.AddItem(new WordsComp(new CompId("8.8.8.3")), WCvebinar1);
WordsList.AddItem(new WordsComp(new CompId("8.8.8.1")), WCvebinar1);
WordsList.AddItem(new WordsComp(new CompId("1ma00234")), WordsList.MainCategory);
WordsList.AddItem(new WordsComp(new CompId("1ma003333")), WordsList.MainCategory);
BinaryFormatter binaryFormatter = new BinaryFormatter();
MemoryStream Memory = new MemoryStream();
binaryFormatter.Serialize(Memory, WordsList.MainCategory);
Memory.Position = 0;
hash = Hash.ComputeHash(Memory);
Memory.Position = 0;
ChangeCategory = (WordsCategory)binaryFormatter.Deserialize(Memory);
Memory.Dispose();
Memory.Close();
InitializeComponent();
//WordsList.MainCategory.
//// TreeNode trno = new TreeNode("main");
treeView1.Nodes.AddRange(WordsList.ListNodes());
treeView1.Nodes.AddRange(WordsList.ListNodes(ChangeCategory));
//trno.ImageIndex = 1;
cb_create.Items.Add("Категория");
cb_create.Items.Add("Компьютер");
@ -98,7 +105,7 @@ namespace Reseter2.Words
if (selectNode == null)
{
DstCategory = WordsList.MainCategory;
DstCategory = ChangeCategory;
DstNodes = treeView1.Nodes;
if(targetPoint.Y < 5)
{
@ -119,7 +126,7 @@ namespace Reseter2.Words
}
else if (selectNode.Parent == null)
{
DstCategory = WordsList.MainCategory;
DstCategory = ChangeCategory;
DstNodes = treeView1.Nodes;
index = selectNode.Index + indexMod;
}
@ -134,12 +141,12 @@ namespace Reseter2.Words
TreeNodeCollection SrcNodes;
if (moveNode == null)
{
SrcCategory = WordsList.MainCategory;
SrcCategory = ChangeCategory;
SrcNodes = treeView1.Nodes;
}
else if (moveNode.Parent == null)
{
SrcCategory = WordsList.MainCategory;
SrcCategory = ChangeCategory;
SrcNodes = treeView1.Nodes;
}
@ -224,7 +231,7 @@ namespace Reseter2.Words
int index = 0;
if(selectNode == null)
{
ParentCategory = WordsList.MainCategory;
ParentCategory = ChangeCategory;
ParentNodes = treeView1.Nodes;
}
else if(selectNode.Tag is WordsCategory)
@ -235,7 +242,7 @@ namespace Reseter2.Words
}
else if (selectNode.Parent == null)
{
ParentCategory = WordsList.MainCategory;
ParentCategory = ChangeCategory;
ParentNodes = treeView1.Nodes;
index = selectNode.Index+1;
}
@ -292,7 +299,7 @@ namespace Reseter2.Words
control.Dispose();
if (selectNode.Parent == null)
{
ParentCategory = WordsList.MainCategory;
ParentCategory = ChangeCategory;
ParentNodes = treeView1.Nodes;
}
else
@ -350,5 +357,64 @@ namespace Reseter2.Words
{
}
private void bt_saveClose_Click(object sender, EventArgs e)
{
control.Visible = false;
control.Dispose();
BinaryFormatter binaryFormatter = new BinaryFormatter();
FileStream file = new FileStream("base.dat", FileMode.OpenOrCreate);
binaryFormatter.Serialize(file, ChangeCategory);
file.Close();
WordsList.MainCategory = ChangeCategory;
this.Close();
}
private void bt_save_Click(object sender, EventArgs e)
{
control.Visible = false;
control.Visible = true;
BinaryFormatter binaryFormatter = new BinaryFormatter();
FileStream file = new FileStream("base.dat", FileMode.OpenOrCreate);
binaryFormatter.Serialize(file, ChangeCategory);
file.Close();
WordsList.MainCategory = ChangeCategory;
}
private void bt_close_Click(object sender, EventArgs e)
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
MemoryStream Memory = new MemoryStream();
binaryFormatter.Serialize(Memory, ChangeCategory);
Memory.Position = 0;
byte[] hashSave = Hash.ComputeHash(Memory);
if (!hash.SequenceEqual(hashSave))
{
DialogResult result = MessageBox.Show("Внесенны изменения сохранить ли?", "Изменения не сохраненны", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
switch (result)
{
case DialogResult.Yes:
FileStream file = new FileStream("base.dat", FileMode.OpenOrCreate);
Memory.Position = 0;
Memory.CopyTo(file);
Memory.Close();
Memory.Dispose();
file.Close();
file.Dispose();
WordsList.MainCategory = ChangeCategory;
this.Close();
break;
case DialogResult.No:
this.Close();
break;
}
}
else
{
this.Close();
}
}
}
}

View File

@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACQ
JAAAAk1TRnQBSQFMAgEBCQEAARABAAEQAQABEAEAARABAAT/AREBAAj/AUIBTQE2BwABNgMAASgDAAFA
JAAAAk1TRnQBSQFMAgEBCQEAATgBAAE4AQABEAEAARABAAT/AREBAAj/AUIBTQE2BwABNgMAASgDAAFA
AwABMAMAAQEBAAEQBgABGBIAAf8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/
AX8B/wF/Af8BfwH/AX8B/wF/Af8Bf2AAAf8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/
Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8Bf2AAAf8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Reseter2.Words
{
internal interface IWordsContol
{
}
}

View File

@ -7,17 +7,17 @@ using System.Windows.Forms;
namespace Reseter2.Words
{
[Serializable]
internal abstract class IWordsItem
{
public abstract List<WordsComp> ChekList();
public abstract List<WordsCategory> CategoryList();
public abstract void ChekChange(bool chek);
public abstract void Delete();
public abstract TreeNode NodeList();
public abstract bool ChekMove(IWordsItem wordsItem);
public abstract IWordsItem Clone();

View File

@ -8,10 +8,10 @@ using System.Windows.Forms;
namespace Reseter2.Words
{
[Serializable]
internal class WordsCategory : IWordsItem
{
private string Name;
private bool cheked;
private List<IWordsItem> items;
public WordsCategory(string name)
@ -57,6 +57,11 @@ namespace Reseter2.Words
return items[item];
}
public List<IWordsItem> Items()
{
return items;
}
public int Count()
{
return items.Count;
@ -86,23 +91,7 @@ namespace Reseter2.Words
}
items.Clear();
}
public override void ChekChange(bool chek)
{
cheked = chek;
foreach(var item in items)
{
item.ChekChange(chek);
}
}
public override List<WordsComp> ChekList()
{
List<WordsComp> itemsChek = new List<WordsComp>();
foreach (var item in items)
{
itemsChek.AddRange(item.ChekList());
}
return itemsChek;
}
public override List<WordsCategory> CategoryList()
{
List<WordsCategory> itemsCatrgory = new List<WordsCategory>();
@ -129,11 +118,6 @@ namespace Reseter2.Words
return treeNode;
}
public override IWordsItem Clone()
{
// List<IWordsItem> list = items.CopyTo();
WordsCategory clone = new WordsCategory(Name);
return this;
}
}
}

View File

@ -29,8 +29,7 @@
private void InitializeComponent()
{
this.Select = new System.Windows.Forms.CheckBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.lb_name = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.flow_wordsItem = new System.Windows.Forms.FlowLayoutPanel();
this.SuspendLayout();
@ -44,30 +43,20 @@
this.Select.TabIndex = 1;
this.Select.UseVisualStyleBackColor = true;
//
// label2
// lb_name
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 5);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(367, 13);
this.label2.TabIndex = 0;
this.label2.Text = "____________________________________________________________";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(23, 2);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(88, 13);
this.label3.TabIndex = 2;
this.label3.Text = "Вебинарные ПК";
this.lb_name.AutoSize = true;
this.lb_name.Location = new System.Drawing.Point(47, 3);
this.lb_name.Name = "lb_name";
this.lb_name.Size = new System.Drawing.Size(88, 13);
this.lb_name.TabIndex = 2;
this.lb_name.Text = "Вебинарные ПК";
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label1.Location = new System.Drawing.Point(366, -4);
this.label1.Location = new System.Drawing.Point(21, -4);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(30, 29);
this.label1.TabIndex = 3;
@ -81,9 +70,9 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.flow_wordsItem.AutoSize = true;
this.flow_wordsItem.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flow_wordsItem.Location = new System.Drawing.Point(0, 20);
this.flow_wordsItem.Location = new System.Drawing.Point(5, 20);
this.flow_wordsItem.Name = "flow_wordsItem";
this.flow_wordsItem.Size = new System.Drawing.Size(403, 5);
this.flow_wordsItem.Size = new System.Drawing.Size(395, 5);
this.flow_wordsItem.TabIndex = 4;
this.flow_wordsItem.WrapContents = false;
//
@ -92,13 +81,14 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.Controls.Add(this.flow_wordsItem);
this.Controls.Add(this.Select);
this.Controls.Add(this.label1);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.lb_name);
this.Name = "WordsCategoryControl";
this.Size = new System.Drawing.Size(403, 25);
this.Size = new System.Drawing.Size(401, 25);
this.Load += new System.EventHandler(this.WordsCategoryControl_Load);
this.ResumeLayout(false);
this.PerformLayout();
@ -106,8 +96,7 @@
#endregion
private System.Windows.Forms.CheckBox Select;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label lb_name;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.FlowLayoutPanel flow_wordsItem;
}

View File

@ -11,12 +11,27 @@ using System.Windows.Forms;
namespace Reseter2.Words
{
[DefaultEvent(nameof(WordsCategoryControl))]
partial class WordsCategoryControl : UserControl
partial class WordsCategoryControl : UserControl, IWordsContol
{
public WordsCategoryControl()
{
InitializeComponent();
}
public WordsCategoryControl(WordsCategory wordsCategoty)
{
InitializeComponent();
lb_name.Text = wordsCategoty.GetName();
foreach (IWordsItem item in wordsCategoty.Items())
{
if(item is WordsCategory)
{
flow_wordsItem.Controls.Add(new WordsCategoryControl((WordsCategory)item));
}else if(item is WordsComp)
{
flow_wordsItem.Controls.Add(new WordsItemControl((WordsComp)item));
}
}
}
public void Add(WordsItemControl wic)
{
@ -26,7 +41,12 @@ namespace Reseter2.Words
private void label1_Click(object sender, EventArgs e)
{
flow_wordsItem.Visible = !flow_wordsItem.Visible;
//flow_wordsItem.s
}
private void WordsCategoryControl_Load(object sender, EventArgs e)
{
}
}
}

View File

@ -5,13 +5,14 @@ using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
namespace Reseter2.Words
{
[Serializable]
internal class WordsComp : IWordsItem
{
private IComp Comp;
private bool cheked;
public WordsComp(IComp comp)
{
@ -70,23 +71,14 @@ namespace Reseter2.Words
}
return null;
}
public override void ChekChange(bool chek)
{
cheked = chek;
}
public override void Delete()
{
Comp = null;
}
public override List<WordsComp> ChekList()
{
List<WordsComp> itemsChek = new List<WordsComp>();
if (cheked) {itemsChek.Add(this); }
return itemsChek;
}
public override List<WordsCategory> CategoryList()
{
return new List<WordsCategory>();
@ -99,5 +91,6 @@ namespace Reseter2.Words
treeNode.SelectedImageIndex = Comp.GetImage();
return treeNode;
}
}
}

View File

@ -56,10 +56,11 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.Controls.Add(this.lb_name);
this.Controls.Add(this.label1);
this.Name = "WordsEditCategoryControl";
this.Size = new System.Drawing.Size(254, 52);
this.Size = new System.Drawing.Size(254, 49);
this.VisibleChanged += new System.EventHandler(this.WordsEditCategoryControl_VisibleChanged);
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -33,8 +33,9 @@
this.lb_name = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.lb_ip = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.lb_dsp = new System.Windows.Forms.Label();
this.pb_icon = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pb_icon)).BeginInit();
this.SuspendLayout();
//
// checkBox1
@ -49,7 +50,7 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(31, 0);
this.label1.Location = new System.Drawing.Point(50, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(47, 13);
this.label1.TabIndex = 1;
@ -58,11 +59,10 @@
// lb_name
//
this.lb_name.AutoSize = true;
this.lb_name.Location = new System.Drawing.Point(84, 0);
this.lb_name.Location = new System.Drawing.Point(103, 0);
this.lb_name.Name = "lb_name";
this.lb_name.Size = new System.Drawing.Size(65, 13);
this.lb_name.Size = new System.Drawing.Size(0, 13);
this.lb_name.TabIndex = 2;
this.lb_name.Text = "1MA001234";
//
// label2
//
@ -78,34 +78,31 @@
this.lb_ip.AutoSize = true;
this.lb_ip.Location = new System.Drawing.Point(239, 0);
this.lb_ip.Name = "lb_ip";
this.lb_ip.Size = new System.Drawing.Size(70, 13);
this.lb_ip.Size = new System.Drawing.Size(0, 13);
this.lb_ip.TabIndex = 4;
this.lb_ip.Text = "10,3,100,252";
//
// label3
// lb_dsp
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(31, 15);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(57, 13);
this.label3.TabIndex = 5;
this.label3.Text = "Описание";
this.lb_dsp.AutoSize = true;
this.lb_dsp.Location = new System.Drawing.Point(50, 13);
this.lb_dsp.Name = "lb_dsp";
this.lb_dsp.Size = new System.Drawing.Size(0, 13);
this.lb_dsp.TabIndex = 6;
//
// label4
// pb_icon
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(88, 15);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(220, 13);
this.label4.TabIndex = 6;
this.label4.Text = "Контролер оповещения физлица главный";
this.pb_icon.Location = new System.Drawing.Point(27, 3);
this.pb_icon.Name = "pb_icon";
this.pb_icon.Size = new System.Drawing.Size(20, 20);
this.pb_icon.TabIndex = 7;
this.pb_icon.TabStop = false;
//
// WordsItemControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.pb_icon);
this.Controls.Add(this.lb_dsp);
this.Controls.Add(this.lb_ip);
this.Controls.Add(this.label2);
this.Controls.Add(this.lb_name);
@ -114,6 +111,7 @@
this.Name = "WordsItemControl";
this.Size = new System.Drawing.Size(371, 27);
this.Load += new System.EventHandler(this.WordsItemControl_Load);
((System.ComponentModel.ISupportInitialize)(this.pb_icon)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -126,7 +124,7 @@
private System.Windows.Forms.Label lb_name;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label lb_ip;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label lb_dsp;
private System.Windows.Forms.PictureBox pb_icon;
}
}

View File

@ -12,7 +12,7 @@ namespace Reseter2.Words
{
[DefaultEvent(nameof(WordsItemControl))]
public partial class WordsItemControl : UserControl
internal partial class WordsItemControl : UserControl, IWordsContol
{
public WordsItemControl()
@ -20,6 +20,15 @@ namespace Reseter2.Words
InitializeComponent();
}
public WordsItemControl(WordsComp wordsComp)
{
InitializeComponent();
lb_ip.Text = wordsComp.GetIP();
lb_name.Text = wordsComp.GetName();
lb_dsp.Text = wordsComp.GetDescription();
}
private void WordsItemControl_Load(object sender, EventArgs e)
{

View File

@ -8,6 +8,7 @@ using System.Windows.Forms;
namespace Reseter2.Words
{
[Serializable]
static class WordsList
{
public static WordsCategory MainCategory = new WordsCategory("Main");
@ -35,5 +36,16 @@ namespace Reseter2.Words
return treeNodes;
}
public static TreeNode[] ListNodes(WordsCategory ChangeCategory)
{
TreeNode[] treeNodes = new TreeNode[ChangeCategory.Count()];
for (int i = 0; i < ChangeCategory.Count(); i++)
{
treeNodes[i] = ChangeCategory.Items(i).NodeList();
}
return treeNodes;
}
}
}