Добавили старые классы

This commit is contained in:
klavirshik 2024-10-07 18:58:35 +02:00
parent db0119fde3
commit 79ca250ce8
72 changed files with 5606 additions and 59 deletions

Binary file not shown.

View File

@ -37,6 +37,7 @@
this.ShowBar = new System.Windows.Forms.Button();
this.NewBtn = new System.Windows.Forms.Button();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.button1 = new System.Windows.Forms.Button();
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
@ -46,7 +47,7 @@
this.button2.FlatAppearance.BorderSize = 0;
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.button2.Location = new System.Drawing.Point(461, 0);
this.button2.Location = new System.Drawing.Point(431, 0);
this.button2.Margin = new System.Windows.Forms.Padding(0);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(140, 21);
@ -60,7 +61,7 @@
this.button3.FlatAppearance.BorderSize = 0;
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.button3.Location = new System.Drawing.Point(352, 0);
this.button3.Location = new System.Drawing.Point(322, 0);
this.button3.Margin = new System.Windows.Forms.Padding(0);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(109, 21);
@ -74,7 +75,7 @@
this.button4.FlatAppearance.BorderSize = 0;
this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.button4.Location = new System.Drawing.Point(243, 0);
this.button4.Location = new System.Drawing.Point(213, 0);
this.button4.Margin = new System.Windows.Forms.Padding(0);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(109, 21);
@ -88,7 +89,7 @@
this.button7.FlatAppearance.BorderSize = 0;
this.button7.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button7.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.button7.Location = new System.Drawing.Point(134, 0);
this.button7.Location = new System.Drawing.Point(104, 0);
this.button7.Margin = new System.Windows.Forms.Padding(0);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(109, 21);
@ -104,7 +105,7 @@
this.button6.FlatAppearance.BorderSize = 0;
this.button6.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button6.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.button6.Location = new System.Drawing.Point(631, 0);
this.button6.Location = new System.Drawing.Point(598, 0);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(21, 21);
this.button6.TabIndex = 6;
@ -117,7 +118,7 @@
this.button5.FlatAppearance.BorderSize = 0;
this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button5.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.button5.Location = new System.Drawing.Point(604, 0);
this.button5.Location = new System.Drawing.Point(571, 0);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(21, 21);
this.button5.TabIndex = 5;
@ -141,7 +142,7 @@
this.NewBtn.BackgroundImage = global::Remontor.Properties.Resources.connect_min;
this.NewBtn.FlatAppearance.BorderSize = 0;
this.NewBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.NewBtn.Location = new System.Drawing.Point(103, 0);
this.NewBtn.Location = new System.Drawing.Point(73, 0);
this.NewBtn.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0);
this.NewBtn.Name = "NewBtn";
this.NewBtn.Size = new System.Drawing.Size(21, 21);
@ -160,13 +161,27 @@
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(601, 21);
this.flowLayoutPanel1.Size = new System.Drawing.Size(571, 21);
this.flowLayoutPanel1.TabIndex = 8;
//
// button1
//
this.button1.BackColor = System.Drawing.SystemColors.Control;
this.button1.BackgroundImage = global::Remontor.Properties.Resources.max_size;
this.button1.FlatAppearance.BorderSize = 0;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.button1.Location = new System.Drawing.Point(643, 0);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(21, 21);
this.button1.TabIndex = 9;
this.button1.UseVisualStyleBackColor = false;
//
// BarSessionControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.button1);
this.Controls.Add(this.flowLayoutPanel1);
this.Controls.Add(this.button6);
this.Controls.Add(this.button5);
@ -189,5 +204,6 @@
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Button button1;
}
}

116
Remontor/Comp/CompName.cs Normal file
View File

@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace Reseter2
{
[Serializable]
internal class CompId : IComp
{
private int imgIndex=1;
private string Name { get; set; }
private string Description { get; set; }
private IPAddress Ip { get; set; }
private string netName;
public CompId(string netname)
{
this.netName = netname;
//this.Name = netname;
}
public CompId(IPAddress ip)
{
this.Ip = ip;
}
public CompId(string name, string description)
{
this.Name = name;
this.Description = description;
}
public CompId(string name, string description, IPAddress ip)
{
this.Name = name;
this.Description = description;
this.Ip = ip;
}
public string GetName()
{
return Name;
}
public string GetNetNameStr()
{
if (netName == null) return GetIPStr();
return netName;
}
public string GetNetName()
{
return netName;
}
public IPAddress GetIP()
{
return Ip;
}
public string GetIPStr()
{
if (Ip != null) return Ip.ToString();
return null;
}
public int GetImage()
{
return imgIndex;
}
public void SetIP(IPAddress ip)
{
Ip = ip;
}
public void SetName(string name)
{
Name = name;
}
public void SetNetName(string netname)
{
netName = netname;
}
public void SetImage(int image)
{
imgIndex = image;
}
public void SetDescription(string description)
{
Description = description;
}
public string GetResetName()
{
if (netName != null) return netName;
return GetIPStr();
}
public string GetDescription()
{
return Description;
}
}
}

28
Remontor/Comp/IComp.cs Normal file
View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace Reseter2
{
internal interface IComp
{
string GetName();
string GetNetName();
string GetNetNameStr();
string GetResetName();
IPAddress GetIP();
int GetImage();
void SetIP(IPAddress ip);
void SetName(string name);
void SetNetName(string netName);
void SetImage(int imdexImg);
void SetDescription(string description);
string GetDescription();
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Remontor.Connector
{
internal class Connect
{
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Remontor.Connector
{
internal class SConnector
{
}
}

View File

@ -30,22 +30,24 @@
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.label1 = new System.Windows.Forms.Label();
this.ConnectBtn = new System.Windows.Forms.Button();
this.sessionItemControl1 = new Remontor.SessionItemControl();
this.sessionItemControl2 = new Remontor.SessionItemControl();
this.sessionItemControl3 = new Remontor.SessionItemControl();
this.sessionItemControl4 = new Remontor.SessionItemControl();
this.sessionItemControl5 = new Remontor.SessionItemControl();
this.sessionItemControl6 = new Remontor.SessionItemControl();
this.sessionItemControl7 = new Remontor.SessionItemControl();
this.sessionItemControl8 = new Remontor.SessionItemControl();
this.sessionItemControl9 = new Remontor.SessionItemControl();
this.label1 = new System.Windows.Forms.Label();
this.ConnectBtn = new System.Windows.Forms.Button();
this.sessionItemControl8 = new Remontor.SessionItemControl();
this.sessionItemControl7 = new Remontor.SessionItemControl();
this.sessionItemControl5 = new Remontor.SessionItemControl();
this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox1.Location = new System.Drawing.Point(125, 12);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(328, 20);
@ -54,21 +56,42 @@
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.BackColor = System.Drawing.SystemColors.Window;
this.flowLayoutPanel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.flowLayoutPanel1.Controls.Add(this.sessionItemControl1);
this.flowLayoutPanel1.Controls.Add(this.sessionItemControl2);
this.flowLayoutPanel1.Controls.Add(this.sessionItemControl3);
this.flowLayoutPanel1.Controls.Add(this.sessionItemControl4);
this.flowLayoutPanel1.Controls.Add(this.sessionItemControl5);
this.flowLayoutPanel1.Controls.Add(this.sessionItemControl6);
this.flowLayoutPanel1.Controls.Add(this.sessionItemControl7);
this.flowLayoutPanel1.Controls.Add(this.sessionItemControl8);
this.flowLayoutPanel1.Controls.Add(this.sessionItemControl9);
this.flowLayoutPanel1.Location = new System.Drawing.Point(12, 47);
this.flowLayoutPanel1.Controls.Add(this.sessionItemControl8);
this.flowLayoutPanel1.Controls.Add(this.sessionItemControl7);
this.flowLayoutPanel1.Controls.Add(this.sessionItemControl5);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 52);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(556, 391);
this.flowLayoutPanel1.Size = new System.Drawing.Size(592, 398);
this.flowLayoutPanel1.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(31, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(88, 13);
this.label1.TabIndex = 2;
this.label1.Text = "Введите запрос";
//
// ConnectBtn
//
this.ConnectBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ConnectBtn.Location = new System.Drawing.Point(459, 10);
this.ConnectBtn.Name = "ConnectBtn";
this.ConnectBtn.Size = new System.Drawing.Size(91, 23);
this.ConnectBtn.TabIndex = 3;
this.ConnectBtn.Text = "Подключиться";
this.ConnectBtn.UseVisualStyleBackColor = true;
//
// sessionItemControl1
//
this.sessionItemControl1.Location = new System.Drawing.Point(3, 3);
@ -97,64 +120,46 @@
this.sessionItemControl4.Size = new System.Drawing.Size(264, 55);
this.sessionItemControl4.TabIndex = 3;
//
// sessionItemControl5
//
this.sessionItemControl5.Location = new System.Drawing.Point(3, 125);
this.sessionItemControl5.Name = "sessionItemControl5";
this.sessionItemControl5.Size = new System.Drawing.Size(264, 55);
this.sessionItemControl5.TabIndex = 4;
//
// sessionItemControl6
//
this.sessionItemControl6.Location = new System.Drawing.Point(273, 125);
this.sessionItemControl6.Location = new System.Drawing.Point(3, 125);
this.sessionItemControl6.Name = "sessionItemControl6";
this.sessionItemControl6.Size = new System.Drawing.Size(264, 55);
this.sessionItemControl6.TabIndex = 5;
//
// sessionItemControl7
//
this.sessionItemControl7.Location = new System.Drawing.Point(3, 186);
this.sessionItemControl7.Name = "sessionItemControl7";
this.sessionItemControl7.Size = new System.Drawing.Size(264, 55);
this.sessionItemControl7.TabIndex = 6;
//
// sessionItemControl8
//
this.sessionItemControl8.Location = new System.Drawing.Point(273, 186);
this.sessionItemControl8.Name = "sessionItemControl8";
this.sessionItemControl8.Size = new System.Drawing.Size(264, 55);
this.sessionItemControl8.TabIndex = 7;
//
// sessionItemControl9
//
this.sessionItemControl9.Location = new System.Drawing.Point(3, 247);
this.sessionItemControl9.Location = new System.Drawing.Point(273, 125);
this.sessionItemControl9.Name = "sessionItemControl9";
this.sessionItemControl9.Size = new System.Drawing.Size(264, 55);
this.sessionItemControl9.TabIndex = 8;
//
// label1
// sessionItemControl8
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(31, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(88, 13);
this.label1.TabIndex = 2;
this.label1.Text = "Введите запрос";
this.sessionItemControl8.Location = new System.Drawing.Point(3, 186);
this.sessionItemControl8.Name = "sessionItemControl8";
this.sessionItemControl8.Size = new System.Drawing.Size(264, 55);
this.sessionItemControl8.TabIndex = 7;
//
// ConnectBtn
// sessionItemControl7
//
this.ConnectBtn.Location = new System.Drawing.Point(459, 10);
this.ConnectBtn.Name = "ConnectBtn";
this.ConnectBtn.Size = new System.Drawing.Size(91, 23);
this.ConnectBtn.TabIndex = 3;
this.ConnectBtn.Text = "Подключиться";
this.ConnectBtn.UseVisualStyleBackColor = true;
this.sessionItemControl7.Location = new System.Drawing.Point(273, 186);
this.sessionItemControl7.Name = "sessionItemControl7";
this.sessionItemControl7.Size = new System.Drawing.Size(264, 55);
this.sessionItemControl7.TabIndex = 6;
//
// sessionItemControl5
//
this.sessionItemControl5.Location = new System.Drawing.Point(3, 247);
this.sessionItemControl5.Name = "sessionItemControl5";
this.sessionItemControl5.Size = new System.Drawing.Size(264, 55);
this.sessionItemControl5.TabIndex = 4;
//
// Finder
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(580, 450);
this.ClientSize = new System.Drawing.Size(592, 450);
this.Controls.Add(this.ConnectBtn);
this.Controls.Add(this.label1);
this.Controls.Add(this.flowLayoutPanel1);

View File

@ -130,6 +130,26 @@ namespace Remontor.Properties {
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap max_size {
get {
object obj = ResourceManager.GetObject("max_size", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Person {
get {
object obj = ResourceManager.GetObject("Person", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>

View File

@ -118,6 +118,9 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="max_size" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\max_size.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="reconnect" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\reconnect.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -136,6 +139,9 @@
<data name="close" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="up_min1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\up_min1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="down_min11" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\down_min11.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -145,7 +151,7 @@
<data name="down_min1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\down_min1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="up_min1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\up_min1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="Person" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Person.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -146,5 +146,11 @@
<ItemGroup>
<None Include="Resources\up_min1.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\max_size.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Person.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

View File

@ -0,0 +1,46 @@
using Remontor.Setting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Remontor.SCCMsearch
{
internal class AuthLogin : IAuthType
{
private string User = null;
private string Pass = null;
public AuthLogin()
{
}
public AuthLogin(string user, string pass)
{
User = user;
Pass = pass;
}
public string Name
{
get
{
if(User != null) return User;
return SGlobalSetting.settingSCCM.username;
}
}
public string Password
{
get
{
if(Pass != null) return Pass;
return SGlobalSetting.settingSCCM.password;
}
}
public string AuthString()
{
return "user=" + Name + ";password=" + Password + ";";
}
}
}

View File

@ -0,0 +1,39 @@
using Remontor.Setting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
namespace Remontor.SCCMsearch
{
internal class AuthWin : IAuthType
{
private static System.Security.Principal.WindowsIdentity user = WindowsIdentity.GetCurrent();
public static string uid;
public AuthWin()
{
uid = user.User.AccountDomainSid.Value;
}
public string Name
{
get
{
return "";
}
}
public string Password
{
get
{
return uid;
}
}
public string AuthString()
{
Console.WriteLine(Password);
return "Integrated Security=true;";
}
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Remontor.SCCMsearch
{
internal interface IAuthType
{
public string Name { get; }
public string Password { get; }
public string AuthString();
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Remontor.Seacher.SeahcLocal;
namespace Remontor.Seacher
{
internal interface ISeaherMetod
{
public void Change(ResultUpdate sender, string seach);
public IComp Result(int index);
public string ResultString(int index);
}
}

View File

@ -0,0 +1,25 @@
using Remontor.Setting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Remontor.Seacher
{
internal static class SSeaher
{
public static ISeaherMetod seaherMetod;
public static void LoadSetting()
{
if(SGlobalSetting.settingSCCM.on)
{
seaherMetod = new SeachSCCM();
}
else
{
seaherMetod = new SeahcLocal();
}
}
}
}

View File

@ -0,0 +1,263 @@
using System.Data.SqlClient;
using Remontor.SCCMsearch;
using Remontor.Setting;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Xml.Linq;
using static Remontor.Seacher.SeahcLocal;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
using System.Threading;
namespace Remontor.Seacher
{
internal class SeachSCCM : ISeaherMetod
{
private SqlConnection Connection;
private IAuthType AuthType;
private List<IComp> comps = new List<IComp>();
private ResultUpdate Update;
private bool enable;
private string error;
private Mode mode;
private Timer TimerDisconnect;
private enum Mode{
PCname,
Login,
Username
}
public SeachSCCM()
{
if (SGlobalSetting.settingSCCM.windowsAuth)
{
AuthType = new AuthWin();
}
else
{
AuthType = new AuthLogin();
}
}
public SeachSCCM(bool AuthMetod, string User = "", string Pass = "")
{
if (AuthMetod)
{
AuthType = new AuthWin();
}
else
{
AuthType = new AuthLogin(User, Pass);
}
}
public void Change(ResultUpdate sender, string seach)
{
Activate();
Update = sender;
if (Connection != null && Connection.State == ConnectionState.Open)
{
List<string> result;
if (seach.Length > 2)
{
result = ResultSeach(seach);
int itemHeight = 14;
if(enable) itemHeight = 40;
Update(result, enable, itemHeight);
}
else
{
result = new List<string>();
result.Add("Введите запрос, к бд подключенно");
Update(result, false, 14);
}
}
else
{
List<string> result = new List<string>();
result.Add(error);
Update(result, false,14);
}
}
private string QueryBilder(string query)
{
string result;
Regex regexCyrillic = new(@"\p{IsCyrillic}+", RegexOptions.IgnoreCase);
Regex regexNumrable = new(@"\d+", RegexOptions.IgnoreCase);
MatchCollection jjj = regexNumrable.Matches(query);
if (regexCyrillic.Matches(query).Count > 0)
{
result = "SELECT TOP (15) " +
"dbo._RES_COLL_SMS00001.Name," +
" dbo._RES_COLL_SMS00001.UserName," +
" dbo.v_R_User.Full_User_Name0," +
" dbo._RES_COLL_SMS00001.LastActiveTime" +
" FROM dbo.v_R_User " +
"JOIN dbo._RES_COLL_SMS00001 ON dbo.v_R_User.User_Name0=dbo._RES_COLL_SMS00001.UserName" +
" WHERE LOWER(dbo.v_R_User.Full_User_Name0) LIKE LOWER(N'%" + query + "%')";
mode = Mode.Username;
}
else if(regexNumrable.Matches(query).Count > 0)
{
result = "SELECT TOP (15) dbo._RES_COLL_SMS00001.Name, dbo._RES_COLL_SMS00001.UserName, dbo.v_R_User.Full_User_Name0, dbo._RES_COLL_SMS00001.LastActiveTime FROM dbo._RES_COLL_SMS00001 LEFT JOIN dbo.v_R_User ON dbo._RES_COLL_SMS00001.UserName = dbo.v_R_User.User_Name0 WHERE LOWER(dbo._RES_COLL_SMS00001.Name) LIKE LOWER(N'%" + query + "%')";
mode = Mode.PCname;
}
else
{
result = "SELECT TOP (15) dbo._RES_COLL_SMS00001.Name, dbo._RES_COLL_SMS00001.UserName, dbo.v_R_User.Full_User_Name0, dbo._RES_COLL_SMS00001.LastActiveTime FROM dbo._RES_COLL_SMS00001 LEFT JOIN dbo.v_R_User ON dbo._RES_COLL_SMS00001.UserName = dbo.v_R_User.User_Name0 WHERE LOWER(dbo._RES_COLL_SMS00001.Name) LIKE LOWER(N'%" + query + "%') OR LOWER(dbo._RES_COLL_SMS00001.UserName) LIKE LOWER(N'%" + query + "%')" +
""; ;
mode = Mode.Login;
}
return result;
}
public List<string> ResultSeach(string seach)
{
int y = 0;
comps.Clear();
List<string> result = new List<string>();
if (Connection.State == ConnectionState.Open && Connection != null)
{
try
{
string sql = QueryBilder(seach);
SqlCommand sqlCom = new SqlCommand(sql, Connection);
// Connection.Open();
sqlCom.ExecuteNonQuery();
SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCom);
DataTable dt = new DataTable();
dataAdapter.Fill(dt);
DataRow[] myData = dt.Select();
for (int i = 0; i < myData.Length; i++)
{
IComp comp = new CompId(myData[i].ItemArray[0].ToString());
comp.SetName(myData[i].ItemArray[1].ToString());
comp.SetDescription(myData[i].ItemArray[2].ToString());
comps.Add(comp);
result.Add("ПК:"+ comp.GetNetNameStr() + " Логин:" + comp.GetName() + "\r\n" + comp.GetDescription() + "\r\nLastLogin:" + myData[i].ItemArray[3].ToString());
++y;
}
enable = true;
}
catch
{
y = 1;
enable = false;
result.Clear();
result.Add("Ошибка выполнения запроса");
}
}
if (y == 0)
{
enable = false;
result.Add("Ничего не найдено");
}
TimerDisconnect.Change(90000, 90000);
return result;
}
public void Activate()
{
if (Connection == null)
{
string stringConnect = "server=" + SGlobalSetting.settingSCCM.server + ";database=" + SGlobalSetting.settingSCCM.dataBase + ";" + AuthType.AuthString();
try
{
Connection = new SqlConnection(stringConnect);
Connection.Open();
Console.WriteLine("Подключились");
error = "Подключенно";
TimerCallback TimerDelegate = new TimerCallback(Deactivate);
TimerDisconnect = new Timer(TimerDelegate, null, 90000,90000);
}
catch
{
Console.WriteLine("Повторное бы подключение");
error = "Не удалось подключиться к базе";
}
}
}
public void Deactivate(object obj)
{
Connection.Close();
Connection = null;
TimerDisconnect.Dispose();
List<string> result = new List<string>();
result.Add("Введите запрос");
Update(result, false, 14);
}
public IComp Result(int index)
{
return comps[index];
}
public string ResultString(int index)
{
switch (mode)
{
case Mode.Login:
return comps[index].GetName();
case Mode.Username:
return comps[index].GetDescription();
case Mode.PCname:
return comps[index].GetNetNameStr();
}
return "";
}
public string CheckConnect(string server, string basa)
{
if (Connection == null)
{
string stringConnect = "server=" + server + ";database=" + basa + ";" + AuthType.AuthString();
try
{
Connection = new SqlConnection(stringConnect);
Connection.Open();
error = "Подключенно";
}
catch
{
error = "Не удалось подключиться к серверу";
}
}
if (Connection.State == ConnectionState.Open && Connection != null)
{
try
{
string sql = "SELECT TOP (1) * FROM dbo._RES_COLL_SMS00001";
SqlCommand sqlCom = new SqlCommand(sql, Connection);
sqlCom.ExecuteNonQuery();
SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCom);
DataTable dt = new DataTable();
dataAdapter.Fill(dt);
DataRow[] myData = dt.Select();
if(myData.Length > 0)
{
error = "Соединие успешно установленно";
}
}
catch
{
error = "Ошибка выполнения запроса \nКакая то не правильная базаю";
}
}
return error;
}
}
}

View File

@ -0,0 +1,86 @@
using Remontor.History;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Remontor.Seacher
{
internal class SeahcLocal : ISeaherMetod
{
internal delegate void ResultUpdate(List<string> Item, bool eneble, int itemHeight);
private ResultUpdate Update;
private List<IComp> comps = new List<IComp>();
private bool enable;
public void Change(ResultUpdate sender, string seach)
{
Update = sender;
if (seach.Length > 2)
{
Update(ResultSeach(seach), enable,14);
}
else
{
List<string> result = new List<string>();
result.Add("Введите запрос");
Update(result,false, 14);
}
}
public List<string> ResultSeach(string seach)
{
int i = 0;
comps.Clear();
List<string> result = new List<string>();
foreach(HistoryItem item in HistoryList.Hitem)
{
if (item.NameNode().ToUpper().Contains(seach.ToUpper()))
{
int y = 0;
foreach(string itemOk in result)
{
if (itemOk.ToUpper() == item.NameNode().ToUpper()) ++y;
}
if(y == 0)
{
result.Add(item.NameNode());
comps.Add(item.GetComp());
++i;
enable = true;
if (i>6) return result;
}
}
}
if (i == 0)
{
enable = false;
result.Add("Ничего не найдено");
}
return result;
}
public IComp Result(int index)
{
return comps[index];
}
public string ResultString(int index)
{
string buf;
if (comps[index].GetName() == null)
{
buf = comps[index].GetNetNameStr();
}
else
{
buf = comps[index].GetName();
if (comps[index].GetNetNameStr() != null) buf += "(" + comps[index].GetNetNameStr() + ")";
}
return buf;
}
}
}

View File

@ -64,7 +64,7 @@
//
// pictureBox1
//
this.pictureBox1.Image = global::Remontor.Properties.Resources.apple_touch_icon;
this.pictureBox1.Image = global::Remontor.Properties.Resources.Person;
this.pictureBox1.Location = new System.Drawing.Point(3, 3);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(48, 48);

View File

@ -0,0 +1,276 @@
using Remontor.History;
using Remontor.Seacher;
using Remontor.Words;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Net.WebRequestMethods;
namespace Remontor.Setting
{
[Serializable]
internal static class SGlobalSetting
{
public static SettingWords settingWords = new SettingWords();
public static SettingExpand settingExpand = new SettingExpand();
public static SettingSCCM settingSCCM = new SettingSCCM();
public static SettingReboot settingReboot = new SettingReboot();
//public static void LoadSetting()
// {
// }
public static void LoadSetting()
{
SSetting setting;
object output = Load("res.dat");
if (!(output is SSetting))
{
setting = new SSetting();
}
else
{
setting = (SSetting)output;
}
if (setting.settingWords != null) settingWords = setting.settingWords;
if (setting.settingExpand != null) settingExpand = setting.settingExpand;
if (setting.settingSCCM != null) settingSCCM = setting.settingSCCM;
if (setting.settingReboot != null) settingReboot = setting.settingReboot;
if (setting.historyItems != null) HistoryList.Hitem = setting.historyItems;
SSeaher.LoadSetting();
// return output;
}
public static bool SaveSettig()
{
SSetting sSetting = new SSetting();
sSetting.settingWords = settingWords;
sSetting.historyItems = HistoryList.Hitem;
sSetting.settingExpand = settingExpand;
sSetting.settingSCCM = settingSCCM;
sSetting.settingReboot = settingReboot;
if (Save("res.dat", sSetting))
{
return true;
}
else
{
return false;
}
}
public static WordsCategory LoadWords()
{
WordsCategory output = (WordsCategory)Load(settingWords.PathBase);
if (output == null)
{
output = new WordsCategory("Main");
}
return output;
}
private static object Load(string path)
{
object obj = null;
GZipStream compressStream = null;
BinaryFormatter binaryFormatter = new BinaryFormatter();
FileStream file = null;
try
{
file = new FileStream(path, FileMode.Open);
compressStream = new GZipStream(file, CompressionMode.Decompress);
obj = binaryFormatter.Deserialize(compressStream);
compressStream.Close();
compressStream.Dispose();
file.Close();
file.Dispose();
return obj;
}
catch
{
if (compressStream != null)
{
compressStream.Close();
compressStream.Dispose();
}
if (file != null)
{
file.Close();
file.Dispose();
}
return null;
}
}
private static object Clone(object input)
{
object output;
BinaryFormatter binaryFormatter = new BinaryFormatter();
MemoryStream Memory = new MemoryStream();
binaryFormatter.Serialize(Memory, input);
Memory.Position = 0;
if (input is WordsCategory) settingWords.HashSumm(Memory);
Memory.Position = 0;
output = binaryFormatter.Deserialize(Memory);
Memory.Dispose();
Memory.Close();
return output;
}
public static WordsCategory Clone(WordsCategory input)
{
return (WordsCategory)Clone((object)input);
}
public static IComp Clone(IComp input)
{
return (IComp)Clone((object)input);
}
public static bool SaveClose(WordsCategory output, DialogResult ok = DialogResult.No)
{
GZipStream compressStream = null;
BinaryFormatter binaryFormatter = new BinaryFormatter();
MemoryStream Memory = new MemoryStream();
binaryFormatter.Serialize(Memory, output);
FileStream file = null;
Memory.Position = 0;
if (settingWords.HashCheck(Memory) )
{
if (ok == DialogResult.OK)
{
Memory.Close();
Memory.Dispose();
bool save = Save(output);
if (save) {
WordsList.MainCategory = output;
return true;
}
else
{
return false;
}
}
else
{
DialogResult result = MessageBox.Show("Сохранить внесенные изменения?", "Сохранение измененний", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
switch (result)
{
case DialogResult.Yes:
try
{
file = new FileStream(settingWords.PathBase, FileMode.Create);
compressStream = new GZipStream(file, CompressionMode.Compress);
Memory.Position = 0;
Memory.CopyTo(compressStream);
Memory.Close();
Memory.Dispose();
compressStream.Close();
compressStream.Dispose();
file.Close();
file.Dispose();
}
catch
{
Memory.Close();
Memory.Dispose();
compressStream.Close();
compressStream.Dispose();
file.Close();
file.Dispose();
bool save = SaveCheck(settingWords.PathBase, output); ;
if (save)
{
WordsList.MainCategory = output;
return true;
}
else
{
return false;
}
}
WordsList.MainCategory = output;
return true;
case DialogResult.No:
return true;
case DialogResult.Cancel:
return false;
}
}
}
return true;
}
public static bool Save(WordsCategory output)
{
return Save(settingWords.PathBase, output);
}
public static bool Save(string path, object output)
{
GZipStream compressStream = null;
BinaryFormatter binaryFormatter = new BinaryFormatter();
FileStream file = null;
try
{
file = new FileStream(path, FileMode.Create);
compressStream = new GZipStream(file, CompressionMode.Compress);
binaryFormatter.Serialize(compressStream, output);
compressStream.Close();
compressStream.Dispose();
file.Close();
file.Dispose();
return true;
}
catch
{
if (compressStream != null)
{
compressStream.Close();
compressStream.Dispose();
}
if (file != null)
{
file.Close();
file.Dispose();
}
return SaveCheck(path, output);
}
}
public static bool SaveCheck(string path, object output)
{
DialogResult result1 = MessageBox.Show("Файл занят другой программой.\nПовторить еще раз?", "Ошибка сохранения", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error);
switch (result1)
{
case (DialogResult.Retry):
return Save(path, output);
case (DialogResult.Abort):
return true;
}
return false;
}
}
}

View File

@ -0,0 +1,19 @@
using Remontor.History;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Remontor.Setting
{
[Serializable]
internal struct SSetting
{
public SettingWords settingWords;
public List<HistoryItem> historyItems;
public SettingExpand settingExpand;
public SettingSCCM settingSCCM;
public SettingReboot settingReboot;
}
}

View File

@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Remontor.Setting
{
[Serializable]
internal class SettingExpand
{
private List<string> nodePathes;
public SettingExpand()
{
nodePathes = new List<string>();
}
public void ExpendAll(TreeNodeCollection nodes)
{
foreach (string path in nodePathes)
{
string[] folder = path.Split('/');
Expand(nodes, folder, 0);
}
nodePathes.Clear();
}
private void Expand(TreeNodeCollection nodes, string[] folder, int number)
{
int i = nodes.IndexOfKey(folder[number]);
if (i == -1) return;
if (folder.Count() == number+1)
{
nodes[i].Expand();
}
else
{
Expand(nodes[i].Nodes, folder, ++number);
}
}
public void SaveExpand(TreeNodeCollection nodes, string path = "")
{
foreach(TreeNode node in nodes)
{
if(node.Nodes.Count > 0)
{
if (node.IsExpanded)
{
nodePathes.Add(path + node.Name);
}
SaveExpand(node.Nodes, path + node.Name + "/" );
}
}
}
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Remontor.Setting
{
[Serializable]
internal class SettingReboot
{
public int checkConnect;
public int timeOutReboot;
public int timeCheckBeforReboot;
public int sizeHistoryItem;
public SettingReboot()
{
this.checkConnect = 5;
this.timeOutReboot = 5;
this.timeCheckBeforReboot = 50;
this.sizeHistoryItem = 200;
}
}
}

View File

@ -0,0 +1,185 @@
namespace Remontor.Setting
{
partial class SettingRebootControl
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label15 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.nb_checkConnect = new System.Windows.Forms.NumericUpDown();
this.nb_timeOutReboot = new System.Windows.Forms.NumericUpDown();
this.nb_timeCheckBeforReboot = new System.Windows.Forms.NumericUpDown();
this.nb_sizeHistoryItem = new System.Windows.Forms.NumericUpDown();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nb_checkConnect)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nb_timeOutReboot)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nb_timeCheckBeforReboot)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nb_sizeHistoryItem)).BeginInit();
this.SuspendLayout();
//
// groupBox3
//
this.groupBox3.Controls.Add(this.nb_sizeHistoryItem);
this.groupBox3.Controls.Add(this.nb_timeCheckBeforReboot);
this.groupBox3.Controls.Add(this.nb_timeOutReboot);
this.groupBox3.Controls.Add(this.nb_checkConnect);
this.groupBox3.Controls.Add(this.label15);
this.groupBox3.Controls.Add(this.label14);
this.groupBox3.Controls.Add(this.label13);
this.groupBox3.Controls.Add(this.label12);
this.groupBox3.Location = new System.Drawing.Point(3, 3);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(386, 124);
this.groupBox3.TabIndex = 4;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Параметры перезагрузки";
//
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(7, 99);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(130, 13);
this.label15.TabIndex = 11;
this.label15.Text = "Кол-во записей истории";
//
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(7, 73);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(196, 13);
this.label14.TabIndex = 9;
this.label14.Text = "Время контроля после перезагрузки";
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(7, 47);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(166, 13);
this.label13.TabIndex = 7;
this.label13.Text = "Время ожидание перезагрузки";
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(7, 21);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(171, 13);
this.label12.TabIndex = 5;
this.label12.Text = "Кол-во попыток проверки связи";
//
// nb_checkConnect
//
this.nb_checkConnect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.nb_checkConnect.Location = new System.Drawing.Point(184, 18);
this.nb_checkConnect.Maximum = new decimal(new int[] {
1000000,
0,
0,
0});
this.nb_checkConnect.Name = "nb_checkConnect";
this.nb_checkConnect.Size = new System.Drawing.Size(182, 20);
this.nb_checkConnect.TabIndex = 13;
//
// nb_timeOutReboot
//
this.nb_timeOutReboot.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.nb_timeOutReboot.Location = new System.Drawing.Point(184, 44);
this.nb_timeOutReboot.Maximum = new decimal(new int[] {
100000,
0,
0,
0});
this.nb_timeOutReboot.Name = "nb_timeOutReboot";
this.nb_timeOutReboot.Size = new System.Drawing.Size(182, 20);
this.nb_timeOutReboot.TabIndex = 14;
//
// nb_timeCheckBeforReboot
//
this.nb_timeCheckBeforReboot.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.nb_timeCheckBeforReboot.Location = new System.Drawing.Point(208, 70);
this.nb_timeCheckBeforReboot.Maximum = new decimal(new int[] {
100000,
0,
0,
0});
this.nb_timeCheckBeforReboot.Name = "nb_timeCheckBeforReboot";
this.nb_timeCheckBeforReboot.Size = new System.Drawing.Size(158, 20);
this.nb_timeCheckBeforReboot.TabIndex = 15;
//
// nb_sizeHistoryItem
//
this.nb_sizeHistoryItem.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.nb_sizeHistoryItem.Location = new System.Drawing.Point(184, 96);
this.nb_sizeHistoryItem.Maximum = new decimal(new int[] {
10000,
0,
0,
0});
this.nb_sizeHistoryItem.Name = "nb_sizeHistoryItem";
this.nb_sizeHistoryItem.Size = new System.Drawing.Size(182, 20);
this.nb_sizeHistoryItem.TabIndex = 16;
//
// SettingRebootControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox3);
this.Name = "SettingRebootControl";
this.Size = new System.Drawing.Size(391, 130);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nb_checkConnect)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nb_timeOutReboot)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nb_timeCheckBeforReboot)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nb_sizeHistoryItem)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.NumericUpDown nb_timeOutReboot;
private System.Windows.Forms.NumericUpDown nb_checkConnect;
private System.Windows.Forms.NumericUpDown nb_sizeHistoryItem;
private System.Windows.Forms.NumericUpDown nb_timeCheckBeforReboot;
}
}

View File

@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Remontor.Setting
{
public partial class SettingRebootControl : UserControl
{
public SettingRebootControl()
{
InitializeComponent();
UpdateSetting();
}
public void UpdateSetting()
{
if (SGlobalSetting.settingReboot != null)
{
nb_checkConnect.Value = SGlobalSetting.settingReboot.checkConnect;
nb_timeOutReboot.Value = SGlobalSetting.settingReboot.timeOutReboot;
nb_timeCheckBeforReboot.Value = SGlobalSetting.settingReboot.timeCheckBeforReboot;
nb_sizeHistoryItem.Value = SGlobalSetting.settingReboot.sizeHistoryItem;
}
}
public void Save()
{
SGlobalSetting.settingReboot.checkConnect = (int)nb_checkConnect.Value;
SGlobalSetting.settingReboot.timeOutReboot = (int)nb_timeOutReboot.Value;
SGlobalSetting.settingReboot.timeCheckBeforReboot = (int)nb_timeCheckBeforReboot.Value;
SGlobalSetting.settingReboot.sizeHistoryItem = (int)nb_sizeHistoryItem.Value;
}
public bool edited()
{
return (SGlobalSetting.settingReboot.checkConnect != (int)nb_checkConnect.Value ||
SGlobalSetting.settingReboot.timeOutReboot != (int)nb_timeOutReboot.Value ||
SGlobalSetting.settingReboot.timeCheckBeforReboot != (int)nb_timeCheckBeforReboot.Value ||
SGlobalSetting.settingReboot.sizeHistoryItem != (int)nb_sizeHistoryItem.Value);
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Remontor.Setting
{
[Serializable]
internal class SettingSCCM
{
public string server;
public string dataBase;
public string username;
public string password;
public bool on;
public bool windowsAuth;
public SettingSCCM()
{
server = string.Empty;
dataBase = string.Empty;
username = string.Empty;
password = string.Empty;
on = false;
windowsAuth = false;
}
}
}

View File

@ -0,0 +1,191 @@
namespace Remontor.Setting
{
partial class SettingSCCMControl
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.bt_checkConnect = new System.Windows.Forms.Button();
this.label10 = new System.Windows.Forms.Label();
this.ib_password = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.ib_username = new System.Windows.Forms.TextBox();
this.cb_windowsAuth = new System.Windows.Forms.CheckBox();
this.label9 = new System.Windows.Forms.Label();
this.ib_dataBase = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.ib_server = new System.Windows.Forms.TextBox();
this.cb_on = new System.Windows.Forms.CheckBox();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox2
//
this.groupBox2.Controls.Add(this.bt_checkConnect);
this.groupBox2.Controls.Add(this.label10);
this.groupBox2.Controls.Add(this.ib_password);
this.groupBox2.Controls.Add(this.label11);
this.groupBox2.Controls.Add(this.ib_username);
this.groupBox2.Controls.Add(this.cb_windowsAuth);
this.groupBox2.Controls.Add(this.label9);
this.groupBox2.Controls.Add(this.ib_dataBase);
this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Controls.Add(this.ib_server);
this.groupBox2.Controls.Add(this.cb_on);
this.groupBox2.Location = new System.Drawing.Point(3, 3);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(386, 173);
this.groupBox2.TabIndex = 3;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Параметры поиска";
//
// bt_checkConnect
//
this.bt_checkConnect.Location = new System.Drawing.Point(263, 143);
this.bt_checkConnect.Name = "bt_checkConnect";
this.bt_checkConnect.Size = new System.Drawing.Size(112, 23);
this.bt_checkConnect.TabIndex = 11;
this.bt_checkConnect.Text = "Проверить связь";
this.bt_checkConnect.UseVisualStyleBackColor = true;
this.bt_checkConnect.Click += new System.EventHandler(this.bt_checkConnect_Click);
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(193, 102);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(45, 13);
this.label10.TabIndex = 10;
this.label10.Text = "Пароль";
//
// ib_password
//
this.ib_password.Location = new System.Drawing.Point(193, 117);
this.ib_password.Name = "ib_password";
this.ib_password.PasswordChar = '•';
this.ib_password.Size = new System.Drawing.Size(182, 20);
this.ib_password.TabIndex = 9;
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(6, 102);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(38, 13);
this.label11.TabIndex = 8;
this.label11.Text = "Логин";
//
// ib_username
//
this.ib_username.Location = new System.Drawing.Point(6, 117);
this.ib_username.Name = "ib_username";
this.ib_username.Size = new System.Drawing.Size(181, 20);
this.ib_username.TabIndex = 7;
//
// cb_windowsAuth
//
this.cb_windowsAuth.AutoSize = true;
this.cb_windowsAuth.Location = new System.Drawing.Point(10, 82);
this.cb_windowsAuth.Name = "cb_windowsAuth";
this.cb_windowsAuth.Size = new System.Drawing.Size(157, 17);
this.cb_windowsAuth.TabIndex = 6;
this.cb_windowsAuth.Text = "Аутентификация Windows";
this.cb_windowsAuth.UseVisualStyleBackColor = true;
this.cb_windowsAuth.CheckedChanged += new System.EventHandler(this.cb_windowsAuth_CheckedChanged);
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(193, 40);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(72, 13);
this.label9.TabIndex = 5;
this.label9.Text = "База данных";
//
// ib_dataBase
//
this.ib_dataBase.Location = new System.Drawing.Point(193, 55);
this.ib_dataBase.Name = "ib_dataBase";
this.ib_dataBase.Size = new System.Drawing.Size(182, 20);
this.ib_dataBase.TabIndex = 4;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(6, 40);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(113, 13);
this.label8.TabIndex = 3;
this.label8.Text = "Сервер базы данных";
//
// ib_server
//
this.ib_server.Location = new System.Drawing.Point(6, 55);
this.ib_server.Name = "ib_server";
this.ib_server.Size = new System.Drawing.Size(181, 20);
this.ib_server.TabIndex = 1;
//
// cb_on
//
this.cb_on.AutoSize = true;
this.cb_on.Location = new System.Drawing.Point(10, 20);
this.cb_on.Name = "cb_on";
this.cb_on.Size = new System.Drawing.Size(215, 17);
this.cb_on.TabIndex = 0;
this.cb_on.Text = "Связь с SCCM (помощь в поиске ПК)";
this.cb_on.UseVisualStyleBackColor = true;
this.cb_on.CheckedChanged += new System.EventHandler(this.cb_on_CheckedChanged);
//
// SettingSCCMControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox2);
this.Name = "SettingSCCMControl";
this.Size = new System.Drawing.Size(391, 178);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button bt_checkConnect;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox ib_password;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.TextBox ib_username;
private System.Windows.Forms.CheckBox cb_windowsAuth;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox ib_dataBase;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox ib_server;
private System.Windows.Forms.CheckBox cb_on;
}
}

View File

@ -0,0 +1,89 @@
using Remontor.Seacher;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Remontor.Setting
{
public partial class SettingSCCMControl : UserControl
{
public SettingSCCMControl()
{
InitializeComponent();
UpdateSetting();
}
public void UpdateSetting()
{
if (SGlobalSetting.settingSCCM != null)
{
ib_server.Text = SGlobalSetting.settingSCCM.server;
ib_dataBase.Text = SGlobalSetting.settingSCCM.dataBase;
ib_username.Text = SGlobalSetting.settingSCCM.username;
ib_password.Text = SGlobalSetting.settingSCCM.password;
cb_on.Checked = SGlobalSetting.settingSCCM.on;
cb_windowsAuth.Checked = SGlobalSetting.settingSCCM.windowsAuth;
SearchControl(cb_on.Checked);
}
}
private void AuthControl(bool enable)
{
ib_username.Enabled = enable;
ib_password.Enabled = enable;
}
private void SearchControl(bool enable)
{
ib_server.Enabled = enable;
ib_dataBase.Enabled = enable;
cb_windowsAuth.Enabled = enable;
bt_checkConnect.Enabled = enable;
AuthControl(!cb_windowsAuth.Checked && enable);
}
private void cb_on_CheckedChanged(object sender, EventArgs e)
{
SearchControl(cb_on.Checked);
}
private void cb_windowsAuth_CheckedChanged(object sender, EventArgs e)
{
AuthControl(!cb_windowsAuth.Checked);
}
public bool edited()
{
return (SGlobalSetting.settingSCCM.server != ib_server.Text ||
SGlobalSetting.settingSCCM.dataBase != ib_dataBase.Text ||
SGlobalSetting.settingSCCM.username != ib_username.Text ||
SGlobalSetting.settingSCCM.password != ib_password.Text ||
SGlobalSetting.settingSCCM.on != cb_on.Checked ||
SGlobalSetting.settingSCCM.windowsAuth != cb_windowsAuth.Checked);
}
public void Save()
{
SGlobalSetting.settingSCCM.server = ib_server.Text;
SGlobalSetting.settingSCCM.dataBase = ib_dataBase.Text;
SGlobalSetting.settingSCCM.username = ib_username.Text;
SGlobalSetting.settingSCCM.password = ib_password.Text;
SGlobalSetting.settingSCCM.on = cb_on.Checked;
SGlobalSetting.settingSCCM.windowsAuth = cb_windowsAuth.Checked;
}
private void bt_checkConnect_Click(object sender, EventArgs e)
{
SeachSCCM SeacherCheck = new(cb_windowsAuth.Checked, ib_username.Text, ib_password.Text);
MessageBox.Show(SeacherCheck.CheckConnect(ib_server.Text,ib_dataBase.Text));
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,47 @@
using Remontor.Words;
using System;
using System.Collections.Generic;
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 static System.Net.WebRequestMethods;
namespace Remontor.Setting
{
[Serializable]
internal class SettingWords
{
public string PathBase { get; set; }
[NonSerialized]
private MD5 Hash = MD5.Create();
[NonSerialized]
private byte[] hash;
public SettingWords()
{
PathBase = "base.wb";
}
public SettingWords(string pathBase)
{
PathBase = pathBase;
}
public void HashSumm(MemoryStream memory)
{
if(Hash == null) Hash = MD5.Create();
hash = Hash.ComputeHash(memory);
}
public bool HashCheck(MemoryStream memory)
{
byte[] hashSave = Hash.ComputeHash(memory);
return !hash.SequenceEqual(hashSave);
}
}
}

View File

@ -0,0 +1,119 @@
namespace Remontor.Setting
{
partial class SettingWordsControl
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.bt_path_open = new System.Windows.Forms.Button();
this.path = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.bt_wordsBilder = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.bt_path_open);
this.groupBox1.Controls.Add(this.path);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.bt_wordsBilder);
this.groupBox1.Location = new System.Drawing.Point(3, 3);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(386, 98);
this.groupBox1.TabIndex = 2;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Параметры справочника";
//
// bt_path_open
//
this.bt_path_open.Location = new System.Drawing.Point(348, 36);
this.bt_path_open.Name = "bt_path_open";
this.bt_path_open.Size = new System.Drawing.Size(27, 23);
this.bt_path_open.TabIndex = 3;
this.bt_path_open.Text = "...";
this.bt_path_open.UseVisualStyleBackColor = true;
this.bt_path_open.Click += new System.EventHandler(this.bt_path_open_Click);
//
// path
//
this.path.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.path.Location = new System.Drawing.Point(10, 37);
this.path.Name = "path";
this.path.Size = new System.Drawing.Size(339, 20);
this.path.TabIndex = 2;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(7, 20);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(105, 13);
this.label7.TabIndex = 1;
this.label7.Text = "Файл базы данных";
//
// bt_wordsBilder
//
this.bt_wordsBilder.Location = new System.Drawing.Point(220, 65);
this.bt_wordsBilder.Name = "bt_wordsBilder";
this.bt_wordsBilder.Size = new System.Drawing.Size(155, 23);
this.bt_wordsBilder.TabIndex = 0;
this.bt_wordsBilder.Text = "Редактор справочника";
this.bt_wordsBilder.UseVisualStyleBackColor = true;
this.bt_wordsBilder.Click += new System.EventHandler(this.bt_wordsBilder_Click);
//
// openFileDialog1
//
this.openFileDialog1.CheckFileExists = false;
this.openFileDialog1.DefaultExt = "*.wb";
this.openFileDialog1.Filter = "База справочника|*.wb";
//
// SettingWordsControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox1);
this.Name = "SettingWordsControl";
this.Size = new System.Drawing.Size(391, 103);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button bt_path_open;
private System.Windows.Forms.TextBox path;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Button bt_wordsBilder;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
}
}

View File

@ -0,0 +1,70 @@
using Remontor.Words;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace Remontor.Setting
{
partial class SettingWordsControl : UserControl
{
public delegate void DUpdateTree();
public DUpdateTree UpdateTree;
public SettingWordsControl()
{
InitializeComponent();
UpdateSetting();
}
public void UpdateSetting()
{
if (SGlobalSetting.settingWords != null)
{
path.Text = SGlobalSetting.settingWords.PathBase;
}
}
private void bt_wordsBilder_Click(object sender, EventArgs e)
{
BilderWords bilderWords = new BilderWords();
DialogResult result = bilderWords.ShowDialog();
if (result == DialogResult.OK)
{
UpdateTree();
}
}
private void bt_path_open_Click(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
if(openFileDialog1.FileName != null)
{
path.Text = openFileDialog1.FileName;
}
}
public bool edited()
{
return (SGlobalSetting.settingWords.PathBase != path.Text);
}
public void Save()
{
if(SGlobalSetting.settingWords.PathBase != path.Text)
{
SGlobalSetting.settingWords.PathBase = path.Text;
}
}
}
}

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

230
Remontor/Words/BilderWords.Designer.cs generated Normal file
View File

@ -0,0 +1,230 @@
namespace Remontor.Words
{
partial class BilderWords
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BilderWords));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.panel1 = new System.Windows.Forms.Panel();
this.bt_close = new System.Windows.Forms.Button();
this.bt_saveClose = new System.Windows.Forms.Button();
this.bt_save = new System.Windows.Forms.Button();
this.bt_deleteItem = new System.Windows.Forms.Button();
this.treeView1 = new System.Windows.Forms.TreeView();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.bt_newPC = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.bt_newCat = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
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);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(268, 502);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Параметры";
//
// panel1
//
this.panel1.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.panel1.Location = new System.Drawing.Point(3, 19);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(262, 480);
this.panel1.TabIndex = 0;
//
// bt_close
//
this.bt_close.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.bt_close.Location = new System.Drawing.Point(417, 521);
this.bt_close.Name = "bt_close";
this.bt_close.Size = new System.Drawing.Size(75, 23);
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
//
this.bt_saveClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.bt_saveClose.Location = new System.Drawing.Point(280, 521);
this.bt_saveClose.Name = "bt_saveClose";
this.bt_saveClose.Size = new System.Drawing.Size(131, 23);
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
//
this.bt_save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.bt_save.Location = new System.Drawing.Point(199, 521);
this.bt_save.Name = "bt_save";
this.bt_save.Size = new System.Drawing.Size(75, 23);
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);
//
// bt_deleteItem
//
this.bt_deleteItem.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.bt_deleteItem.Location = new System.Drawing.Point(12, 521);
this.bt_deleteItem.Name = "bt_deleteItem";
this.bt_deleteItem.Size = new System.Drawing.Size(112, 23);
this.bt_deleteItem.TabIndex = 9;
this.bt_deleteItem.Text = "Удалить элемент";
this.bt_deleteItem.UseVisualStyleBackColor = true;
this.bt_deleteItem.Click += new System.EventHandler(this.bt_deleteItem_Click);
//
// 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)
| 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, 42);
this.treeView1.Name = "treeView1";
this.treeView1.SelectedImageIndex = 1;
this.treeView1.ShowLines = false;
this.treeView1.Size = new System.Drawing.Size(207, 470);
this.treeView1.TabIndex = 4;
this.treeView1.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView1_BeforeSelect);
this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect);
this.treeView1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.treeView1_MouseClick);
//
// imageList1
//
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
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");
//
// bt_newPC
//
this.bt_newPC.Location = new System.Drawing.Point(76, 13);
this.bt_newPC.Name = "bt_newPC";
this.bt_newPC.Size = new System.Drawing.Size(34, 23);
this.bt_newPC.TabIndex = 10;
this.bt_newPC.Tag = "pc";
this.bt_newPC.Text = "+";
this.bt_newPC.UseVisualStyleBackColor = true;
this.bt_newPC.Click += new System.EventHandler(this.bt_new_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 18);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Компьютер";
//
// bt_newCat
//
this.bt_newCat.Location = new System.Drawing.Point(180, 13);
this.bt_newCat.Name = "bt_newCat";
this.bt_newCat.Size = new System.Drawing.Size(34, 23);
this.bt_newCat.TabIndex = 12;
this.bt_newCat.Tag = "cat";
this.bt_newCat.Text = "+";
this.bt_newCat.UseVisualStyleBackColor = true;
this.bt_newCat.Click += new System.EventHandler(this.bt_new_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(120, 18);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(60, 13);
this.label2.TabIndex = 11;
this.label2.Text = "Категория";
//
// BilderWords
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(504, 556);
this.Controls.Add(this.bt_newCat);
this.Controls.Add(this.label2);
this.Controls.Add(this.bt_newPC);
this.Controls.Add(this.label1);
this.Controls.Add(this.treeView1);
this.Controls.Add(this.bt_deleteItem);
this.Controls.Add(this.bt_save);
this.Controls.Add(this.bt_saveClose);
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.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Редактор справочника";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BilderWords_FormClosing);
this.Load += new System.EventHandler(this.BilderWords_Load);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button bt_close;
private System.Windows.Forms.Button bt_saveClose;
private System.Windows.Forms.Button bt_save;
private System.Windows.Forms.Button bt_deleteItem;
private System.Windows.Forms.TreeView treeView1;
public System.Windows.Forms.ImageList imageList1;
private System.Windows.Forms.Button bt_newPC;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button bt_newCat;
private System.Windows.Forms.Label label2;
}
}

View File

@ -0,0 +1,420 @@
using Remontor.History;
using Remontor.Setting;
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.Reflection;
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;
namespace Remontor.Words
{
internal partial class BilderWords : Form
{
private Control control;
private bool DragOn;
WordsCategory ChangeCategory;
//private byte[] hash;
//MD5 Hash = MD5.Create();
public BilderWords()
{
LoadForm();
treeView1.Nodes.AddRange(WordsList.ListNodes(ChangeCategory));
}
public BilderWords(IComp comp)
{
LoadForm();
CompId compId = (CompId)SGlobalSetting.Clone(comp);
WordsComp item = new WordsComp(compId);
WordsList.AddItem(item, ChangeCategory);
treeView1.Nodes.AddRange(WordsList.ListNodes(ChangeCategory));
treeView1.SelectedNode = treeView1.Nodes[treeView1.Nodes.Count-1];
}
private void LoadForm()
{
ChangeCategory = SGlobalSetting.Clone(WordsList.MainCategory);
InitializeComponent();
//cb_create.SelectedIndex = 1;
treeView1.ItemDrag += new ItemDragEventHandler(TreeView1_ItemDrag);
treeView1.DragEnter += new DragEventHandler(TreeView1_DragEnter);
treeView1.DragOver += new DragEventHandler(TreeView1_DragOver);
treeView1.DragDrop += new DragEventHandler(TreeView1_DragDrop);
}
private void TreeView1_ItemDrag(object sender, ItemDragEventArgs e)
{
DragOn = true;
if (e.Button == MouseButtons.Left)
{
DoDragDrop(e.Item, DragDropEffects.Move);
}
}
private void TreeView1_DragEnter(object sender, DragEventArgs e)
{
DragOn = true;
e.Effect = e.AllowedEffect;
}
private void TreeView1_DragOver(object sender, DragEventArgs e)
{
Point targetPoint = treeView1.PointToClient(new Point(e.X, e.Y));
treeView1.SelectedNode = treeView1.GetNodeAt(targetPoint);
}
private void TreeView1_DragDrop(object sender, DragEventArgs e)
{
DragOn = false;
int indexMod = 0;
int index = 0;
Point targetPoint = treeView1.PointToClient(new Point(e.X, e.Y));
TreeNode selectNode = treeView1.GetNodeAt(targetPoint);
TreeNode moveNode = (TreeNode)e.Data.GetData(typeof(TreeNode));
if(selectNode == null)
{
// indexMod = 1;
}
else
{
int PointH = targetPoint.Y - selectNode.Bounds.Y;
if (PointH > 6) indexMod = 1;
}
//if (!((IWordsItem)moveNode.Tag).ChekMove((IWordsItem)selectNode.Tag)) return;
WordsCategory DstCategory;
TreeNodeCollection DstNodes;
if (selectNode == null)
{
DstCategory = ChangeCategory;
DstNodes = treeView1.Nodes;
if(targetPoint.Y < 5)
{
index = 0;
}
else
{
index = treeView1.Nodes.Count;
}
}
else if (selectNode.Tag is WordsCategory)
{
DstCategory = (WordsCategory)selectNode.Tag;
DstNodes = selectNode.Nodes;
selectNode.Expand();
// index = 1;
}
else if (selectNode.Parent == null)
{
DstCategory = ChangeCategory;
DstNodes = treeView1.Nodes;
index = selectNode.Index + indexMod;
}
else
{
DstCategory = (WordsCategory)selectNode.Parent.Tag;
DstNodes = selectNode.Parent.Nodes;
index = selectNode.Index + indexMod;
}
WordsCategory SrcCategory;
TreeNodeCollection SrcNodes;
if (moveNode == null)
{
SrcCategory = ChangeCategory;
SrcNodes = treeView1.Nodes;
}
else if (moveNode.Parent == null)
{
SrcCategory = ChangeCategory;
SrcNodes = treeView1.Nodes;
}
else
{
SrcCategory = (WordsCategory)moveNode.Parent.Tag;
SrcNodes = moveNode.Parent.Nodes;
}
if(SrcCategory == DstCategory)
{
if (selectNode == null)
{
if (targetPoint.Y > 5) index--;
}
else if(selectNode.Tag == DstCategory)
{
index = 0;
}
else if(selectNode.Tag == moveNode.Tag)
{
return;
}
else if(moveNode.Index < selectNode.Index)
{
index--;
}
}
IWordsItem MoveItem = (IWordsItem)moveNode.Tag;
if (!MoveItem.ChekMove(DstCategory)) return;
WordsList.MoveItem(index, MoveItem, SrcCategory, DstCategory);
// treeView1.Nodes.Clear();
// treeView1.Nodes.AddRange(WordsList.ListNodes());
SrcNodes.Remove(moveNode);
DstNodes.Insert(index, moveNode);
}
public BilderWords(WordsCategory category):base()
{
}
public BilderWords(WordsComp item) : base()
{
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
if (e.Node != null && !DragOn)
{
if (e.Node.Tag is WordsComp)
{
WordsComp wordsComp = (WordsComp)e.Node.Tag;
control = new WordsEditCompControl(wordsComp, e.Node, imageList1);
panel1.Controls.Add(control);
}
if (e.Node.Tag is WordsCategory)
{
WordsCategory wordsCategory = (WordsCategory)e.Node.Tag;
control = new WordsEditCategoryControl(wordsCategory, e.Node);
panel1.Controls.Add(control);
}
}
}
private void treeView1_BeforeSelect(object sender, TreeViewCancelEventArgs e)
{
if(control != null && !DragOn)
{
control.Visible = false;
control.Dispose();
}
}
private void bt_new_Click(object sender, EventArgs e)
{
WordsCategory ParentCategory;
TreeNode selectNode = treeView1.SelectedNode;
TreeNodeCollection ParentNodes;
int index = 0;
if(selectNode == null)
{
ParentCategory = ChangeCategory;
ParentNodes = treeView1.Nodes;
}
else if(selectNode.Tag is WordsCategory)
{
ParentCategory = (WordsCategory)selectNode.Tag;
ParentNodes = selectNode.Nodes;
selectNode.Expand();
}
else if (selectNode.Parent == null)
{
ParentCategory = ChangeCategory;
ParentNodes = treeView1.Nodes;
// index = selectNode.Index+1;
}
else
{
ParentCategory = (WordsCategory)selectNode.Parent.Tag;
ParentNodes = selectNode.Parent.Nodes;
// index = selectNode.Index+1;
}
object item = null;
TreeNode treeNode = new TreeNode();
Button sendBt = (Button)sender;
switch (sendBt.Tag)
{
case "cat":
item = new WordsCategory("Новая категория");
index = 0;
WordsList.InsertItem(index, (WordsCategory)item, ParentCategory);
treeNode.ImageIndex = 0;
treeNode.SelectedImageIndex = 0;
treeNode.Text = "Новая категория";
break;
case "pc":
item = new WordsComp(new CompId("Новый ПК"));
index = ParentCategory.Count();
WordsList.InsertItem(index, (WordsComp)item, ParentCategory);
treeNode.ImageIndex = 1;
treeNode.SelectedImageIndex = 1;
treeNode.Text = "Новый ПК";
break;
}
treeNode.Tag = item;
ParentNodes.Insert(index,treeNode);
}
private void BilderWords_FormClosing(object sender, FormClosingEventArgs e)
{
if (control != null)
{
control.Visible = false;
control.Visible = true;
}
if (!SGlobalSetting.SaveClose(ChangeCategory, this.DialogResult))
{
e.Cancel = true;
}
else
{
// WordsList.MainCategory = ChangeCategory;
this.DialogResult = DialogResult.OK;
}
}
private void bt_deleteItem_Click(object sender, EventArgs e)
{
TreeNode selectNode = treeView1.SelectedNode;
if (selectNode == null) return;
WordsCategory ParentCategory;
TreeNodeCollection ParentNodes;
treeView1.SelectedNode = null;
control.Visible = false;
control.Dispose();
if (selectNode.Parent == null)
{
ParentCategory = ChangeCategory;
ParentNodes = treeView1.Nodes;
}
else
{
ParentCategory = (WordsCategory)selectNode.Parent.Tag;
ParentNodes = selectNode.Parent.Nodes;
}
if (selectNode.Tag == null) return;
IWordsItem wordsItem = (IWordsItem)selectNode.Tag;
if(selectNode.NextNode != null)
{
treeView1.SelectedNode = selectNode.NextNode;
}else if(selectNode.PrevNode != null)
{
treeView1.SelectedNode = selectNode.PrevNode;
}else if(selectNode.Parent != null) treeView1.SelectedNode = selectNode.Parent ;
ParentCategory.DeleteItem(wordsItem);
ParentNodes.Remove(selectNode);
}
private void treeView1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
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)
{
if (control != null && !DragOn)
{
control.Visible = false;
control.Dispose();
}
treeView1.SelectedNode = null;
}
}
private void treeView1_KeyDown(object sender, KeyEventArgs e)
{
}
private void panel2_MouseDown(object sender, MouseEventArgs e)
{
}
private void bt_saveClose_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
private void bt_save_Click(object sender, EventArgs e)
{
if (control != null)
{
control.Visible = false;
control.Visible = true;
}
if(SGlobalSetting.Save(ChangeCategory)) WordsList.MainCategory = ChangeCategory;
SGlobalSetting.Clone(WordsList.MainCategory);
}
private void bt_close_Click(object sender, EventArgs e)
{
this.Close();
}
private void BilderWords_Load(object sender, EventArgs e)
{
}
}
}

File diff suppressed because it is too large Load Diff

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

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Reseter2.Words
{
[Serializable]
internal abstract class IWordsItem
{
public abstract List<WordsCategory> CategoryList();
public abstract void Delete();
public abstract TreeNode NodeList();
public abstract bool ChekMove(IWordsItem wordsItem);
}
}

View File

@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Reseter2.Words
{
[Serializable]
internal class WordsCategory : IWordsItem
{
private string Name;
private List<IWordsItem> items;
public WordsCategory(string name)
{
Name = name;
items = new List<IWordsItem>();
}
public WordsCategory(string name, List<IWordsItem> Items)
{
Name = name;
items = Items;
}
public void Add(IWordsItem newitem)
{
items.Add(newitem);
}
public void Insert(int index, IWordsItem newitem)
{
//if (index > items.Count) index = items.Count;
items.Insert(index, newitem);
}
public void Move(int index, IWordsItem item, WordsCategory wordsdst)
{
items.Remove(item);
wordsdst.Insert(index, item);
}
public string GetName()
{
return Name;
}
public void SetName(string name)
{
Name = name;
}
public IWordsItem Items(int item)
{
return items[item];
}
public List<IWordsItem> Items()
{
return items;
}
public int Count()
{
return items.Count;
}
public void DeleteItem(IWordsItem wordsItem)
{
wordsItem.Delete();
items.Remove(wordsItem);
}
public override bool ChekMove(IWordsItem wordsItem)
{
if(this == wordsItem) return false;
foreach (var item in items)
{
if(!item.ChekMove(wordsItem)) return false;
}
return true;
}
public override void Delete() {
foreach(IWordsItem item in items)
{
item.Delete();
}
items.Clear();
}
public override List<WordsCategory> CategoryList()
{
List<WordsCategory> itemsCatrgory = new List<WordsCategory>();
itemsCatrgory.Add(this);
foreach (var item in items)
{
itemsCatrgory.AddRange(item.CategoryList());
}
return itemsCatrgory;
}
public override TreeNode NodeList()
{
TreeNode treeNode = new TreeNode(GetName());
treeNode.Name = GetName();
treeNode.Tag = this;
treeNode.ImageIndex = 0;
treeNode.SelectedImageIndex = 0;
treeNode.StateImageIndex = 0;
foreach (var item in items)
{
int i = treeNode.Nodes.Add(item.NodeList());
treeNode.Nodes[i].Name += treeNode.Nodes[i].Index;
}
return treeNode;
}
}
}

View File

@ -0,0 +1,103 @@
namespace Remontor.Words
{
partial class WordsCategoryControl
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
this.Select = new System.Windows.Forms.CheckBox();
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();
//
// Select
//
this.Select.AutoSize = true;
this.Select.Location = new System.Drawing.Point(6, 2);
this.Select.Name = "Select";
this.Select.Size = new System.Drawing.Size(15, 14);
this.Select.TabIndex = 1;
this.Select.UseVisualStyleBackColor = true;
//
// lb_name
//
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.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(21, -4);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(30, 29);
this.label1.TabIndex = 3;
this.label1.Text = "⟱";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// flow_wordsItem
//
this.flow_wordsItem.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.flow_wordsItem.AutoSize = true;
this.flow_wordsItem.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flow_wordsItem.Location = new System.Drawing.Point(5, 20);
this.flow_wordsItem.Name = "flow_wordsItem";
this.flow_wordsItem.Size = new System.Drawing.Size(395, 5);
this.flow_wordsItem.TabIndex = 4;
this.flow_wordsItem.WrapContents = false;
//
// WordsCategoryControl
//
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.lb_name);
this.Name = "WordsCategoryControl";
this.Size = new System.Drawing.Size(401, 25);
this.Load += new System.EventHandler(this.WordsCategoryControl_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.CheckBox Select;
private System.Windows.Forms.Label lb_name;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.FlowLayoutPanel flow_wordsItem;
}
}

View File

@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Remontor.Words
{
[DefaultEvent(nameof(WordsCategoryControl))]
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)
{
flow_wordsItem.Controls.Add(wic);
}
private void label1_Click(object sender, EventArgs e)
{
flow_wordsItem.Visible = !flow_wordsItem.Visible;
}
private void WordsCategoryControl_Load(object sender, EventArgs e)
{
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

124
Remontor/Words/WordsComp.cs Normal file
View File

@ -0,0 +1,124 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
namespace Remontor.Words
{
[Serializable]
internal class WordsComp : IWordsItem
{
private IComp Comp;
public WordsComp(IComp comp)
{
Comp = comp;
}
public WordsComp(String name, String ip, String description)
{
IPAddress iPAddress;
try
{
iPAddress = IPAddress.Parse(ip);
}
catch
{
iPAddress = null;
}
Comp = new CompId(name,description, iPAddress);
}
public void Set(String name, String ip, String description, int imgIndex, string netname)
{
IPAddress iPAddress;
try
{
iPAddress = IPAddress.Parse(ip);
}
catch
{
iPAddress = null;
}
Comp.SetIP(iPAddress);
Comp.SetName(name);
Comp.SetDescription(description);
Comp.SetImage(imgIndex);
Comp.SetNetName(netname);
}
public string GetName()
{
return Comp.GetName();
}
public string GetNetName()
{
return Comp.GetNetName();
}
public override bool ChekMove(IWordsItem wordsItem)
{
return true ;
}
public string GetDescription()
{
return Comp.GetDescription();
}
public string GetIP()
{
if(Comp.GetIP() != null)
{
return Comp.GetIP().ToString();
}
return null;
}
public IComp GetComp()
{
return Comp;
}
public override void Delete()
{
Comp = null;
}
public override List<WordsCategory> CategoryList()
{
return new List<WordsCategory>();
}
public string NameNode()
{
string buf;
if (Comp.GetName() == null)
{
buf = Comp.GetNetNameStr();
}
else
{
buf = Comp.GetName();
if (Comp.GetNetNameStr() != null) buf += "(" + Comp.GetNetNameStr() + ")";
}
return buf;
}
public override TreeNode NodeList()
{
TreeNode treeNode = new TreeNode();
treeNode.Text = NameNode();
treeNode.Name = NameNode();
treeNode.Tag = this;
treeNode.ImageIndex = Comp.GetImage();
treeNode.SelectedImageIndex = Comp.GetImage();
treeNode.StateImageIndex = 0;
return treeNode;
}
}
}

View File

@ -0,0 +1,75 @@
namespace Remontor.Words
{
partial class WordsEditCategoryControl
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.lb_name = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 10);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(112, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Название категории";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// lb_name
//
this.lb_name.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lb_name.Location = new System.Drawing.Point(6, 26);
this.lb_name.Name = "lb_name";
this.lb_name.Size = new System.Drawing.Size(245, 20);
this.lb_name.TabIndex = 3;
//
// WordsEditCategoryControl
//
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, 49);
this.VisibleChanged += new System.EventHandler(this.WordsEditCategoryControl_VisibleChanged);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox lb_name;
}
}

View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Remontor.Words
{
[DefaultEvent(nameof(WordsEditCategoryControl))]
internal partial class WordsEditCategoryControl : UserControl
{
private WordsCategory wordsCategory;
private TreeNode treeNode;
public WordsEditCategoryControl()
{
InitializeComponent();
}
public WordsEditCategoryControl(WordsCategory wordscategory, TreeNode treenode)
{
InitializeComponent();
lb_name.Text = wordscategory.GetName();
wordsCategory = wordscategory;
treeNode = treenode;
}
private void label1_Click(object sender, EventArgs e)
{
}
private void WordsEditCategoryControl_VisibleChanged(object sender, EventArgs e)
{
treeNode.Text = lb_name.Text;
wordsCategory.SetName(lb_name.Text);
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,176 @@
namespace Remontor.Words
{
partial class WordsEditCompControl
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
this.lb_name = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.lb_ip = new System.Windows.Forms.TextBox();
this.lb_description = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.tb_netName = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// lb_name
//
this.lb_name.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lb_name.Location = new System.Drawing.Point(6, 30);
this.lb_name.Name = "lb_name";
this.lb_name.Size = new System.Drawing.Size(245, 20);
this.lb_name.TabIndex = 2;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 14);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(47, 13);
this.label2.TabIndex = 3;
this.label2.Text = "Имя ПК";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(3, 92);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(50, 13);
this.label3.TabIndex = 5;
this.label3.Text = "IP-адрес";
//
// lb_ip
//
this.lb_ip.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lb_ip.Location = new System.Drawing.Point(6, 108);
this.lb_ip.Name = "lb_ip";
this.lb_ip.Size = new System.Drawing.Size(245, 20);
this.lb_ip.TabIndex = 4;
//
// lb_description
//
this.lb_description.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lb_description.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lb_description.Location = new System.Drawing.Point(6, 147);
this.lb_description.MaxLength = 350;
this.lb_description.Multiline = true;
this.lb_description.Name = "lb_description";
this.lb_description.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.lb_description.Size = new System.Drawing.Size(245, 134);
this.lb_description.TabIndex = 6;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(3, 131);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(57, 13);
this.label4.TabIndex = 7;
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 = "Значок";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(3, 53);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(72, 13);
this.label5.TabIndex = 11;
this.label5.Text = "Сетевое имя";
//
// tb_netName
//
this.tb_netName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tb_netName.Location = new System.Drawing.Point(6, 69);
this.tb_netName.Name = "tb_netName";
this.tb_netName.Size = new System.Drawing.Size(245, 20);
this.tb_netName.TabIndex = 10;
this.tb_netName.VisibleChanged += new System.EventHandler(this.WordsEditCompControl_VisibleChanged);
//
// WordsEditCompControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.AutoValidate = System.Windows.Forms.AutoValidate.Disable;
this.Controls.Add(this.label5);
this.Controls.Add(this.tb_netName);
this.Controls.Add(this.label1);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.label4);
this.Controls.Add(this.lb_description);
this.Controls.Add(this.label3);
this.Controls.Add(this.lb_ip);
this.Controls.Add(this.label2);
this.Controls.Add(this.lb_name);
this.Name = "WordsEditCompControl";
this.Size = new System.Drawing.Size(254, 284);
this.VisibleChanged += new System.EventHandler(this.WordsEditCompControl_VisibleChanged);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox lb_name;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox lb_ip;
private System.Windows.Forms.TextBox lb_description;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox tb_netName;
}
}

View File

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Remontor.Words
{
[DefaultEvent(nameof(WordsEditCompControl))]
internal partial class WordsEditCompControl : UserControl
{
private WordsComp wordsComp;
private TreeNode treeNode;
private ImageList imageList;
public WordsEditCompControl()
{
InitializeComponent();
}
public WordsEditCompControl(WordsComp wordscomp, TreeNode treenode, ImageList imagelist)
{
InitializeComponent();
imageList = imagelist;
comboBox1.DataSource = imageList.Images;
lb_name.Text = wordscomp.GetName();
lb_ip.Text = wordscomp.GetIP();
lb_description.Text = wordscomp.GetDescription();
tb_netName.Text = wordscomp.GetNetName();
wordsComp = wordscomp;
treeNode = treenode;
comboBox1.SelectedIndex = treeNode.ImageIndex;
}
public void Save()
{
// lb_description.
}
private void WordsEditCompControl_VisibleChanged(object sender, EventArgs e)
{
wordsComp.Set(lb_name.Text.Length > 0 ? lb_name.Text : null,
lb_ip.Text.Length > 0 ? lb_ip.Text : null,
lb_description.Text.Length > 0 ? lb_description.Text : null,
comboBox1.SelectedIndex,
tb_netName.Text.Length > 0 ? tb_netName.Text : null);
treeNode.Text = wordsComp.NameNode();
treeNode.ImageIndex = comboBox1.SelectedIndex;
treeNode.SelectedImageIndex = 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

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,130 @@
namespace Remontor.Words
{
partial class WordsItemControl
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором компонентов
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
private void InitializeComponent()
{
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.label1 = new System.Windows.Forms.Label();
this.lb_name = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.lb_ip = 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
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(8, 6);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(15, 14);
this.checkBox1.TabIndex = 0;
this.checkBox1.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.AutoSize = true;
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;
this.label1.Text = "Имя ПК";
//
// lb_name
//
this.lb_name.AutoSize = true;
this.lb_name.Location = new System.Drawing.Point(103, 0);
this.lb_name.Name = "lb_name";
this.lb_name.Size = new System.Drawing.Size(0, 13);
this.lb_name.TabIndex = 2;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(183, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(50, 13);
this.label2.TabIndex = 3;
this.label2.Text = "IP-адрес";
//
// lb_ip
//
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(0, 13);
this.lb_ip.TabIndex = 4;
//
// lb_dsp
//
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;
//
// pb_icon
//
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.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);
this.Controls.Add(this.label1);
this.Controls.Add(this.checkBox1);
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();
}
#endregion
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Label label1;
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 lb_dsp;
private System.Windows.Forms.PictureBox pb_icon;
}
}

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Remontor.Words
{
[DefaultEvent(nameof(WordsItemControl))]
internal partial class WordsItemControl : UserControl, IWordsContol
{
public WordsItemControl()
{
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

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Remontor.Words
{
[Serializable]
static class WordsList
{
public static WordsCategory MainCategory = new WordsCategory("Main");
public static void AddItem(IWordsItem item, WordsCategory wordsCategory)
{
wordsCategory.Add(item);
}
public static void InsertItem(int index,IWordsItem item, WordsCategory wordsCategory)
{
wordsCategory.Insert(index, item);
}
public static void MoveItem(int index, IWordsItem item, WordsCategory SrcCategory, WordsCategory DstCategory)
{
SrcCategory.Move(index, item, DstCategory);
}
public static TreeNode[] ListNodes()
{
TreeNode[] treeNodes = new TreeNode[MainCategory.Count()];
for(int i = 0; i < MainCategory.Count(); i++)
{
treeNodes[i] = MainCategory.Items(i).NodeList();
treeNodes[i].Name += i;
}
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;
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.