Добавили картинок

This commit is contained in:
klavirshik 2024-08-10 18:15:24 +02:00
parent 89cd78f048
commit 54c069946d
27 changed files with 5135 additions and 58 deletions

View File

@ -9,6 +9,7 @@ namespace Reseter2
{ {
internal class CompId : IComp internal class CompId : IComp
{ {
private int imgIndex=1;
private string Name { get; set; } private string Name { get; set; }
private string Description { get; set; } private string Description { get; set; }
private IPAddress Ip { get; set; } private IPAddress Ip { get; set; }
@ -45,6 +46,10 @@ namespace Reseter2
{ {
return Ip; return Ip;
} }
public int GetImage()
{
return imgIndex;
}
public void SetIP(IPAddress ip) public void SetIP(IPAddress ip)
{ {
@ -54,6 +59,10 @@ namespace Reseter2
{ {
Name = name; Name = name;
} }
public void SetImage(int image)
{
imgIndex = image;
}
public void SetDescription(string description) public void SetDescription(string description)
{ {
Description = description; Description = description;

View File

@ -29,6 +29,7 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.tb_comp = new System.Windows.Forms.TextBox(); this.tb_comp = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.bt_reset = new System.Windows.Forms.Button(); this.bt_reset = new System.Windows.Forms.Button();
@ -114,7 +115,7 @@
// //
// tabPage1 // tabPage1
// //
this.tabPage1.BackColor = System.Drawing.SystemColors.Control; this.tabPage1.BackColor = System.Drawing.SystemColors.Window;
this.tabPage1.Controls.Add(this.flowLayoutPanel1); this.tabPage1.Controls.Add(this.flowLayoutPanel1);
this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1"; this.tabPage1.Name = "tabPage1";
@ -126,6 +127,7 @@
// flowLayoutPanel1 // flowLayoutPanel1
// //
this.flowLayoutPanel1.AutoScroll = true; this.flowLayoutPanel1.AutoScroll = true;
this.flowLayoutPanel1.BackColor = System.Drawing.SystemColors.Window;
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3); this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
@ -326,8 +328,10 @@
this.Controls.Add(this.bt_reset); this.Controls.Add(this.bt_reset);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.tb_comp); this.Controls.Add(this.tb_comp);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1"; this.Name = "Form1";
this.Text = "Reseter2"; this.Text = "Reseter2";
this.Load += new System.EventHandler(this.Form1_Load);
this.tabControl1.ResumeLayout(false); this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false); this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false); this.tabPage2.ResumeLayout(false);

View File

@ -145,5 +145,10 @@ namespace Reseter2
BilderWords bilderWords = new BilderWords(); BilderWords bilderWords = new BilderWords();
bilderWords.ShowDialog(); bilderWords.ShowDialog();
} }
private void Form1_Load(object sender, EventArgs e)
{
}
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -12,9 +12,11 @@ namespace Reseter2
string GetName(); string GetName();
string GetResetName(); string GetResetName();
IPAddress GetIP(); IPAddress GetIP();
int GetImage();
void SetIP(IPAddress ip); void SetIP(IPAddress ip);
void SetName(string name); void SetName(string name);
void SetImage(int imdexImg);
void SetDescription(string description); void SetDescription(string description);
string GetDescription(); string GetDescription();

View File

@ -78,9 +78,9 @@ namespace Reseter2
StatusTask.RebootReturn(); StatusTask.RebootReturn();
} }
public void SetNameStage(string nameStage) public void SetNameStage(string nameStage, int indexImg)
{ {
taskControl.SetNameStage(nameStage); taskControl.SetNameStage(nameStage, indexImg);
} }
public PingResult Ping() public PingResult Ping()
{ {

View File

@ -32,6 +32,9 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<ApplicationIcon>reseter.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -169,5 +172,8 @@
<ItemGroup> <ItemGroup>
<None Include="Resources\comp.png" /> <None Include="Resources\comp.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="reseter.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@ -11,7 +11,7 @@ namespace Reseter2
private PingResult PingResult; private PingResult PingResult;
public StatusCanceled(ReseterTask reseterTask) : base(reseterTask) public StatusCanceled(ReseterTask reseterTask) : base(reseterTask)
{ {
resetertask.SetNameStage("Отмененно"); resetertask.SetNameStage("Отмененно", 4);
resetertask.historyItem.SetEndTime(DateTime.Now); resetertask.historyItem.SetEndTime(DateTime.Now);
PingResult = resetertask.Ping(); PingResult = resetertask.Ping();
reseterTask.sw.Stop(); reseterTask.sw.Stop();

View File

@ -15,7 +15,7 @@ namespace Reseter2
private PingResult PingResult = new PingResult(0, 0, null, false); private PingResult PingResult = new PingResult(0, 0, null, false);
public StatusReboot(ReseterTask reseterTask) : base(reseterTask) public StatusReboot(ReseterTask reseterTask) : base(reseterTask)
{ {
resetertask.SetNameStage("Отправка в перезагрузку"); resetertask.SetNameStage("Отправка в перезагрузку", 1);
Shutdown.RestartPC(reseterTask.Comp.GetResetName()); Shutdown.RestartPC(reseterTask.Comp.GetResetName());
} }

View File

@ -11,7 +11,7 @@ namespace Reseter2
private PingResult PingResult = new PingResult(0, 0, null, false); private PingResult PingResult = new PingResult(0, 0, null, false);
public StatusRebootError(ReseterTask reseterTask) : base(reseterTask) public StatusRebootError(ReseterTask reseterTask) : base(reseterTask)
{ {
resetertask.SetNameStage("Ошибка перезагрузки"); resetertask.SetNameStage("Ошибка перезагрузки", 5);
resetertask.historyItem.SetEndTime(DateTime.Now); resetertask.historyItem.SetEndTime(DateTime.Now);
reseterTask.sw.Stop(); reseterTask.sw.Stop();
} }

View File

@ -11,7 +11,7 @@ namespace Reseter2
private PingResult PingResult; private PingResult PingResult;
public StatusRebootStop(ReseterTask reseterTask) : base(reseterTask) public StatusRebootStop(ReseterTask reseterTask) : base(reseterTask)
{ {
resetertask.SetNameStage("Остановленно"); resetertask.SetNameStage("Остановленно", 6);
PingResult = resetertask.pingResult; PingResult = resetertask.pingResult;
resetertask.historyItem.SetEndTime(DateTime.Now); resetertask.historyItem.SetEndTime(DateTime.Now);
reseterTask.sw.Stop(); reseterTask.sw.Stop();

View File

@ -11,7 +11,7 @@ namespace Reseter2
private PingResult PingResult; private PingResult PingResult;
public StatusRebootSucces(ReseterTask reseterTask) : base(reseterTask) public StatusRebootSucces(ReseterTask reseterTask) : base(reseterTask)
{ {
resetertask.SetNameStage("Успешно перезагруженно"); resetertask.SetNameStage("Успешно перезагруженно", 7);
resetertask.historyItem.SetEndTime(DateTime.Now); resetertask.historyItem.SetEndTime(DateTime.Now);
PingResult = resetertask.Ping(); PingResult = resetertask.Ping();
reseterTask.sw.Stop(); reseterTask.sw.Stop();

View File

@ -13,7 +13,7 @@ namespace Reseter2
private PingResult PingResult = new PingResult(0, 0, null, false); private PingResult PingResult = new PingResult(0, 0, null, false);
public StatusRebooting(ReseterTask reseterTask) : base(reseterTask) public StatusRebooting(ReseterTask reseterTask) : base(reseterTask)
{ {
resetertask.SetNameStage("Перезагрузка"); resetertask.SetNameStage("Перезагрузка", 2);
} }

View File

@ -13,7 +13,7 @@ namespace Reseter2
private PingResult PingResult = new PingResult(0,0,null, false); private PingResult PingResult = new PingResult(0,0,null, false);
public StatusPreReboot(ReseterTask reseterTask) : base(reseterTask) public StatusPreReboot(ReseterTask reseterTask) : base(reseterTask)
{ {
resetertask.SetNameStage("Проверка связи"); resetertask.SetNameStage("Проверка связи", 0);
resetertask.sw.Restart(); resetertask.sw.Restart();
} }

View File

@ -28,6 +28,8 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TaskControl));
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.lb_name = new System.Windows.Forms.Label(); this.lb_name = new System.Windows.Forms.Label();
@ -43,13 +45,14 @@
this.button3 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.lb_time = new System.Windows.Forms.Label(); this.lb_time = new System.Windows.Forms.Label();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(74, 23); this.label1.Location = new System.Drawing.Point(87, 23);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(47, 13); this.label1.Size = new System.Drawing.Size(47, 13);
this.label1.TabIndex = 0; this.label1.TabIndex = 0;
@ -59,7 +62,7 @@
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(74, 36); this.label2.Location = new System.Drawing.Point(87, 36);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(17, 13); this.label2.Size = new System.Drawing.Size(17, 13);
this.label2.TabIndex = 1; this.label2.TabIndex = 1;
@ -68,7 +71,7 @@
// lb_name // lb_name
// //
this.lb_name.AutoSize = true; this.lb_name.AutoSize = true;
this.lb_name.Location = new System.Drawing.Point(121, 23); this.lb_name.Location = new System.Drawing.Point(134, 23);
this.lb_name.Name = "lb_name"; this.lb_name.Name = "lb_name";
this.lb_name.Size = new System.Drawing.Size(64, 13); this.lb_name.Size = new System.Drawing.Size(64, 13);
this.lb_name.TabIndex = 2; this.lb_name.TabIndex = 2;
@ -77,7 +80,7 @@
// lb_ip // lb_ip
// //
this.lb_ip.AutoSize = true; this.lb_ip.AutoSize = true;
this.lb_ip.Location = new System.Drawing.Point(90, 36); this.lb_ip.Location = new System.Drawing.Point(103, 36);
this.lb_ip.Name = "lb_ip"; this.lb_ip.Name = "lb_ip";
this.lb_ip.Size = new System.Drawing.Size(70, 13); this.lb_ip.Size = new System.Drawing.Size(70, 13);
this.lb_ip.TabIndex = 3; this.lb_ip.TabIndex = 3;
@ -86,7 +89,7 @@
// lb_stage // lb_stage
// //
this.lb_stage.AutoSize = true; this.lb_stage.AutoSize = true;
this.lb_stage.Location = new System.Drawing.Point(74, 10); this.lb_stage.Location = new System.Drawing.Point(87, 10);
this.lb_stage.Name = "lb_stage"; this.lb_stage.Name = "lb_stage";
this.lb_stage.Size = new System.Drawing.Size(104, 13); this.lb_stage.Size = new System.Drawing.Size(104, 13);
this.lb_stage.TabIndex = 4; this.lb_stage.TabIndex = 4;
@ -95,7 +98,7 @@
// label4 // label4
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(173, 36); this.label4.Location = new System.Drawing.Point(186, 36);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(28, 13); this.label4.Size = new System.Drawing.Size(28, 13);
this.label4.TabIndex = 5; this.label4.TabIndex = 5;
@ -104,7 +107,7 @@
// lb_ping // lb_ping
// //
this.lb_ping.AutoSize = true; this.lb_ping.AutoSize = true;
this.lb_ping.Location = new System.Drawing.Point(207, 36); this.lb_ping.Location = new System.Drawing.Point(220, 36);
this.lb_ping.Name = "lb_ping"; this.lb_ping.Name = "lb_ping";
this.lb_ping.Size = new System.Drawing.Size(0, 13); this.lb_ping.Size = new System.Drawing.Size(0, 13);
this.lb_ping.TabIndex = 6; this.lb_ping.TabIndex = 6;
@ -112,7 +115,7 @@
// Timeout // Timeout
// //
this.Timeout.AutoSize = true; this.Timeout.AutoSize = true;
this.Timeout.Location = new System.Drawing.Point(173, 52); this.Timeout.Location = new System.Drawing.Point(186, 52);
this.Timeout.Name = "Timeout"; this.Timeout.Name = "Timeout";
this.Timeout.Size = new System.Drawing.Size(45, 13); this.Timeout.Size = new System.Drawing.Size(45, 13);
this.Timeout.TabIndex = 7; this.Timeout.TabIndex = 7;
@ -121,7 +124,7 @@
// lb_timeout // lb_timeout
// //
this.lb_timeout.AutoSize = true; this.lb_timeout.AutoSize = true;
this.lb_timeout.Location = new System.Drawing.Point(224, 52); this.lb_timeout.Location = new System.Drawing.Point(237, 52);
this.lb_timeout.Name = "lb_timeout"; this.lb_timeout.Name = "lb_timeout";
this.lb_timeout.Size = new System.Drawing.Size(0, 13); this.lb_timeout.Size = new System.Drawing.Size(0, 13);
this.lb_timeout.TabIndex = 8; this.lb_timeout.TabIndex = 8;
@ -148,9 +151,9 @@
// //
// pictureBox1 // pictureBox1
// //
this.pictureBox1.Location = new System.Drawing.Point(8, 8); this.pictureBox1.Location = new System.Drawing.Point(6, 6);
this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(60, 60); this.pictureBox1.Size = new System.Drawing.Size(64, 64);
this.pictureBox1.TabIndex = 11; this.pictureBox1.TabIndex = 11;
this.pictureBox1.TabStop = false; this.pictureBox1.TabStop = false;
// //
@ -167,7 +170,7 @@
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(73, 52); this.label3.Location = new System.Drawing.Point(86, 52);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(46, 13); this.label3.Size = new System.Drawing.Size(46, 13);
this.label3.TabIndex = 13; this.label3.TabIndex = 13;
@ -176,16 +179,30 @@
// lb_time // lb_time
// //
this.lb_time.AutoSize = true; this.lb_time.AutoSize = true;
this.lb_time.Location = new System.Drawing.Point(118, 52); this.lb_time.Location = new System.Drawing.Point(131, 52);
this.lb_time.Name = "lb_time"; this.lb_time.Name = "lb_time";
this.lb_time.Size = new System.Drawing.Size(34, 13); this.lb_time.Size = new System.Drawing.Size(34, 13);
this.lb_time.TabIndex = 14; this.lb_time.TabIndex = 14;
this.lb_time.Text = "00:00"; this.lb_time.Text = "00:00";
// //
// imageList1
//
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.imageList1.Images.SetKeyName(0, "1icon-64.png");
this.imageList1.Images.SetKeyName(1, "2icon-64.png");
this.imageList1.Images.SetKeyName(2, "3icon-64.png");
this.imageList1.Images.SetKeyName(3, "8icon-64.png");
this.imageList1.Images.SetKeyName(4, "6icon-64.png");
this.imageList1.Images.SetKeyName(5, "4icon-64.png");
this.imageList1.Images.SetKeyName(6, "5icon-64.png");
this.imageList1.Images.SetKeyName(7, "7icon-64.png");
//
// TaskControl // TaskControl
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.Controls.Add(this.lb_time); this.Controls.Add(this.lb_time);
this.Controls.Add(this.label3); this.Controls.Add(this.label3);
this.Controls.Add(this.button3); this.Controls.Add(this.button3);
@ -226,5 +243,6 @@
private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label lb_time; private System.Windows.Forms.Label lb_time;
private System.Windows.Forms.ImageList imageList1;
} }
} }

View File

@ -41,9 +41,10 @@ namespace Reseter2
lb_time.Text = time.ToString(@"mm\:ss"); lb_time.Text = time.ToString(@"mm\:ss");
} }
public void SetNameStage(string nameStage) public void SetNameStage(string nameStage, int indexImg)
{ {
lb_stage.Text = nameStage; lb_stage.Text = nameStage;
pictureBox1.Image = imageList1.Images[indexImg];
} }
private void label1_Click(object sender, EventArgs e) private void label1_Click(object sender, EventArgs e)
{ {

File diff suppressed because it is too large Load Diff

View File

@ -29,6 +29,7 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BilderWords));
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.bt_close = new System.Windows.Forms.Button(); this.bt_close = new System.Windows.Forms.Button();
@ -131,8 +132,11 @@
this.treeView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 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.Left)));
this.treeView1.HideSelection = false; this.treeView1.HideSelection = false;
this.treeView1.ImageIndex = 0;
this.treeView1.ImageList = this.imageList1;
this.treeView1.Location = new System.Drawing.Point(9, 41); this.treeView1.Location = new System.Drawing.Point(9, 41);
this.treeView1.Name = "treeView1"; this.treeView1.Name = "treeView1";
this.treeView1.SelectedImageIndex = 1;
this.treeView1.ShowLines = false; this.treeView1.ShowLines = false;
this.treeView1.Size = new System.Drawing.Size(207, 471); this.treeView1.Size = new System.Drawing.Size(207, 471);
this.treeView1.TabIndex = 4; this.treeView1.TabIndex = 4;
@ -142,9 +146,17 @@
// //
// imageList1 // imageList1
// //
this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
this.imageList1.TransparentColor = System.Drawing.Color.Transparent; this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.imageList1.Images.SetKeyName(0, "11favicon.ico");
this.imageList1.Images.SetKeyName(1, "16favicon.ico");
this.imageList1.Images.SetKeyName(2, "12favicon.ico");
this.imageList1.Images.SetKeyName(3, "13favicon.ico");
this.imageList1.Images.SetKeyName(4, "14favicon.ico");
this.imageList1.Images.SetKeyName(5, "15favicon.ico");
this.imageList1.Images.SetKeyName(6, "17favicon.ico");
this.imageList1.Images.SetKeyName(7, "18favicon.ico");
this.imageList1.Images.SetKeyName(8, "40favicon.ico");
// //
// BilderWords // BilderWords
// //
@ -159,6 +171,7 @@
this.Controls.Add(this.bt_saveClose); this.Controls.Add(this.bt_saveClose);
this.Controls.Add(this.bt_close); this.Controls.Add(this.bt_close);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "BilderWords"; this.Name = "BilderWords";
this.Text = "Редактор справочника"; this.Text = "Редактор справочника";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BilderWords_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BilderWords_FormClosing);
@ -177,6 +190,6 @@
private System.Windows.Forms.Button bt_new; private System.Windows.Forms.Button bt_new;
private System.Windows.Forms.Button bt_deleteItem; private System.Windows.Forms.Button bt_deleteItem;
private System.Windows.Forms.TreeView treeView1; private System.Windows.Forms.TreeView treeView1;
private System.Windows.Forms.ImageList imageList1; public System.Windows.Forms.ImageList imageList1;
} }
} }

View File

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Data.Odbc;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -18,7 +19,7 @@ namespace Reseter2.Words
public BilderWords() public BilderWords()
{ {
InitializeComponent(); InitializeComponent();
WordsList.MainCategory.
WordsCategory WCvebinar = new WordsCategory("Вебинарные"); WordsCategory WCvebinar = new WordsCategory("Вебинарные");
WordsList.AddItem(WCvebinar, WordsList.MainCategory); WordsList.AddItem(WCvebinar, WordsList.MainCategory);
@ -54,6 +55,7 @@ namespace Reseter2.Words
private void TreeView1_ItemDrag(object sender, ItemDragEventArgs e) private void TreeView1_ItemDrag(object sender, ItemDragEventArgs e)
{ {
DragOn = true;
if (e.Button == MouseButtons.Left) if (e.Button == MouseButtons.Left)
{ {
DoDragDrop(e.Item, DragDropEffects.Move); DoDragDrop(e.Item, DragDropEffects.Move);
@ -74,8 +76,6 @@ namespace Reseter2.Words
private void TreeView1_DragDrop(object sender, DragEventArgs e) private void TreeView1_DragDrop(object sender, DragEventArgs e)
{ {
DragOn = false; DragOn = false;
control.Visible = false;
control.Dispose();
int indexMod = 0; int indexMod = 0;
int index = 0; int index = 0;
Point targetPoint = treeView1.PointToClient(new Point(e.X, e.Y)); Point targetPoint = treeView1.PointToClient(new Point(e.X, e.Y));
@ -191,7 +191,7 @@ namespace Reseter2.Words
if (e.Node.Tag is WordsComp) if (e.Node.Tag is WordsComp)
{ {
WordsComp wordsComp = (WordsComp)e.Node.Tag; WordsComp wordsComp = (WordsComp)e.Node.Tag;
control = new WordsEditCompControl(wordsComp, e.Node); control = new WordsEditCompControl(wordsComp, e.Node, imageList1);
panel1.Controls.Add(control); panel1.Controls.Add(control);
} }
if (e.Node.Tag is WordsCategory) if (e.Node.Tag is WordsCategory)
@ -256,13 +256,15 @@ namespace Reseter2.Words
item = new WordsCategory("Новая категория"); item = new WordsCategory("Новая категория");
index = 0; index = 0;
WordsList.InsertItem(index, (WordsCategory)item, ParentCategory); WordsList.InsertItem(index, (WordsCategory)item, ParentCategory);
treeNode.ImageIndex = 1; treeNode.ImageIndex = 0;
treeNode.SelectedImageIndex = 0;
treeNode.Text = "Новая категория"; treeNode.Text = "Новая категория";
break; break;
case 1: case 1:
item = new WordsComp(new CompId("Новый ПК")); item = new WordsComp(new CompId("Новый ПК"));
WordsList.InsertItem(index, (WordsComp)item, ParentCategory); WordsList.InsertItem(index, (WordsComp)item, ParentCategory);
treeNode.ImageIndex = 0; treeNode.ImageIndex = 1;
treeNode.SelectedImageIndex = 1;
treeNode.Text = "Новый ПК"; treeNode.Text = "Новый ПК";
break; break;
} }
@ -314,11 +316,26 @@ namespace Reseter2.Words
{ {
if (e.Button == MouseButtons.Left) if (e.Button == MouseButtons.Left)
{ {
Point targetPoint = treeView1.PointToClient(new Point(e.X, e.Y));
if (treeView1.GetNodeAt(targetPoint) == null) treeView1.SelectedNode = null; TreeNode tr = treeView1.GetNodeAt(e.X, e.Y);
if (tr == null || !(tr.Bounds.X < e.X && (tr.Bounds.Width + tr.Bounds.X) > e.X))
{
if (control != null && !DragOn)
{
control.Visible = false;
control.Dispose();
}
treeView1.SelectedNode = null;
}
} }
else if (e.Button == MouseButtons.Right) else if (e.Button == MouseButtons.Right)
{ {
if (control != null && !DragOn)
{
control.Visible = false;
control.Dispose();
}
treeView1.SelectedNode = null; treeView1.SelectedNode = null;
} }

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,7 @@ namespace Reseter2.Words
public abstract void Delete(); public abstract void Delete();
public abstract TreeNode NodeList(); public abstract TreeNode NodeList();
public abstract bool ChekMove(IWordsItem wordsItem); public abstract bool ChekMove(IWordsItem wordsItem);
public abstract IWordsItem Clone();

View File

@ -19,6 +19,12 @@ namespace Reseter2.Words
Name = name; Name = name;
items = new List<IWordsItem>(); items = new List<IWordsItem>();
}
public WordsCategory(string name, List<IWordsItem> Items)
{
Name = name;
items = Items;
} }
public void Add(IWordsItem newitem) public void Add(IWordsItem newitem)
@ -106,13 +112,15 @@ namespace Reseter2.Words
itemsCatrgory.AddRange(item.CategoryList()); itemsCatrgory.AddRange(item.CategoryList());
} }
return itemsCatrgory; return itemsCatrgory;
} }
public override TreeNode NodeList() public override TreeNode NodeList()
{ {
TreeNode treeNode = new TreeNode(GetName()); TreeNode treeNode = new TreeNode(GetName());
treeNode.Tag = this; treeNode.Tag = this;
treeNode.ImageIndex = 1; treeNode.ImageIndex = 0;
treeNode.SelectedImageIndex = 0;
foreach (var item in items) foreach (var item in items)
{ {
@ -120,5 +128,12 @@ namespace Reseter2.Words
} }
return treeNode; return treeNode;
} }
public override IWordsItem Clone()
{
// List<IWordsItem> list = items.CopyTo();
WordsCategory clone = new WordsCategory(Name);
return this;
}
} }
} }

View File

@ -33,7 +33,7 @@ namespace Reseter2.Words
} }
public void Set(String name, String ip, String description) public void Set(String name, String ip, String description, int imgIndex)
{ {
IPAddress iPAddress; IPAddress iPAddress;
try try
@ -47,6 +47,7 @@ namespace Reseter2.Words
Comp.SetIP(iPAddress); Comp.SetIP(iPAddress);
Comp.SetName(name); Comp.SetName(name);
Comp.SetDescription(description); Comp.SetDescription(description);
Comp.SetImage(imgIndex);
} }
public string GetName() public string GetName()
@ -94,7 +95,8 @@ namespace Reseter2.Words
{ {
TreeNode treeNode = new TreeNode(GetName()); TreeNode treeNode = new TreeNode(GetName());
treeNode.Tag = this; treeNode.Tag = this;
treeNode.ImageIndex = 2; treeNode.ImageIndex = Comp.GetImage();
treeNode.SelectedImageIndex = Comp.GetImage();
return treeNode; return treeNode;
} }
} }

View File

@ -28,28 +28,29 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.serviceController1 = new System.ServiceProcess.ServiceController();
this.lb_name = new System.Windows.Forms.TextBox(); this.lb_name = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.lb_ip = new System.Windows.Forms.TextBox(); this.lb_ip = new System.Windows.Forms.TextBox();
this.lb_description = new System.Windows.Forms.TextBox(); this.lb_description = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
// //
// lb_name // lb_name
// //
this.lb_name.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.lb_name.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.lb_name.Location = new System.Drawing.Point(6, 22); this.lb_name.Location = new System.Drawing.Point(6, 30);
this.lb_name.Name = "lb_name"; this.lb_name.Name = "lb_name";
this.lb_name.Size = new System.Drawing.Size(243, 20); this.lb_name.Size = new System.Drawing.Size(245, 20);
this.lb_name.TabIndex = 2; this.lb_name.TabIndex = 2;
// //
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 6); this.label2.Location = new System.Drawing.Point(3, 14);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(47, 13); this.label2.Size = new System.Drawing.Size(47, 13);
this.label2.TabIndex = 3; this.label2.TabIndex = 3;
@ -58,7 +59,7 @@
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(3, 45); this.label3.Location = new System.Drawing.Point(3, 53);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(50, 13); this.label3.Size = new System.Drawing.Size(50, 13);
this.label3.TabIndex = 5; this.label3.TabIndex = 5;
@ -68,35 +69,57 @@
// //
this.lb_ip.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.lb_ip.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.lb_ip.Location = new System.Drawing.Point(6, 61); this.lb_ip.Location = new System.Drawing.Point(6, 69);
this.lb_ip.Name = "lb_ip"; this.lb_ip.Name = "lb_ip";
this.lb_ip.Size = new System.Drawing.Size(243, 20); this.lb_ip.Size = new System.Drawing.Size(245, 20);
this.lb_ip.TabIndex = 4; this.lb_ip.TabIndex = 4;
// //
// lb_description // lb_description
// //
this.lb_description.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.lb_description.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.lb_description.Location = new System.Drawing.Point(6, 100); this.lb_description.Location = new System.Drawing.Point(6, 108);
this.lb_description.Multiline = true; this.lb_description.Multiline = true;
this.lb_description.Name = "lb_description"; this.lb_description.Name = "lb_description";
this.lb_description.Size = new System.Drawing.Size(243, 63); this.lb_description.Size = new System.Drawing.Size(245, 63);
this.lb_description.TabIndex = 6; this.lb_description.TabIndex = 6;
// //
// label4 // label4
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(3, 84); this.label4.Location = new System.Drawing.Point(3, 92);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(57, 13); this.label4.Size = new System.Drawing.Size(57, 13);
this.label4.TabIndex = 7; this.label4.TabIndex = 7;
this.label4.Text = "Описание"; this.label4.Text = "Описание";
// //
// comboBox1
//
this.comboBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(209, 3);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(42, 21);
this.comboBox1.TabIndex = 8;
this.comboBox1.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.comboBox1_DrawItem);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(160, 6);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(43, 13);
this.label1.TabIndex = 9;
this.label1.Text = "Значек";
//
// WordsEditCompControl // WordsEditCompControl
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true; this.AutoSize = true;
this.Controls.Add(this.label1);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.label4); this.Controls.Add(this.label4);
this.Controls.Add(this.lb_description); this.Controls.Add(this.lb_description);
this.Controls.Add(this.label3); this.Controls.Add(this.label3);
@ -104,7 +127,7 @@
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
this.Controls.Add(this.lb_name); this.Controls.Add(this.lb_name);
this.Name = "WordsEditCompControl"; this.Name = "WordsEditCompControl";
this.Size = new System.Drawing.Size(254, 169); this.Size = new System.Drawing.Size(254, 178);
this.VisibleChanged += new System.EventHandler(this.WordsEditCompControl_VisibleChanged); this.VisibleChanged += new System.EventHandler(this.WordsEditCompControl_VisibleChanged);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -112,12 +135,13 @@
} }
#endregion #endregion
private System.ServiceProcess.ServiceController serviceController1;
private System.Windows.Forms.TextBox lb_name; private System.Windows.Forms.TextBox lb_name;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox lb_ip; private System.Windows.Forms.TextBox lb_ip;
private System.Windows.Forms.TextBox lb_description; private System.Windows.Forms.TextBox lb_description;
private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label1;
} }
} }

View File

@ -16,18 +16,22 @@ namespace Reseter2.Words
{ {
private WordsComp wordsComp; private WordsComp wordsComp;
private TreeNode treeNode; private TreeNode treeNode;
private ImageList imageList;
public WordsEditCompControl() public WordsEditCompControl()
{ {
InitializeComponent(); InitializeComponent();
} }
public WordsEditCompControl(WordsComp wordscomp, TreeNode treenode) public WordsEditCompControl(WordsComp wordscomp, TreeNode treenode, ImageList imagelist)
{ {
InitializeComponent(); InitializeComponent();
imageList = imagelist;
comboBox1.DataSource = imageList.Images;
lb_name.Text = wordscomp.GetName(); lb_name.Text = wordscomp.GetName();
lb_ip.Text = wordscomp.GetIP(); lb_ip.Text = wordscomp.GetIP();
lb_description.Text = wordscomp.GetDescription(); lb_description.Text = wordscomp.GetDescription();
wordsComp = wordscomp; wordsComp = wordscomp;
treeNode = treenode; treeNode = treenode;
comboBox1.SelectedIndex = treeNode.ImageIndex;
} }
public void Save() public void Save()
{ {
@ -37,7 +41,18 @@ namespace Reseter2.Words
private void WordsEditCompControl_VisibleChanged(object sender, EventArgs e) private void WordsEditCompControl_VisibleChanged(object sender, EventArgs e)
{ {
treeNode.Text = lb_name.Text; treeNode.Text = lb_name.Text;
wordsComp.Set(lb_name.Text, lb_ip.Text, lb_description.Text); treeNode.ImageIndex = comboBox1.SelectedIndex;
treeNode.SelectedImageIndex = comboBox1.SelectedIndex;
wordsComp.Set(lb_name.Text, lb_ip.Text, lb_description.Text, comboBox1.SelectedIndex);
}
private void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
{
if(e.Index != -1)
{
e.Graphics.DrawImage(imageList.Images[e.Index],e.Bounds.Left, e.Bounds.Top, imageList.Images[e.Index].Width, imageList.Images[e.Index].Height);
}
} }
} }
} }

View File

@ -117,7 +117,4 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="serviceController1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>

BIN
Reseter2/reseter.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB