Merge pull request 'add_reboot' (#4) from add_reboot into main
Reviewed-on: #4
This commit is contained in:
commit
4d73161aa5
|
|
@ -0,0 +1,72 @@
|
|||
namespace Reseter2
|
||||
{
|
||||
partial class CheckControl
|
||||
{
|
||||
/// <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.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CheckControl));
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.imageList2 = new System.Windows.Forms.ImageList(this.components);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(18, 18);
|
||||
this.pictureBox1.TabIndex = 0;
|
||||
this.pictureBox1.TabStop = false;
|
||||
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
|
||||
//
|
||||
// imageList2
|
||||
//
|
||||
this.imageList2.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList2.ImageStream")));
|
||||
this.imageList2.TransparentColor = System.Drawing.Color.Transparent;
|
||||
this.imageList2.Images.SetKeyName(0, "off.ico");
|
||||
this.imageList2.Images.SetKeyName(1, "on.ico");
|
||||
this.imageList2.Images.SetKeyName(2, "or.ico");
|
||||
//
|
||||
// CheckControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.Name = "CheckControl";
|
||||
this.Size = new System.Drawing.Size(18, 18);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.ImageList imageList2;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
using Reseter2.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;
|
||||
|
||||
namespace Reseter2
|
||||
{
|
||||
|
||||
[DefaultEvent(nameof(CheckControl))]
|
||||
|
||||
partial class CheckControl : UserControl
|
||||
{
|
||||
|
||||
public bool Checked = false;
|
||||
// public ImageList imageList;
|
||||
public delegate void UpdateCheck(bool check);
|
||||
public event UpdateCheck updateCheck;
|
||||
|
||||
public CheckControl():base()
|
||||
{
|
||||
// imageList = imagelist;
|
||||
if (!this.DesignMode)
|
||||
{
|
||||
InitializeComponent();
|
||||
pictureBox1.Image = imageList2.Images[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void pictureBox1_Click(object sender, EventArgs e)
|
||||
{
|
||||
Checked = !Checked;
|
||||
if (Checked)
|
||||
{
|
||||
pictureBox1.Image = imageList2.Images[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
pictureBox1.Image = imageList2.Images[0];
|
||||
}
|
||||
updateCheck(Checked);
|
||||
}
|
||||
|
||||
public void set_intedmet()
|
||||
{
|
||||
pictureBox1.Image = imageList2.Images[2];
|
||||
}
|
||||
public void set_state(bool checkeds)
|
||||
{
|
||||
Checked = checkeds;
|
||||
if (Checked)
|
||||
{
|
||||
pictureBox1.Image = imageList2.Images[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
pictureBox1.Image = imageList2.Images[0];
|
||||
}
|
||||
// updateCheck(Checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
<?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="imageList2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="imageList2.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADQ
|
||||
CgAAAk1TRnQBSQFMAgEBAwEAASgBAAEoAQABEgEAARIBAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABSAMAARIDAAEBAQABCAUAARABBRgAAYACAAGAAwACgAEAAYADAAGAAQABgAEAAoACAAPAAQABwAHc
|
||||
AcABAAHwAcoBpgEAATMFAAEzAQABMwEAATMBAAIzAgADFgEAAxwBAAMiAQADKQEAA1UBAANNAQADQgEA
|
||||
AzkBAAGAAXwB/wEAAlAB/wEAAZMBAAHWAQAB/wHsAcwBAAHGAdYB7wEAAdYC5wEAAZABqQGtAgAB/wEz
|
||||
AwABZgMAAZkDAAHMAgABMwMAAjMCAAEzAWYCAAEzAZkCAAEzAcwCAAEzAf8CAAFmAwABZgEzAgACZgIA
|
||||
AWYBmQIAAWYBzAIAAWYB/wIAAZkDAAGZATMCAAGZAWYCAAKZAgABmQHMAgABmQH/AgABzAMAAcwBMwIA
|
||||
AcwBZgIAAcwBmQIAAswCAAHMAf8CAAH/AWYCAAH/AZkCAAH/AcwBAAEzAf8CAAH/AQABMwEAATMBAAFm
|
||||
AQABMwEAAZkBAAEzAQABzAEAATMBAAH/AQAB/wEzAgADMwEAAjMBZgEAAjMBmQEAAjMBzAEAAjMB/wEA
|
||||
ATMBZgIAATMBZgEzAQABMwJmAQABMwFmAZkBAAEzAWYBzAEAATMBZgH/AQABMwGZAgABMwGZATMBAAEz
|
||||
AZkBZgEAATMCmQEAATMBmQHMAQABMwGZAf8BAAEzAcwCAAEzAcwBMwEAATMBzAFmAQABMwHMAZkBAAEz
|
||||
AswBAAEzAcwB/wEAATMB/wEzAQABMwH/AWYBAAEzAf8BmQEAATMB/wHMAQABMwL/AQABZgMAAWYBAAEz
|
||||
AQABZgEAAWYBAAFmAQABmQEAAWYBAAHMAQABZgEAAf8BAAFmATMCAAFmAjMBAAFmATMBZgEAAWYBMwGZ
|
||||
AQABZgEzAcwBAAFmATMB/wEAAmYCAAJmATMBAANmAQACZgGZAQACZgHMAQABZgGZAgABZgGZATMBAAFm
|
||||
AZkBZgEAAWYCmQEAAWYBmQHMAQABZgGZAf8BAAFmAcwCAAFmAcwBMwEAAWYBzAGZAQABZgLMAQABZgHM
|
||||
Af8BAAFmAf8CAAFmAf8BMwEAAWYB/wGZAQABZgH/AcwBAAHMAQAB/wEAAf8BAAHMAQACmQIAAZkBMwGZ
|
||||
AQABmQEAAZkBAAGZAQABzAEAAZkDAAGZAjMBAAGZAQABZgEAAZkBMwHMAQABmQEAAf8BAAGZAWYCAAGZ
|
||||
AWYBMwEAAZkBMwFmAQABmQFmAZkBAAGZAWYBzAEAAZkBMwH/AQACmQEzAQACmQFmAQADmQEAApkBzAEA
|
||||
ApkB/wEAAZkBzAIAAZkBzAEzAQABZgHMAWYBAAGZAcwBmQEAAZkCzAEAAZkBzAH/AQABmQH/AgABmQH/
|
||||
ATMBAAGZAcwBZgEAAZkB/wGZAQABmQH/AcwBAAGZAv8BAAHMAwABmQEAATMBAAHMAQABZgEAAcwBAAGZ
|
||||
AQABzAEAAcwBAAGZATMCAAHMAjMBAAHMATMBZgEAAcwBMwGZAQABzAEzAcwBAAHMATMB/wEAAcwBZgIA
|
||||
AcwBZgEzAQABmQJmAQABzAFmAZkBAAHMAWYBzAEAAZkBZgH/AQABzAGZAgABzAGZATMBAAHMAZkBZgEA
|
||||
AcwCmQEAAcwBmQHMAQABzAGZAf8BAALMAgACzAEzAQACzAFmAQACzAGZAQADzAEAAswB/wEAAcwB/wIA
|
||||
AcwB/wEzAQABmQH/AWYBAAHMAf8BmQEAAcwB/wHMAQABzAL/AQABzAEAATMBAAH/AQABZgEAAf8BAAGZ
|
||||
AQABzAEzAgAB/wIzAQAB/wEzAWYBAAH/ATMBmQEAAf8BMwHMAQAB/wEzAf8BAAH/AWYCAAH/AWYBMwEA
|
||||
AcwCZgEAAf8BZgGZAQAB/wFmAcwBAAHMAWYB/wEAAf8BmQIAAf8BmQEzAQAB/wGZAWYBAAH/ApkBAAH/
|
||||
AZkBzAEAAf8BmQH/AQAB/wHMAgAB/wHMATMBAAH/AcwBZgEAAf8BzAGZAQAB/wLMAQAB/wHMAf8BAAL/
|
||||
ATMBAAHMAf8BZgEAAv8BmQEAAv8BzAEAAmYB/wEAAWYB/wFmAQABZgL/AQAB/wJmAQAB/wFmAf8BAAL/
|
||||
AWYBAAEhAQABpQEAA18BAAN3AQADhgEAA5YBAAPLAQADsgEAA9cBAAPdAQAD4wEAA+oBAAPxAQAD+AEA
|
||||
AfAB+wH/AQABpAKgAQADgAMAAf8CAAH/AwAC/wEAAf8DAAH/AQAB/wEAAv8CAAP/AgAB8wEHDO8BvAH0
|
||||
Af8BAAHzAQcM7wG8AfQB/wEAAfMBBwzvAbwB9AH/EwACvAvxAfABvAEHAfQBAAK8C/EB8AG8AQcB9AEA
|
||||
ArwL8QHwAbwBBwH0EgABBwG8AfQM/wHzAbwB8AEHAbwB9Az/AfMBvAHwAQcBvAH0DP8B8wG8AfASAAHs
|
||||
AfAO/wHxAe8B7AHwA/8BwgKYAfQH/wHxAe8B7AHwDv8B8QHvEgABbQHxDv8B8QHvAW0B8QL/AcIBlwEz
|
||||
AVUBngf/AfEB7wFtAfEE/wHCA5gBngHCBP8B8QHvEgABbQHxDv8B8QHvAW0B8QH/AcIBVQMzAVUBCAH0
|
||||
Bf8B8QHvAW0B8QP/AfEBmASXAZ4BwgP/AfEB7xIAAW0B8Q7/AfEB7wFtAfABwgGXAjMCVQIzAQgF/wHx
|
||||
Ae8BbQHxAv8B8wGYAZcBCALCAQgBlwGeAcIC/wHxAe8SAAFtAfEO/wHxAe8BbQG8AZcCVQGYAfQBwgFV
|
||||
ATMBVQEIAfQD/wHxAe8BbQHxAv8BCAOYAlUBmAEIAZcBngL/AfEB7xIAAW0B8Q7/AfEB7wFtAfEB8AGY
|
||||
AQgD/wHxAzMBCAP/AfEB7wFtAfEC/wGYAZcBCAGXAjMBVQHCAZcBmAL/AfEB7xIAAW0B8Q7/AfEB7wFt
|
||||
AfEB/wHCAfQD/wH0AfEBVQEzAVUBngH0Af8B8QHvAW0B8QL/AZgBlwEIAZgBVQEzAVUBCAGXAZgC/wHx
|
||||
Ae8SAAFtAfEO/wHxAe8BbQHxCP8BwgFVATMBVQGYAf8B8QHvAW0B8QL/AQgBlwGYAfIBmAGXApgBlwEI
|
||||
Av8B8QHvEgABbQHxDv8B8QHvAW0B8Qn/AQgBVQEzAVUBngHxAe8BbQHxAv8B9AGYAZcBmAEIApgBlwGY
|
||||
AfMC/wHxAe8SAAFtAfEO/wHxAe8BbQHxCv8BwgFVATMBlwHxAe8BbQHxA/8BwgGYA5cCmAHCA/8B8QHv
|
||||
EgABbQHxDv8B8QHvAW0B8Qv/AQgBVQGXAfEB7wFtAfEE/wH0AQgCmAEIBf8B8QHvEgAB6wG8Dv8B8AHv
|
||||
AesBvAz/AcIBmAG8Ae8B6wG8Dv8BvAHvEgAB7wEHAfIL/wH0AfICBwHvAQcB8gv/AfQB8gEHAfAB7wEH
|
||||
AfIL/wH0AfIBBwHwEgAB9AG8AQcBvArxAfACBwHzAfQBvAEHAbwK8QHwAgcB8wH0AbwBBwG8CvEB8AIH
|
||||
AfMTAAH0Ae8C7AhtAewB7QEHAwAB9AHvAuwIbQHsAe0BBwMAAfQB7wLsCG0B7AHtAQcUAAFCAU0BPgcA
|
||||
AT4DAAEoAwABSAMAARIDAAEBAQABAQUAAdgXAAP/AQABgAEAASABAAEIBwABgAEAASABAAEIuwABgAEA
|
||||
AeABAAE4AQABDAUACw==
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
@ -1,23 +1,45 @@
|
|||
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 string Ip { 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, string ip)
|
||||
|
||||
|
||||
public CompId(string name, string description, IPAddress ip)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Description = description;
|
||||
|
|
@ -30,11 +52,65 @@ namespace Reseter2
|
|||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,12 +29,730 @@
|
|||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.bt_reset = new System.Windows.Forms.Button();
|
||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.ss_activ = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.ss_close = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.bt_resetAll = new System.Windows.Forms.Button();
|
||||
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
|
||||
this.imageList2 = new System.Windows.Forms.ImageList(this.components);
|
||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.lb_history = new System.Windows.Forms.ListBox();
|
||||
this.cm_history = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.sm_RebootItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.sm_SaveItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tabPage4 = new System.Windows.Forms.TabPage();
|
||||
this.button4 = new System.Windows.Forms.Button();
|
||||
this.tabPage5 = new System.Windows.Forms.TabPage();
|
||||
this.label20 = new System.Windows.Forms.Label();
|
||||
this.label19 = new System.Windows.Forms.Label();
|
||||
this.label18 = new System.Windows.Forms.Label();
|
||||
this.label17 = new System.Windows.Forms.Label();
|
||||
this.groupBox1 = 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.label7 = new System.Windows.Forms.Label();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.label16 = new System.Windows.Forms.Label();
|
||||
this.cm_words = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.WordsReboot = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tb_comp = new System.Windows.Forms.TextBox();
|
||||
this.checkControl1 = new Reseter2.CheckControl();
|
||||
this.treeView1 = new Reseter2.NewTreeView();
|
||||
this.settingRebootControl1 = new Reseter2.Setting.SettingRebootControl();
|
||||
this.settingSCCMControl1 = new Reseter2.Setting.SettingSCCMControl();
|
||||
this.settingWordsControl1 = new Reseter2.Setting.SettingWordsControl();
|
||||
this.WordsCopy = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
this.tabPage3.SuspendLayout();
|
||||
this.cm_history.SuspendLayout();
|
||||
this.tabPage4.SuspendLayout();
|
||||
this.tabPage5.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.cm_words.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(14, 15);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(47, 13);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "Имя ПК";
|
||||
//
|
||||
// bt_reset
|
||||
//
|
||||
this.bt_reset.BackColor = System.Drawing.Color.IndianRed;
|
||||
this.bt_reset.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.bt_reset.ForeColor = System.Drawing.SystemColors.Control;
|
||||
this.bt_reset.Location = new System.Drawing.Point(283, 10);
|
||||
this.bt_reset.Name = "bt_reset";
|
||||
this.bt_reset.Size = new System.Drawing.Size(122, 23);
|
||||
this.bt_reset.TabIndex = 2;
|
||||
this.bt_reset.Text = "Перезагрузить";
|
||||
this.bt_reset.UseVisualStyleBackColor = false;
|
||||
this.bt_reset.Click += new System.EventHandler(this.bt_reset_Click);
|
||||
//
|
||||
// timer1
|
||||
//
|
||||
this.timer1.Enabled = true;
|
||||
this.timer1.Interval = 1000;
|
||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||
//
|
||||
// tabControl1
|
||||
//
|
||||
this.tabControl1.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.tabControl1.Controls.Add(this.tabPage1);
|
||||
this.tabControl1.Controls.Add(this.tabPage2);
|
||||
this.tabControl1.Controls.Add(this.tabPage3);
|
||||
this.tabControl1.Controls.Add(this.tabPage4);
|
||||
this.tabControl1.Controls.Add(this.tabPage5);
|
||||
this.tabControl1.Location = new System.Drawing.Point(2, 38);
|
||||
this.tabControl1.Multiline = true;
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
this.tabControl1.Size = new System.Drawing.Size(410, 714);
|
||||
this.tabControl1.TabIndex = 4;
|
||||
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
this.tabPage1.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.tabPage1.Controls.Add(this.button2);
|
||||
this.tabPage1.Controls.Add(this.statusStrip1);
|
||||
this.tabPage1.Controls.Add(this.flowLayoutPanel1);
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(402, 688);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "Задания";
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(236, 665);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(165, 23);
|
||||
this.button2.TabIndex = 2;
|
||||
this.button2.Text = "Очистить все завершенные";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.ss_activ,
|
||||
this.ss_close,
|
||||
this.toolStripStatusLabel1});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(3, 663);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(396, 22);
|
||||
this.statusStrip1.TabIndex = 1;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
// ss_activ
|
||||
//
|
||||
this.ss_activ.Name = "ss_activ";
|
||||
this.ss_activ.Size = new System.Drawing.Size(61, 17);
|
||||
this.ss_activ.Text = "Активные";
|
||||
this.ss_activ.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
|
||||
//
|
||||
// ss_close
|
||||
//
|
||||
this.ss_close.Name = "ss_close";
|
||||
this.ss_close.Size = new System.Drawing.Size(85, 17);
|
||||
this.ss_close.Text = "Завершенные";
|
||||
this.ss_close.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
|
||||
//
|
||||
// toolStripStatusLabel1
|
||||
//
|
||||
this.toolStripStatusLabel1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
|
||||
this.toolStripStatusLabel1.Size = new System.Drawing.Size(0, 17);
|
||||
this.toolStripStatusLabel1.Text = "toolStripStatusLabel1";
|
||||
//
|
||||
// flowLayoutPanel1
|
||||
//
|
||||
this.flowLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.flowLayoutPanel1.AutoScroll = true;
|
||||
this.flowLayoutPanel1.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
|
||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(396, 657);
|
||||
this.flowLayoutPanel1.TabIndex = 0;
|
||||
this.flowLayoutPanel1.WrapContents = false;
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.Controls.Add(this.label2);
|
||||
this.tabPage2.Controls.Add(this.bt_resetAll);
|
||||
this.tabPage2.Controls.Add(this.checkControl1);
|
||||
this.tabPage2.Controls.Add(this.treeView1);
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage2.Size = new System.Drawing.Size(402, 688);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "Справочник";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(32, 10);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(80, 13);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "Все элементы";
|
||||
//
|
||||
// bt_resetAll
|
||||
//
|
||||
this.bt_resetAll.BackColor = System.Drawing.Color.IndianRed;
|
||||
this.bt_resetAll.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.bt_resetAll.ForeColor = System.Drawing.SystemColors.Control;
|
||||
this.bt_resetAll.Location = new System.Drawing.Point(224, 6);
|
||||
this.bt_resetAll.Name = "bt_resetAll";
|
||||
this.bt_resetAll.Size = new System.Drawing.Size(168, 23);
|
||||
this.bt_resetAll.TabIndex = 1;
|
||||
this.bt_resetAll.Text = "Перезагрузить выделенное";
|
||||
this.bt_resetAll.UseVisualStyleBackColor = false;
|
||||
this.bt_resetAll.Click += new System.EventHandler(this.bt_resetAll_Click);
|
||||
//
|
||||
// imageList1
|
||||
//
|
||||
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
|
||||
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
|
||||
this.imageList1.Images.SetKeyName(0, "11icon-24.png");
|
||||
this.imageList1.Images.SetKeyName(1, "16icon-24.png");
|
||||
this.imageList1.Images.SetKeyName(2, "12icon-24.png");
|
||||
this.imageList1.Images.SetKeyName(3, "13icon-24.png");
|
||||
this.imageList1.Images.SetKeyName(4, "14icon-24.png");
|
||||
this.imageList1.Images.SetKeyName(5, "15icon-24.png");
|
||||
this.imageList1.Images.SetKeyName(6, "17icon-24.png");
|
||||
this.imageList1.Images.SetKeyName(7, "17icon2-24.png");
|
||||
this.imageList1.Images.SetKeyName(8, "40icon-24.png");
|
||||
//
|
||||
// imageList2
|
||||
//
|
||||
this.imageList2.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList2.ImageStream")));
|
||||
this.imageList2.TransparentColor = System.Drawing.Color.Transparent;
|
||||
this.imageList2.Images.SetKeyName(0, "off.ico");
|
||||
this.imageList2.Images.SetKeyName(1, "on.ico");
|
||||
this.imageList2.Images.SetKeyName(2, "or.ico");
|
||||
//
|
||||
// tabPage3
|
||||
//
|
||||
this.tabPage3.Controls.Add(this.button1);
|
||||
this.tabPage3.Controls.Add(this.label6);
|
||||
this.tabPage3.Controls.Add(this.label5);
|
||||
this.tabPage3.Controls.Add(this.label4);
|
||||
this.tabPage3.Controls.Add(this.label3);
|
||||
this.tabPage3.Controls.Add(this.lb_history);
|
||||
this.tabPage3.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage3.Name = "tabPage3";
|
||||
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage3.Size = new System.Drawing.Size(402, 688);
|
||||
this.tabPage3.TabIndex = 2;
|
||||
this.tabPage3.Text = "История";
|
||||
this.tabPage3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(321, 661);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 6;
|
||||
this.button1.Text = "Очистить";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
|
||||
this.label6.Location = new System.Drawing.Point(327, 5);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(38, 13);
|
||||
this.label6.TabIndex = 5;
|
||||
this.label6.Text = "Конец";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Font = new System.Drawing.Font("Consolas", 8.25F);
|
||||
this.label5.Location = new System.Drawing.Point(269, 5);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(43, 13);
|
||||
this.label5.TabIndex = 4;
|
||||
this.label5.Text = "Статус";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Font = new System.Drawing.Font("Consolas", 8.25F);
|
||||
this.label4.Location = new System.Drawing.Point(112, 5);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(25, 13);
|
||||
this.label4.TabIndex = 3;
|
||||
this.label4.Text = "Имя";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Font = new System.Drawing.Font("Consolas", 8.25F);
|
||||
this.label3.Location = new System.Drawing.Point(3, 5);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(79, 13);
|
||||
this.label3.TabIndex = 2;
|
||||
this.label3.Text = "Время старта";
|
||||
//
|
||||
// lb_history
|
||||
//
|
||||
this.lb_history.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lb_history.ContextMenuStrip = this.cm_history;
|
||||
this.lb_history.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lb_history.FormattingEnabled = true;
|
||||
this.lb_history.Location = new System.Drawing.Point(3, 21);
|
||||
this.lb_history.Name = "lb_history";
|
||||
this.lb_history.Size = new System.Drawing.Size(396, 628);
|
||||
this.lb_history.TabIndex = 0;
|
||||
this.lb_history.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lb_history_MouseDown);
|
||||
this.lb_history.MouseLeave += new System.EventHandler(this.lb_history_MouseLeave);
|
||||
this.lb_history.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lb_history_MouseMove);
|
||||
//
|
||||
// cm_history
|
||||
//
|
||||
this.cm_history.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
||||
this.cm_history.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.sm_RebootItem,
|
||||
this.sm_SaveItem});
|
||||
this.cm_history.Name = "cm_history";
|
||||
this.cm_history.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
|
||||
this.cm_history.ShowImageMargin = false;
|
||||
this.cm_history.Size = new System.Drawing.Size(130, 48);
|
||||
this.cm_history.Closed += new System.Windows.Forms.ToolStripDropDownClosedEventHandler(this.cm_history_Closed);
|
||||
this.cm_history.Opening += new System.ComponentModel.CancelEventHandler(this.cm_history_Opening);
|
||||
//
|
||||
// sm_RebootItem
|
||||
//
|
||||
this.sm_RebootItem.Name = "sm_RebootItem";
|
||||
this.sm_RebootItem.Size = new System.Drawing.Size(129, 22);
|
||||
this.sm_RebootItem.Text = "Перезагрузить";
|
||||
this.sm_RebootItem.Click += new System.EventHandler(this.sm_RebootItem_Click);
|
||||
//
|
||||
// sm_SaveItem
|
||||
//
|
||||
this.sm_SaveItem.Name = "sm_SaveItem";
|
||||
this.sm_SaveItem.Size = new System.Drawing.Size(129, 22);
|
||||
this.sm_SaveItem.Text = "Сохранить";
|
||||
this.sm_SaveItem.Click += new System.EventHandler(this.sm_SaveItem_Click);
|
||||
//
|
||||
// tabPage4
|
||||
//
|
||||
this.tabPage4.Controls.Add(this.settingRebootControl1);
|
||||
this.tabPage4.Controls.Add(this.settingSCCMControl1);
|
||||
this.tabPage4.Controls.Add(this.settingWordsControl1);
|
||||
this.tabPage4.Controls.Add(this.button4);
|
||||
this.tabPage4.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage4.Name = "tabPage4";
|
||||
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage4.Size = new System.Drawing.Size(402, 688);
|
||||
this.tabPage4.TabIndex = 3;
|
||||
this.tabPage4.Text = "Настройки";
|
||||
this.tabPage4.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button4
|
||||
//
|
||||
this.button4.Location = new System.Drawing.Point(317, 435);
|
||||
this.button4.Name = "button4";
|
||||
this.button4.Size = new System.Drawing.Size(75, 23);
|
||||
this.button4.TabIndex = 4;
|
||||
this.button4.Text = "Сохранить";
|
||||
this.button4.UseVisualStyleBackColor = true;
|
||||
this.button4.Click += new System.EventHandler(this.button4_Click);
|
||||
//
|
||||
// tabPage5
|
||||
//
|
||||
this.tabPage5.Controls.Add(this.label20);
|
||||
this.tabPage5.Controls.Add(this.label19);
|
||||
this.tabPage5.Controls.Add(this.label18);
|
||||
this.tabPage5.Controls.Add(this.label17);
|
||||
this.tabPage5.Controls.Add(this.groupBox1);
|
||||
this.tabPage5.Controls.Add(this.pictureBox1);
|
||||
this.tabPage5.Controls.Add(this.label16);
|
||||
this.tabPage5.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage5.Name = "tabPage5";
|
||||
this.tabPage5.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage5.Size = new System.Drawing.Size(402, 688);
|
||||
this.tabPage5.TabIndex = 4;
|
||||
this.tabPage5.Text = "О программе";
|
||||
this.tabPage5.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label20
|
||||
//
|
||||
this.label20.AutoSize = true;
|
||||
this.label20.Location = new System.Drawing.Point(6, 640);
|
||||
this.label20.Name = "label20";
|
||||
this.label20.Size = new System.Drawing.Size(159, 39);
|
||||
this.label20.TabIndex = 6;
|
||||
this.label20.Text = "Цензура, идеи, тестирование \r\nИлюхин Георгий Николаевич \r\ngeorgii.iliukhin@gmail." +
|
||||
"com";
|
||||
//
|
||||
// label19
|
||||
//
|
||||
this.label19.AutoSize = true;
|
||||
this.label19.Location = new System.Drawing.Point(222, 640);
|
||||
this.label19.Name = "label19";
|
||||
this.label19.Size = new System.Drawing.Size(170, 39);
|
||||
this.label19.TabIndex = 5;
|
||||
this.label19.Text = "Разработка\r\nСимаков Владимир Михайлович\r\nklavirshik@yandex.ru";
|
||||
this.label19.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// label18
|
||||
//
|
||||
this.label18.AutoSize = true;
|
||||
this.label18.Location = new System.Drawing.Point(6, 221);
|
||||
this.label18.Name = "label18";
|
||||
this.label18.Size = new System.Drawing.Size(62, 13);
|
||||
this.label18.TabIndex = 4;
|
||||
this.label18.Text = "Версия 2.0";
|
||||
//
|
||||
// label17
|
||||
//
|
||||
this.label17.AutoSize = true;
|
||||
this.label17.Location = new System.Drawing.Point(6, 208);
|
||||
this.label17.Name = "label17";
|
||||
this.label17.Size = new System.Drawing.Size(325, 13);
|
||||
this.label17.TabIndex = 3;
|
||||
this.label17.Text = "Многопоточная перезагрузка рабочих станций на ОС Windows";
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.label15);
|
||||
this.groupBox1.Controls.Add(this.label14);
|
||||
this.groupBox1.Controls.Add(this.label13);
|
||||
this.groupBox1.Controls.Add(this.label7);
|
||||
this.groupBox1.Controls.Add(this.label9);
|
||||
this.groupBox1.Controls.Add(this.label8);
|
||||
this.groupBox1.Controls.Add(this.label12);
|
||||
this.groupBox1.Controls.Add(this.label10);
|
||||
this.groupBox1.Controls.Add(this.label11);
|
||||
this.groupBox1.Location = new System.Drawing.Point(6, 496);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(386, 141);
|
||||
this.groupBox1.TabIndex = 2;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Расшифровка статусов истории";
|
||||
this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter);
|
||||
//
|
||||
// label15
|
||||
//
|
||||
this.label15.AutoSize = true;
|
||||
this.label15.Location = new System.Drawing.Point(3, 16);
|
||||
this.label15.Name = "label15";
|
||||
this.label15.Size = new System.Drawing.Size(237, 13);
|
||||
this.label15.TabIndex = 8;
|
||||
this.label15.Text = "Check Net - Проверка связи с удаленным ПК";
|
||||
//
|
||||
// label14
|
||||
//
|
||||
this.label14.AutoSize = true;
|
||||
this.label14.Location = new System.Drawing.Point(3, 81);
|
||||
this.label14.Name = "label14";
|
||||
this.label14.Size = new System.Drawing.Size(202, 13);
|
||||
this.label14.TabIndex = 7;
|
||||
this.label14.Text = "Error NET- нету связи с удаленным ПК";
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(3, 55);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(233, 13);
|
||||
this.label13.TabIndex = 6;
|
||||
this.label13.Text = "Succes - перезагрузка завершенна успешно";
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(3, 120);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(198, 13);
|
||||
this.label7.TabIndex = 0;
|
||||
this.label7.Text = "Canceled - отмененно пользователем";
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(3, 107);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(329, 13);
|
||||
this.label9.TabIndex = 2;
|
||||
this.label9.Text = "Error RST - ПК не начал перезагрузку после отправки команды";
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(3, 29);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(334, 13);
|
||||
this.label8.TabIndex = 1;
|
||||
this.label8.Text = "Send RST - отправление команды перезагрузки удаленному ПК";
|
||||
//
|
||||
// label12
|
||||
//
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(3, 42);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(233, 13);
|
||||
this.label12.TabIndex = 5;
|
||||
this.label12.Text = "Rebooting - удаленный пк перезагружаеться";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(3, 94);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(277, 13);
|
||||
this.label10.TabIndex = 3;
|
||||
this.label10.Text = "Error UP - ПК не вышел на связь после перезагрузки";
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(3, 68);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(191, 13);
|
||||
this.label11.TabIndex = 4;
|
||||
this.label11.Text = "Stop - остановленно пользователем";
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
|
||||
this.pictureBox1.Location = new System.Drawing.Point(153, 44);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(96, 96);
|
||||
this.pictureBox1.TabIndex = 1;
|
||||
this.pictureBox1.TabStop = false;
|
||||
//
|
||||
// label16
|
||||
//
|
||||
this.label16.AutoSize = true;
|
||||
this.label16.Location = new System.Drawing.Point(6, 195);
|
||||
this.label16.Name = "label16";
|
||||
this.label16.Size = new System.Drawing.Size(50, 13);
|
||||
this.label16.TabIndex = 0;
|
||||
this.label16.Text = "Reseter2";
|
||||
//
|
||||
// cm_words
|
||||
//
|
||||
this.cm_words.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.WordsReboot,
|
||||
this.WordsCopy});
|
||||
this.cm_words.Name = "cm_words";
|
||||
this.cm_words.ShowImageMargin = false;
|
||||
this.cm_words.Size = new System.Drawing.Size(169, 70);
|
||||
//
|
||||
// WordsReboot
|
||||
//
|
||||
this.WordsReboot.Name = "WordsReboot";
|
||||
this.WordsReboot.Size = new System.Drawing.Size(168, 22);
|
||||
this.WordsReboot.Text = "Перезарузить";
|
||||
this.WordsReboot.Click += new System.EventHandler(this.WordsReboot_Click);
|
||||
//
|
||||
// tb_comp
|
||||
//
|
||||
this.tb_comp.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.tb_comp.Location = new System.Drawing.Point(67, 11);
|
||||
this.tb_comp.Name = "tb_comp";
|
||||
this.tb_comp.Size = new System.Drawing.Size(210, 20);
|
||||
this.tb_comp.TabIndex = 5;
|
||||
this.tb_comp.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tb_comp_MouseClick);
|
||||
this.tb_comp.TextChanged += new System.EventHandler(this.cb_comp_TextUpdate);
|
||||
this.tb_comp.Enter += new System.EventHandler(this.tb_comp_Enter);
|
||||
this.tb_comp.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tb_comp_KeyDown);
|
||||
//
|
||||
// checkControl1
|
||||
//
|
||||
this.checkControl1.Location = new System.Drawing.Point(14, 7);
|
||||
this.checkControl1.Name = "checkControl1";
|
||||
this.checkControl1.Size = new System.Drawing.Size(18, 18);
|
||||
this.checkControl1.TabIndex = 2;
|
||||
//
|
||||
// treeView1
|
||||
//
|
||||
this.treeView1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.treeView1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
|
||||
this.treeView1.HideSelection = false;
|
||||
this.treeView1.ImageIndex = 0;
|
||||
this.treeView1.ImageList = this.imageList1;
|
||||
this.treeView1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.treeView1.Indent = 27;
|
||||
this.treeView1.ItemHeight = 24;
|
||||
this.treeView1.Location = new System.Drawing.Point(3, 32);
|
||||
this.treeView1.Name = "treeView1";
|
||||
this.treeView1.SelectedImageIndex = 0;
|
||||
this.treeView1.ShowLines = false;
|
||||
this.treeView1.ShowNodeToolTips = true;
|
||||
this.treeView1.Size = new System.Drawing.Size(396, 653);
|
||||
this.treeView1.StateImageList = this.imageList2;
|
||||
this.treeView1.TabIndex = 0;
|
||||
this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterCheck);
|
||||
this.treeView1.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseClick);
|
||||
this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick);
|
||||
//
|
||||
// settingRebootControl1
|
||||
//
|
||||
this.settingRebootControl1.Location = new System.Drawing.Point(6, 299);
|
||||
this.settingRebootControl1.Name = "settingRebootControl1";
|
||||
this.settingRebootControl1.Size = new System.Drawing.Size(391, 130);
|
||||
this.settingRebootControl1.TabIndex = 7;
|
||||
//
|
||||
// settingSCCMControl1
|
||||
//
|
||||
this.settingSCCMControl1.Location = new System.Drawing.Point(6, 115);
|
||||
this.settingSCCMControl1.Name = "settingSCCMControl1";
|
||||
this.settingSCCMControl1.Size = new System.Drawing.Size(391, 178);
|
||||
this.settingSCCMControl1.TabIndex = 6;
|
||||
//
|
||||
// settingWordsControl1
|
||||
//
|
||||
this.settingWordsControl1.Location = new System.Drawing.Point(6, 6);
|
||||
this.settingWordsControl1.Name = "settingWordsControl1";
|
||||
this.settingWordsControl1.Size = new System.Drawing.Size(391, 103);
|
||||
this.settingWordsControl1.TabIndex = 5;
|
||||
//
|
||||
// WordsCopy
|
||||
//
|
||||
this.WordsCopy.Name = "WordsCopy";
|
||||
this.WordsCopy.Size = new System.Drawing.Size(168, 22);
|
||||
this.WordsCopy.Text = "Скопировать в буфер";
|
||||
this.WordsCopy.Click += new System.EventHandler(this.WordsCopy_Click);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.ClientSize = new System.Drawing.Size(410, 753);
|
||||
this.Controls.Add(this.tb_comp);
|
||||
this.Controls.Add(this.tabControl1);
|
||||
this.Controls.Add(this.bt_reset);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "Form1";
|
||||
this.Text = "Reseter2";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.tabPage1.PerformLayout();
|
||||
this.statusStrip1.ResumeLayout(false);
|
||||
this.statusStrip1.PerformLayout();
|
||||
this.tabPage2.ResumeLayout(false);
|
||||
this.tabPage2.PerformLayout();
|
||||
this.tabPage3.ResumeLayout(false);
|
||||
this.tabPage3.PerformLayout();
|
||||
this.cm_history.ResumeLayout(false);
|
||||
this.tabPage4.ResumeLayout(false);
|
||||
this.tabPage5.ResumeLayout(false);
|
||||
this.tabPage5.PerformLayout();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
this.cm_words.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button bt_reset;
|
||||
private System.Windows.Forms.Timer timer1;
|
||||
private System.Windows.Forms.TabControl tabControl1;
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private System.Windows.Forms.TabPage tabPage2;
|
||||
private System.Windows.Forms.TabPage tabPage3;
|
||||
private System.Windows.Forms.TabPage tabPage4;
|
||||
private System.Windows.Forms.ListBox lb_history;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||
private System.Windows.Forms.ContextMenuStrip cm_history;
|
||||
private System.Windows.Forms.ToolStripMenuItem sm_RebootItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem sm_SaveItem;
|
||||
private System.Windows.Forms.Button bt_resetAll;
|
||||
public System.Windows.Forms.ImageList imageList1;
|
||||
private System.Windows.Forms.ImageList imageList2;
|
||||
private NewTreeView treeView1;
|
||||
private CheckControl checkControl1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TabPage tabPage5;
|
||||
private System.Windows.Forms.Button button4;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.Label label16;
|
||||
private Setting.SettingWordsControl settingWordsControl1;
|
||||
private Setting.SettingRebootControl settingRebootControl1;
|
||||
private Setting.SettingSCCMControl settingSCCMControl1;
|
||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||
private System.Windows.Forms.ToolStripStatusLabel ss_activ;
|
||||
private System.Windows.Forms.ToolStripStatusLabel ss_close;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.ContextMenuStrip cm_words;
|
||||
private System.Windows.Forms.ToolStripMenuItem WordsReboot;
|
||||
private System.Windows.Forms.TextBox tb_comp;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.Label label11;
|
||||
private System.Windows.Forms.Label label12;
|
||||
private System.Windows.Forms.Label label13;
|
||||
private System.Windows.Forms.Label label15;
|
||||
private System.Windows.Forms.Label label14;
|
||||
private System.Windows.Forms.Label label18;
|
||||
private System.Windows.Forms.Label label17;
|
||||
private System.Windows.Forms.Label label19;
|
||||
private System.Windows.Forms.Label label20;
|
||||
private System.Windows.Forms.ToolStripMenuItem WordsCopy;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,707 @@
|
|||
using System;
|
||||
using Reseter2.History;
|
||||
using Reseter2.Seacher;
|
||||
using Reseter2.Setting;
|
||||
using Reseter2.Words;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace Reseter2
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
//private FormHistory formHistory;
|
||||
//System.Windows.Forms.CheckBox
|
||||
private bool unSave;
|
||||
private bool FocusContext;
|
||||
private object selectItem;
|
||||
public delegate void saveSetting();
|
||||
public event saveSetting Save;
|
||||
public delegate void updateSetting();
|
||||
public event updateSetting UpdateSetting;
|
||||
private ListBox ListComp;
|
||||
private IComp CompSelected = null;
|
||||
private int PreSelected = -1;
|
||||
private bool StopRefreshSeacher = false;
|
||||
public Form1()
|
||||
{
|
||||
|
||||
|
||||
SGlobalSetting.LoadSetting();
|
||||
|
||||
WordsList.MainCategory = SGlobalSetting.LoadWords();
|
||||
ListComp = new ListBox();
|
||||
this.Controls.Add(ListComp);
|
||||
ListComp.GotFocus += tb_comp_Enter;
|
||||
ListComp.DrawMode = DrawMode.OwnerDrawFixed;
|
||||
ListComp.DrawItem += ListComp_DrawItem;
|
||||
ListComp.KeyDown += tb_comp_KeyDown;
|
||||
|
||||
//ListComp.SetSelected(1,true);
|
||||
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
||||
InitializeComponent();
|
||||
this.Save += settingWordsControl1.Save;
|
||||
this.Save += settingSCCMControl1.Save;
|
||||
this.Save += settingRebootControl1.Save;
|
||||
|
||||
this.UpdateSetting += settingWordsControl1.UpdateSetting;
|
||||
this.UpdateSetting += settingSCCMControl1.UpdateSetting;
|
||||
this.UpdateSetting += settingRebootControl1.UpdateSetting;
|
||||
this.settingWordsControl1.UpdateTree = UpdateTree;
|
||||
|
||||
|
||||
ListComp.SelectionMode = SelectionMode.One;
|
||||
ListComp.Location = new Point(tb_comp.Location.X, tb_comp.Location.Y + tb_comp.Height);
|
||||
ListComp.Width = tb_comp.Width;
|
||||
ListComp.Visible = false;
|
||||
ListComp.ItemHeight = 14;
|
||||
ListComp.Height = ListComp.ItemHeight * 2;
|
||||
ListComp.Items.Add("Введите запрос");
|
||||
ListComp.SelectedIndexChanged += ListComp_ChangeIndex;
|
||||
ListComp.Enabled = false;
|
||||
|
||||
//tb_comp.Controls.Add(ListComp);
|
||||
|
||||
|
||||
checkControl1.updateCheck += CheckControl1_updateCheck;
|
||||
flowLayoutPanel1.AutoScrollMinSize = new Size(0, 658);
|
||||
flowLayoutPanel1.VerticalScroll.Visible = true;
|
||||
Reseter.SetForm(flowLayoutPanel1, this);
|
||||
HistoryList.Update += Update_lb;
|
||||
lb_history.DataSource = HistoryList.Hitem;
|
||||
lb_history.DisplayMember = "ToStr";
|
||||
treeView1.PathSeparator = "/";
|
||||
|
||||
treeView1.Nodes.AddRange(WordsList.ListNodes());
|
||||
SGlobalSetting.settingExpand.ExpendAll(treeView1.Nodes);
|
||||
//treeView1.SelectedNode.
|
||||
//treeView1.MouseCaptureChanged.;
|
||||
tabControl1.SelectedIndex = 1;
|
||||
}
|
||||
|
||||
public void UpdateTree()
|
||||
{
|
||||
treeView1.Nodes.Clear();
|
||||
treeView1.Nodes.AddRange(WordsList.ListNodes());
|
||||
checkControl1.set_state(false);
|
||||
}
|
||||
|
||||
private void bt_reset_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (CompSelected == null)
|
||||
{
|
||||
if (tb_comp.Text.Length > 0)
|
||||
{
|
||||
DialogResult result = MessageBox.Show("Перезагрузить ПК: " + tb_comp.Text.Trim(), "Создание новой задачи", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
Reseter.AddTask(tb_comp.Text.Trim());
|
||||
tabControl1.SelectedIndex = 0;
|
||||
ListComp.SelectedIndex = -1;
|
||||
StopRefreshSeacher = true;
|
||||
tb_comp.Text = "";
|
||||
ListComp.Items.Clear();
|
||||
ListComp.Items.Add("Введите запрос");
|
||||
ListComp.Enabled = false;
|
||||
ListComp.ItemHeight = 14;
|
||||
ListComp.Height = ListComp.ItemHeight * 2;
|
||||
StopRefreshSeacher = false;
|
||||
ListComp.Visible = false;
|
||||
tabControl1.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Введите имя ПК","Ошибка перезагрузки",MessageBoxButtons.OK,MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogResult result = MessageBox.Show("Перезагрузить ПК: " + CompSelected.GetNetNameStr(), "Создание новой задачи", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
Reseter.AddTask(CompSelected);
|
||||
tabControl1.SelectedIndex = 0;
|
||||
ListComp.SelectedIndex = -1;
|
||||
StopRefreshSeacher = true;
|
||||
tb_comp.Text = "";
|
||||
ListComp.Items.Clear();
|
||||
ListComp.Items.Add("Введите запрос");
|
||||
ListComp.ItemHeight = 14;
|
||||
ListComp.Enabled = false;
|
||||
ListComp.Height = ListComp.ItemHeight * 2;
|
||||
StopRefreshSeacher = false;
|
||||
ListComp.Visible = false;
|
||||
tabControl1.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void timer1_Tick(object sender, EventArgs e)
|
||||
{
|
||||
int Act;
|
||||
int Cls;
|
||||
Reseter.Tick(out Act, out Cls);
|
||||
if (Act > 0)
|
||||
{
|
||||
ss_activ.Text = "Активно:" + Act;
|
||||
}
|
||||
else
|
||||
{
|
||||
ss_activ.Text = "";
|
||||
}
|
||||
if (Cls > 0)
|
||||
{
|
||||
ss_close.Text = "Завершено:" + Cls;
|
||||
}
|
||||
else
|
||||
{
|
||||
ss_close.Text = "";
|
||||
}
|
||||
}
|
||||
public void Update_lb()
|
||||
{
|
||||
lb_history.DataSource = null;
|
||||
lb_history.DataSource = HistoryList.Hitem;
|
||||
lb_history.DisplayMember = "ToStr";
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
HistoryList.Clear();
|
||||
lb_history.DataSource = null;
|
||||
lb_history.DataSource = HistoryList.Hitem;
|
||||
lb_history.DisplayMember = "ToStr";
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void sm_RebootItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (selectItem is HistoryItem historyItem)
|
||||
{
|
||||
DialogResult result = MessageBox.Show("Перезагрузить ПК: " + historyItem.GetComp().GetNetNameStr(), "Создание новой задачи", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
Reseter.AddTask(historyItem.GetComp());
|
||||
tabControl1.SelectedIndex = 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void lb_history_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
lb_history.SelectedIndex = lb_history.IndexFromPoint(e.Location);
|
||||
}
|
||||
|
||||
private void lb_history_MouseLeave(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (!FocusContext)
|
||||
{
|
||||
lb_history.SelectedIndex = -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void cm_history_Opening(object sender, CancelEventArgs e)
|
||||
{
|
||||
selectItem = lb_history.SelectedItem;
|
||||
FocusContext = true;
|
||||
}
|
||||
|
||||
private void lb_history_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
// lb_history.SelectedIndex = lb_history.IndexFromPoint(e.Location);
|
||||
}
|
||||
|
||||
private void cm_history_Closed(object sender, ToolStripDropDownClosedEventArgs e)
|
||||
{
|
||||
// selectItem = null;
|
||||
FocusContext = false;
|
||||
}
|
||||
|
||||
private void mi_newitem_Click(object sender, EventArgs e)
|
||||
{
|
||||
BilderWords bilderWords = new BilderWords();
|
||||
bilderWords.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
SGlobalSetting.settingExpand.SaveExpand(treeView1.Nodes);
|
||||
SGlobalSetting.SaveSettig();
|
||||
}
|
||||
|
||||
private void treeView1_AfterCheck(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
|
||||
|
||||
// treeView1_treeViewChangeCheckBox(e.Node);
|
||||
|
||||
}
|
||||
|
||||
private void treeView1_treeViewChangeCheckBox(TreeNode treeNode)
|
||||
{
|
||||
for (int i = 0; i < treeNode.Nodes.Count; i++)
|
||||
{
|
||||
treeNode.Nodes[i].Checked = treeNode.Checked;
|
||||
if (treeNode.Nodes[i].Checked)
|
||||
{
|
||||
treeNode.Nodes[i].StateImageIndex = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
treeNode.Nodes[i].StateImageIndex = 0;
|
||||
}
|
||||
treeView1_treeViewChangeCheckBox(treeNode.Nodes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private int treeView1_treeViewChangeRootCheckBox(TreeNode treeNode)
|
||||
{
|
||||
if (treeNode.Nodes.Count == 0)
|
||||
{
|
||||
if (treeNode.Checked)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool nedoCheked = false;
|
||||
int nodeCheked = 0;
|
||||
for (int i = 0; i < treeNode.Nodes.Count; i++)
|
||||
{
|
||||
if (treeView1_treeViewChangeRootCheckBox(treeNode.Nodes[i]) == 2) nedoCheked = true;
|
||||
if (treeNode.Nodes[i].StateImageIndex == 1) nodeCheked++;
|
||||
//treeNo
|
||||
|
||||
}
|
||||
int Cheked = 0;
|
||||
|
||||
if (treeNode.Nodes.Count == nodeCheked)
|
||||
{
|
||||
Cheked = 1;
|
||||
treeNode.Checked = true;
|
||||
treeNode.StateImageIndex = 1;
|
||||
}
|
||||
else if (nodeCheked == 0)
|
||||
{
|
||||
Cheked = 0;
|
||||
treeNode.Checked = false;
|
||||
treeNode.StateImageIndex = 0;
|
||||
}
|
||||
if ((nodeCheked > 0 && treeNode.Nodes.Count > nodeCheked) || nedoCheked)
|
||||
{
|
||||
treeNode.Checked = false;
|
||||
treeNode.StateImageIndex = 2;
|
||||
Cheked = 2;
|
||||
}
|
||||
|
||||
|
||||
return Cheked;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void treeView1_ChangePrentRootCheckBox(TreeNode treeNode)
|
||||
{
|
||||
|
||||
if (treeNode.Parent != null)
|
||||
{
|
||||
//treeView1_treeViewChangeRootCheckBox(treeNode.Parent);
|
||||
treeView1_ChangePrentRootCheckBox(treeNode.Parent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
|
||||
{
|
||||
|
||||
if (e.Button == MouseButtons.Left && e.Node.Tag is WordsComp)
|
||||
{
|
||||
WordsComp wordsComp = (WordsComp)e.Node.Tag;
|
||||
|
||||
DialogResult result = MessageBox.Show("Перезагрузить ПК: " + wordsComp.NameNode(), "Создание новой задачи", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
Reseter.AddTask(wordsComp.GetComp());
|
||||
tabControl1.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
|
||||
{
|
||||
|
||||
TreeView tree = (TreeView)sender;
|
||||
|
||||
Rectangle BoundsNode = new(e.Node.Bounds.X - 43, e.Node.Bounds.Y, e.Node.Bounds.Width + 43, e.Node.Bounds.Height);
|
||||
if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
if (BoundsNode.Contains(e.Location) && e.Node.Tag is WordsComp)
|
||||
{
|
||||
tree.SelectedNode = e.Node;
|
||||
cm_words.Show(tree.PointToScreen(e.Location));
|
||||
}
|
||||
else
|
||||
{
|
||||
tree.SelectedNode = null;
|
||||
}
|
||||
|
||||
}
|
||||
//tree.BeginUpdate();
|
||||
Rectangle BoundsIcon = new(e.Node.Bounds.X - 43, e.Node.Bounds.Y + 2, 17, 18);
|
||||
if (e.Button == MouseButtons.Left && BoundsIcon.Contains(e.Location))
|
||||
{
|
||||
e.Node.Checked = !e.Node.Checked;
|
||||
if (e.Node.Checked)
|
||||
{
|
||||
e.Node.StateImageIndex = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Node.StateImageIndex = 0;
|
||||
}
|
||||
treeView1_treeViewChangeCheckBox(e.Node);
|
||||
treeView1_ChangePrentRootCheckBox(e.Node);
|
||||
CheckControl1_interdmet();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for (int i = 0; i < tree.Nodes.Count; i++)
|
||||
// {
|
||||
// treeView1_treeViewChangeRootCheckBox(tree.Nodes[i]);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
private List<IComp> treeViewCheckOn(TreeNode node)
|
||||
{
|
||||
List<IComp> comps = new List<IComp>();
|
||||
if (node.Checked && node.Tag is WordsComp)
|
||||
{
|
||||
WordsComp comp = (WordsComp)node.Tag;
|
||||
comps.Add(comp.GetComp());
|
||||
}
|
||||
for (int i = 0; i < node.Nodes.Count; i++)
|
||||
{
|
||||
comps.AddRange(treeViewCheckOn(node.Nodes[i]));
|
||||
|
||||
}
|
||||
return comps;
|
||||
}
|
||||
|
||||
private void bt_resetAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<IComp> comps = new List<IComp>();
|
||||
for (int i = 0; i < treeView1.Nodes.Count; i++)
|
||||
{
|
||||
comps.AddRange(treeViewCheckOn(treeView1.Nodes[i]));
|
||||
}
|
||||
if (comps.Count == 0)
|
||||
{
|
||||
MessageBox.Show("Не выбранно ни одного ПК");
|
||||
return;
|
||||
}
|
||||
DialogResult result = MessageBox.Show("Будет перезагруженно " + comps.Count() + " компьютеров.\nПродолжить?",
|
||||
"Запуск многопоточной перезагрузки.", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
Reseter.AddTask(comps);
|
||||
checkControl1.set_state(false);
|
||||
CheckControl1_updateCheck(false);
|
||||
tabControl1.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void sm_SaveItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
if (selectItem is HistoryItem historyItem)
|
||||
{
|
||||
BilderWords bilderWords = new BilderWords(historyItem.GetComp());
|
||||
DialogResult result = bilderWords.ShowDialog();
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
UpdateTree();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void CheckControl1_updateCheck(bool Сhecked)
|
||||
{
|
||||
for (int i = 0; i < treeView1.Nodes.Count; i++)
|
||||
{
|
||||
treeView1.Nodes[i].Checked = Сhecked;
|
||||
treeView1_treeViewChangeCheckBox(treeView1.Nodes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckControl1_interdmet()
|
||||
{
|
||||
int chek_inter = 0;
|
||||
|
||||
int summ = 0;
|
||||
for (int i = 0; i < treeView1.Nodes.Count; i++)
|
||||
{
|
||||
int check = treeView1_treeViewChangeRootCheckBox(treeView1.Nodes[i]);
|
||||
if (2 == check) chek_inter++;
|
||||
if (1 == check) summ++;
|
||||
}
|
||||
|
||||
if (treeView1.Nodes.Count == summ)
|
||||
{
|
||||
checkControl1.set_state(true);
|
||||
}
|
||||
else if (0 == summ)
|
||||
{
|
||||
checkControl1.set_state(false);
|
||||
}
|
||||
if ((summ < treeView1.Nodes.Count && summ > 0) || chek_inter > 0)
|
||||
{
|
||||
checkControl1.set_intedmet();
|
||||
}
|
||||
}
|
||||
|
||||
private void button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
Save();
|
||||
SGlobalSetting.settingExpand.SaveExpand(treeView1.Nodes);
|
||||
SGlobalSetting.SaveSettig();
|
||||
SGlobalSetting.LoadSetting();
|
||||
WordsList.MainCategory = SGlobalSetting.LoadWords();
|
||||
UpdateTree();
|
||||
SGlobalSetting.settingExpand.ExpendAll(treeView1.Nodes);
|
||||
}
|
||||
|
||||
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (tabControl1.SelectedIndex == 3)
|
||||
{
|
||||
if (!unSave)
|
||||
{
|
||||
unSave = true;
|
||||
UpdateSetting();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (unSave && (settingRebootControl1.edited() ||
|
||||
settingSCCMControl1.edited() ||
|
||||
settingWordsControl1.edited()))
|
||||
{
|
||||
DialogResult result = MessageBox.Show("Изменения не сохраненны. Продолжить?", "Изменения не сохраненны.", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
||||
switch (result)
|
||||
{
|
||||
case DialogResult.Cancel:
|
||||
tabControl1.SelectedIndex = 3;
|
||||
break;
|
||||
case DialogResult.OK:
|
||||
unSave = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
Reseter.ClearCanceled();
|
||||
}
|
||||
|
||||
private void WordsReboot_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (treeView1.SelectedNode.Tag is WordsComp)
|
||||
{
|
||||
WordsComp wordsComp = (WordsComp)treeView1.SelectedNode.Tag;
|
||||
|
||||
DialogResult result = MessageBox.Show("Перезагрузить ПК: " + wordsComp.NameNode(), "Создание новой задачи", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
Reseter.AddTask(wordsComp.GetComp());
|
||||
tabControl1.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void cb_comp_TextUpdate(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
//Cursor.Current = Cursors.Default;
|
||||
if (sender is TextBox && !StopRefreshSeacher)
|
||||
{
|
||||
TextBox textBox = (TextBox)sender;
|
||||
SSeaher.seaherMetod.Change(cb_comp_ResultUpdate, textBox.Text);
|
||||
CompSelected = null;
|
||||
ListComp.Visible = true;
|
||||
}
|
||||
|
||||
}
|
||||
public void cb_comp_ResultUpdate(List<string> Items, bool enable, int itemHeight)
|
||||
{
|
||||
PreSelected = -1;
|
||||
ListComp.ItemHeight = itemHeight;
|
||||
ListComp.Height = ListComp.ItemHeight * (Items.Count+1) ;
|
||||
ListComp.Items.Clear();
|
||||
ListComp.Items.AddRange(Items.ToArray());
|
||||
ListComp.Enabled = enable;
|
||||
|
||||
// ListComp.Visible = true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void tb_comp_Enter(object sender, EventArgs e)
|
||||
{
|
||||
// ListComp.Visible = true;
|
||||
}
|
||||
|
||||
private void tb_comp_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
ListComp.Visible = true;
|
||||
}
|
||||
|
||||
|
||||
private void ListComp_ChangeIndex(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void ListComp_DrawItem(object sender, DrawItemEventArgs e)
|
||||
{
|
||||
|
||||
if (e.Index != -1) {
|
||||
Point BoundNew = new(e.Bounds.Location.X, e.Bounds.Y + 1);
|
||||
if (e.Index == PreSelected)
|
||||
{
|
||||
e.Graphics.FillRectangle(Brushes.LightGray, e.Bounds);
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Graphics.FillRectangle(Brushes.White, e.Bounds);
|
||||
}
|
||||
|
||||
//if(MouseButtons == MouseButtons.Left && e.Bounds.Contains(ListComp.PointToClient(MousePosition)))
|
||||
if(e.Index == ListComp.SelectedIndex)
|
||||
{
|
||||
e.Graphics.FillRectangle(Brushes.DodgerBlue, e.Bounds);
|
||||
e.Graphics.DrawString(ListComp.Items[e.Index].ToString(), e.Font, Brushes.White, BoundNew);
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Graphics.DrawString(ListComp.Items[e.Index].ToString(), e.Font, Brushes.Black, BoundNew);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
if ((m.Msg == 0x210 && m.WParam.ToInt32() == 513) || m.Msg == 0x201)
|
||||
{
|
||||
Point clickPoint = this.PointToClient(Cursor.Position);
|
||||
if (!ListComp.Bounds.Contains(clickPoint))
|
||||
{
|
||||
ListComp.Visible = false;
|
||||
}
|
||||
// System.Console.WriteLine("clickers");
|
||||
|
||||
}
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
|
||||
private void tb_comp_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
|
||||
switch (e.KeyValue)
|
||||
{
|
||||
case 40:
|
||||
if(PreSelected < ListComp.Items.Count - 1)
|
||||
{
|
||||
++PreSelected;
|
||||
}
|
||||
e.SuppressKeyPress = true;
|
||||
ListComp.Refresh();
|
||||
break;
|
||||
case 38:
|
||||
if (PreSelected > 0)
|
||||
{
|
||||
--PreSelected;
|
||||
}
|
||||
|
||||
e.SuppressKeyPress = true;
|
||||
ListComp.Refresh();
|
||||
break;
|
||||
case 13:
|
||||
if(PreSelected == ListComp.SelectedIndex)
|
||||
{
|
||||
bt_reset_Click(null, null);
|
||||
break;
|
||||
}
|
||||
if (PreSelected >= 0)
|
||||
{
|
||||
ListComp.SelectedIndex = PreSelected;
|
||||
e.SuppressKeyPress = true;
|
||||
ListComp.Refresh();
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void groupBox1_Enter(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void WordsCopy_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (treeView1.SelectedNode.Tag is WordsComp)
|
||||
{
|
||||
WordsComp wordsComp = (WordsComp)treeView1.SelectedNode.Tag;
|
||||
|
||||
Clipboard.SetText(wordsComp.GetNetName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,89 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
|
||||
namespace Reseter2.History
|
||||
{
|
||||
|
||||
[Serializable]
|
||||
internal class HistoryItem
|
||||
{
|
||||
private IComp comp;
|
||||
[NonSerialized]
|
||||
private ReseterTask task;
|
||||
[NonSerialized]
|
||||
private AStatusTask statusTask;
|
||||
private DateTime startTime;
|
||||
private string statusName;
|
||||
private DateTime endTime;
|
||||
public HistoryItem(IComp comp, AStatusTask statusTask, DateTime startTime)
|
||||
{
|
||||
this.comp = comp;
|
||||
this.statusTask = statusTask;
|
||||
this.startTime = startTime;
|
||||
}
|
||||
public HistoryItem(ReseterTask task)
|
||||
{
|
||||
this.comp = task.Comp;
|
||||
this.task = task;
|
||||
this.statusTask = task.StatusTask;
|
||||
this.startTime = task.StartTime;
|
||||
}
|
||||
public SHistory GetData()
|
||||
{
|
||||
return new SHistory(comp.GetName(), startTime.ToShortTimeString(), statusTask.GetName());
|
||||
|
||||
}
|
||||
|
||||
public IComp GetComp()
|
||||
{
|
||||
return comp;
|
||||
|
||||
}
|
||||
|
||||
public void SetEndTime(DateTime endTime)
|
||||
{
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public void ClearTask()
|
||||
{
|
||||
this.task = null;
|
||||
this.statusTask = null;
|
||||
}
|
||||
|
||||
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 string ToStr
|
||||
{
|
||||
|
||||
get {
|
||||
if (this.task != null)
|
||||
{
|
||||
this.statusTask = this.task.StatusTask;
|
||||
this.statusName = this.statusTask.GetName();
|
||||
}
|
||||
string name = NameNode();
|
||||
name = name.Length > 25 ? name.Substring(0,25): name;
|
||||
string output = string.Format("{0,17:dd.MM.yy HH:mm:ss} {1,-25} {2,-9} {3,8:HH:mm:ss}", startTime, name, this.statusName, endTime);
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
using Reseter2.Setting;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Reseter2.History
|
||||
{
|
||||
[Serializable]
|
||||
internal static class HistoryList
|
||||
{
|
||||
static public List<HistoryItem> Hitem = new List<HistoryItem>();
|
||||
//static private FormHistory formHistory;
|
||||
|
||||
public delegate void UpdateMethod();
|
||||
static public event UpdateMethod Update;
|
||||
static public HistoryItem Add(ReseterTask reseterTask)
|
||||
{
|
||||
|
||||
HistoryItem historyItem = new HistoryItem(reseterTask);
|
||||
Hitem.Insert(0, historyItem);
|
||||
ClearFirst();
|
||||
Update();
|
||||
|
||||
return historyItem;
|
||||
|
||||
}
|
||||
static public void Updated()
|
||||
{
|
||||
Update();
|
||||
}
|
||||
static public void Clear()
|
||||
{
|
||||
Hitem.Clear();
|
||||
}
|
||||
|
||||
static public void ClearFirst()
|
||||
{
|
||||
if(Hitem.Count > SGlobalSetting.settingReboot.sizeHistoryItem)
|
||||
{
|
||||
Hitem.RemoveAt(Hitem.Count() - 1);
|
||||
ClearFirst();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reseter2.History
|
||||
{
|
||||
internal struct SHistory
|
||||
{
|
||||
public string Name;
|
||||
public string StartTime;
|
||||
public string StatusTask;
|
||||
public SHistory(string name, string startTime, string statusTask)
|
||||
{
|
||||
Name = name;
|
||||
StartTime = startTime;
|
||||
StatusTask = statusTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
|
@ -9,6 +10,18 @@ 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();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using Reseter2.History;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
|
@ -13,7 +14,21 @@ namespace Reseter2
|
|||
{
|
||||
resetertask = reseterTask;
|
||||
}
|
||||
public abstract void Stop();
|
||||
public abstract Task<PingResult> Tick();
|
||||
public abstract void Next();
|
||||
public abstract string GetName();
|
||||
public void Stop() {
|
||||
resetertask.StatusTask = new StatusRebootStop(resetertask);
|
||||
HistoryList.Updated();
|
||||
}
|
||||
public void RebootReturn()
|
||||
{
|
||||
resetertask.historyItem.SetEndTime(DateTime.Now);
|
||||
resetertask.historyItem.ClearTask();
|
||||
resetertask.StatusTask = new StatusPreReboot(resetertask);
|
||||
resetertask.historyItem = HistoryList.Add(resetertask);
|
||||
HistoryList.Updated();
|
||||
}
|
||||
public abstract int ActionIs();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reseter2
|
||||
{
|
||||
internal class PingResult
|
||||
{
|
||||
public long Ping { get; set; }
|
||||
public int TimeoutPing { get; set; }
|
||||
public IPAddress Ip;
|
||||
public bool TimedOut;
|
||||
public bool Succes;
|
||||
public PingResult(long ping, int timeoutPing, IPAddress ip, bool timedOut, bool succes)
|
||||
{
|
||||
Ping = ping;
|
||||
TimeoutPing = timeoutPing;
|
||||
Ip = ip;
|
||||
TimedOut = timedOut;
|
||||
Succes = succes;
|
||||
}
|
||||
public PingResult(long ping, int timeoutPing, IPAddress ip, bool timedOut)
|
||||
{
|
||||
Ping = ping;
|
||||
TimeoutPing = timeoutPing;
|
||||
Ip = ip;
|
||||
TimedOut = timedOut;
|
||||
Succes = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net;
|
||||
|
||||
namespace Reseter2
|
||||
{
|
||||
internal class Pinger
|
||||
{
|
||||
private string NameOrAddress;
|
||||
private int TimeoutCount;
|
||||
private IPAddress Ip;
|
||||
|
||||
public Pinger(string nameOrAddress)
|
||||
{
|
||||
this.NameOrAddress = nameOrAddress;
|
||||
}
|
||||
public int Timeout() {
|
||||
return TimeoutCount;
|
||||
}
|
||||
public PingResult PingHost()
|
||||
{
|
||||
bool pingable = false;
|
||||
bool succes = false;
|
||||
long ping = 0;
|
||||
Ping pinger = null;
|
||||
try
|
||||
{
|
||||
pinger = new Ping();
|
||||
PingReply reply = pinger.Send(this.NameOrAddress);
|
||||
pingable = reply.Status == IPStatus.TimedOut;
|
||||
succes = reply.Status == IPStatus.Success;
|
||||
ping = reply.RoundtripTime;
|
||||
Ip = reply.Address;
|
||||
}
|
||||
catch (PingException)
|
||||
{
|
||||
// Discard PingExceptions and return false;
|
||||
}
|
||||
|
||||
finally
|
||||
{
|
||||
if (pinger != null)
|
||||
{
|
||||
pinger.Dispose();
|
||||
}
|
||||
}
|
||||
if (!succes) TimeoutCount++;
|
||||
return new PingResult(ping, TimeoutCount, Ip, pingable, succes);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
|
@ -1,69 +1,61 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программным средством.
|
||||
// Версия среды выполнения: 4.0.30319.42000
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если
|
||||
// код создан повторно.
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Reseter2.Properties
|
||||
{
|
||||
|
||||
|
||||
namespace Reseter2.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Класс ресурсов со строгим типом для поиска локализованных строк и пр.
|
||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||
/// </summary>
|
||||
// Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder
|
||||
// класс с помощью таких средств, как ResGen или Visual Studio.
|
||||
// Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen
|
||||
// с параметром /str или заново постройте свой VS-проект.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||
// с помощью такого средства, как ResGen или Visual Studio.
|
||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||
// с параметром /str или перестройте свой проект VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Возврат кэшированного экземпляра ResourceManager, используемого этим классом.
|
||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Reseter2.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Переопределяет свойство CurrentUICulture текущего потока для всех
|
||||
/// подстановки ресурсов с помощью этого класса ресурсов со строгим типом.
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
|
|
@ -60,6 +60,7 @@
|
|||
: 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">
|
||||
|
|
@ -68,9 +69,10 @@
|
|||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<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">
|
||||
|
|
@ -85,9 +87,10 @@
|
|||
<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" msdata:Ordinal="1" />
|
||||
<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">
|
||||
|
|
@ -109,9 +112,9 @@
|
|||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- Параметры манифеста UAC
|
||||
Если вы хотите изменить уровень контроля учетных записей Windows, замените узел
|
||||
requestedExecutionLevel на один из следующих.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
При указании элемента requestedExecutionLevel будет отключена виртуализация файлов и реестра.
|
||||
Удалите этот элемент, если виртуализация требуется приложению для обратной
|
||||
совместимости.
|
||||
-->
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
<applicationRequestMinimum>
|
||||
<defaultAssemblyRequest permissionSetReference="Custom" />
|
||||
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
|
||||
</applicationRequestMinimum>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Список версий Windows, на которых это приложение было протестировано
|
||||
и будет работать. Раскомментируйте соответствующие элементы, чтобы ОС Windows
|
||||
автоматически выбрала наиболее совместимое окружение. -->
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
<!-- Windows 7 -->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||
<!-- Windows 8 -->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||
<!-- Windows 8.1 -->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||
<!-- Windows 10 -->
|
||||
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||
</application>
|
||||
</compatibility>
|
||||
<!-- Указывает, что приложение поддерживает определение DPI и не будет автоматически масштабироваться Windows при более высоких
|
||||
значениях DPI. Приложения Windows Presentation Foundation (WPF) по умолчанию поддерживают определение DPI, им не нужно
|
||||
специально включать параметр для этого. Для приложений Windows Forms на платформе .NET Framework 4.6, для которых задан этот параметр, необходимо
|
||||
также задать для "EnableWindowsFormsHighDpiAutoResizing" значение "true" в файле app.config.
|
||||
|
||||
При этом приложение начинает учитывать длинные пути. Дополнительные сведения см. на странице https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation.-->
|
||||
<!--
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
-->
|
||||
<!-- Включите темы для общих элементов управления и диалоговых окон Windows (Windows XP и более поздние версии) -->
|
||||
<!--
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
-->
|
||||
</assembly>
|
||||
|
|
@ -1,26 +1,125 @@
|
|||
using System;
|
||||
using Reseter2.History;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reseter2
|
||||
{
|
||||
internal class ReseterTask
|
||||
class ReseterTask
|
||||
{
|
||||
private IComp Comp;
|
||||
private AStatusTask StatusTask;
|
||||
private Task<PingResult> task;
|
||||
public DateTime StartTime = DateTime.Now;
|
||||
public IComp Comp { get; }
|
||||
public AStatusTask StatusTask { get; set; }
|
||||
public TaskControl taskControl;
|
||||
private Pinger Pingers;
|
||||
public Stopwatch sw = new Stopwatch();
|
||||
public PingResult pingResult;
|
||||
public HistoryItem historyItem;
|
||||
|
||||
|
||||
|
||||
public ReseterTask(IComp comp)
|
||||
public ReseterTask(IComp comp, TaskControl taskCntrl)
|
||||
{
|
||||
|
||||
Comp = comp;
|
||||
StatusTask = new StatusPreReboot(this);
|
||||
taskControl = taskCntrl;
|
||||
if (comp.GetResetName() == null || comp.GetResetName().Length == 0)
|
||||
{
|
||||
//Pingers = new Pinger("");
|
||||
Comp.SetName("Не заданно");
|
||||
Comp.SetNetName("Не заданно");
|
||||
Pingers = new Pinger(Comp.GetResetName());
|
||||
StatusTask = new StatusPreReboot(this);
|
||||
historyItem = HistoryList.Add(this);
|
||||
StatusTask = new StatusRebootError(this, "Uncorrect");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Pingers = new Pinger(Comp.GetResetName());
|
||||
StatusTask = new StatusPreReboot(this);
|
||||
historyItem = HistoryList.Add(this);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task Tick()
|
||||
{
|
||||
if (task != null)
|
||||
{
|
||||
if (task.IsCompleted){
|
||||
//this.DataContrl(Ping().ToString(), Timeout().ToString());
|
||||
pingResult = await task;
|
||||
|
||||
string p;
|
||||
if (pingResult.TimedOut)
|
||||
{
|
||||
p = "----";
|
||||
}
|
||||
else
|
||||
{
|
||||
p = pingResult.Ping.ToString() + "ms";
|
||||
}
|
||||
if (pingResult.Ip != null) Comp.SetIP(pingResult.Ip);
|
||||
taskControl.DataContrl(p, pingResult.TimeoutPing.ToString(), pingResult.Ip, Comp.GetNetName() , sw.Elapsed);
|
||||
StatusTask.Next();
|
||||
task = Task.Run(StatusTask.Tick);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
task = Task.Run(StatusTask.Tick);
|
||||
|
||||
}
|
||||
|
||||
taskControl.TimeContrl(sw.Elapsed);
|
||||
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
return Comp.GetName();
|
||||
}
|
||||
|
||||
public void RebootStop()
|
||||
{
|
||||
StatusTask.Stop();
|
||||
}
|
||||
|
||||
public void RebootReturn()
|
||||
{
|
||||
StatusTask.RebootReturn();
|
||||
}
|
||||
|
||||
public void SetNameStage(string nameStage, int indexImg, bool pauseOn = true)
|
||||
{
|
||||
taskControl.SetNameStage(nameStage, indexImg, pauseOn);
|
||||
}
|
||||
public PingResult Ping()
|
||||
{
|
||||
return Pingers.PingHost();
|
||||
}
|
||||
|
||||
public int Timeout() {
|
||||
return Pingers.Timeout();
|
||||
}
|
||||
|
||||
public void DataContrl(string ping, string timeout)
|
||||
{
|
||||
// taskControl.Invoke(DataChange);
|
||||
// DataChange.Invoke(ping, timeout);
|
||||
}
|
||||
private void Clear()
|
||||
{
|
||||
Reseter.Clear(this);
|
||||
Reseter.Clear(this, taskControl);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,21 @@
|
|||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>1</ApplicationRevision>
|
||||
<ApplicationVersion>2.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
|
@ -22,6 +37,8 @@
|
|||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>preview</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
|
@ -31,10 +48,32 @@
|
|||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>preview</LangVersion>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<DocumentationFile>bin\Release\Reseter2.xml</DocumentationFile>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>reseter.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>false</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.DirectoryServices" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
|
@ -46,6 +85,12 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CheckControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CheckControl.Designer.cs">
|
||||
<DependentUpon>CheckControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CompName.cs" />
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
|
@ -53,13 +98,106 @@
|
|||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="History\HistoryItem.cs" />
|
||||
<Compile Include="History\HistoryList.cs" />
|
||||
<Compile Include="History\SHistory.cs" />
|
||||
<Compile Include="IComp.cs" />
|
||||
<Compile Include="IStatusTask.cs" />
|
||||
<Compile Include="Pinger.cs" />
|
||||
<Compile Include="PingResult.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="reseter.cs" />
|
||||
<Compile Include="ReseteTask.cs" />
|
||||
<Compile Include="SCCMsearch\AuthLogin.cs" />
|
||||
<Compile Include="SCCMsearch\AuthWin.cs" />
|
||||
<Compile Include="SCCMsearch\IAuthType.cs" />
|
||||
<Compile Include="Seacher\ISeaherMetod.cs" />
|
||||
<Compile Include="Seacher\SeachSCCM.cs" />
|
||||
<Compile Include="Seacher\SeahcLocal.cs" />
|
||||
<Compile Include="Seacher\SSeaher.cs" />
|
||||
<Compile Include="Setting\SettingExpand.cs" />
|
||||
<Compile Include="Setting\SettingReboot.cs" />
|
||||
<Compile Include="Setting\SettingRebootControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Setting\SettingRebootControl.Designer.cs">
|
||||
<DependentUpon>SettingRebootControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Setting\SettingSCCM.cs" />
|
||||
<Compile Include="Setting\SettingSCCMControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Setting\SettingSCCMControl.Designer.cs">
|
||||
<DependentUpon>SettingSCCMControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Setting\SettingWords.cs" />
|
||||
<Compile Include="Setting\SettingWordsControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Setting\SettingWordsControl.Designer.cs">
|
||||
<DependentUpon>SettingWordsControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Setting\SSetting.cs" />
|
||||
<Compile Include="Shutdown.cs" />
|
||||
<Compile Include="StatusCanceled.cs" />
|
||||
<Compile Include="StatusReboot.cs" />
|
||||
<Compile Include="StatusRebootError.cs" />
|
||||
<Compile Include="StatusRebooting.cs" />
|
||||
<Compile Include="StatusRebootStop.cs" />
|
||||
<Compile Include="StatusRebootSucces.cs" />
|
||||
<Compile Include="StausPreReboot.cs" />
|
||||
<Compile Include="TaskControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TaskControl.Designer.cs">
|
||||
<DependentUpon>TaskControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TewTreeView.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Setting\SGlobalSetting.cs" />
|
||||
<Compile Include="Words\BilderWords.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Words\BilderWords.Designer.cs">
|
||||
<DependentUpon>BilderWords.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Words\IWordsContol.cs" />
|
||||
<Compile Include="Words\IWordsItem.cs" />
|
||||
<Compile Include="Words\WordsCategory.cs" />
|
||||
<Compile Include="Words\WordsCategoryControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Words\WordsCategoryControl.Designer.cs">
|
||||
<DependentUpon>WordsCategoryControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Words\WordsComp.cs" />
|
||||
<Compile Include="Words\WordsEditCompControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Words\WordsEditCompControl.Designer.cs">
|
||||
<DependentUpon>WordsEditCompControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Words\WordsEditCategoryControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Words\WordsEditCategoryControl.Designer.cs">
|
||||
<DependentUpon>WordsEditCategoryControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Words\WordsItemControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Words\WordsItemControl.Designer.cs">
|
||||
<DependentUpon>WordsItemControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Words\WordsList.cs" />
|
||||
<EmbeddedResource Include="CheckControl.resx">
|
||||
<DependentUpon>CheckControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
|
|
@ -68,7 +206,36 @@
|
|||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Setting\SettingRebootControl.resx">
|
||||
<DependentUpon>SettingRebootControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Setting\SettingSCCMControl.resx">
|
||||
<DependentUpon>SettingSCCMControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Setting\SettingWordsControl.resx">
|
||||
<DependentUpon>SettingWordsControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="TaskControl.resx">
|
||||
<DependentUpon>TaskControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Words\BilderWords.resx">
|
||||
<DependentUpon>BilderWords.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Words\WordsCategoryControl.resx">
|
||||
<DependentUpon>WordsCategoryControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Words\WordsEditCompControl.resx">
|
||||
<DependentUpon>WordsEditCompControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Words\WordsEditCategoryControl.resx">
|
||||
<DependentUpon>WordsEditCategoryControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Words\WordsItemControl.resx">
|
||||
<DependentUpon>WordsItemControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<None Include="Properties\app.manifest" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
|
|
@ -82,5 +249,22 @@
|
|||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\MySql.Data.dll" />
|
||||
<Content Include="reseter.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 и x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
using Reseter2.Setting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Reseter2.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 + ";";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
using Reseter2.Setting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reseter2.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;";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reseter2.SCCMsearch
|
||||
{
|
||||
internal interface IAuthType
|
||||
{
|
||||
public string Name { get; }
|
||||
public string Password { get; }
|
||||
public string AuthString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static Reseter2.Seacher.SeahcLocal;
|
||||
|
||||
namespace Reseter2.Seacher
|
||||
{
|
||||
internal interface ISeaherMetod
|
||||
{
|
||||
public void Change(ResultUpdate sender, string seach);
|
||||
public IComp Result(int index);
|
||||
public string ResultString(int index);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
using Reseter2.Setting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reseter2.Seacher
|
||||
{
|
||||
internal static class SSeaher
|
||||
{
|
||||
public static ISeaherMetod seaherMetod;
|
||||
public static void LoadSetting()
|
||||
{
|
||||
if(SGlobalSetting.settingSCCM.on)
|
||||
{
|
||||
seaherMetod = new SeachSCCM();
|
||||
}
|
||||
else
|
||||
{
|
||||
seaherMetod = new SeahcLocal();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,263 @@
|
|||
using System.Data.SqlClient;
|
||||
using Reseter2.SCCMsearch;
|
||||
using Reseter2.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 Reseter2.Seacher.SeahcLocal;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
|
||||
using System.Threading;
|
||||
|
||||
namespace Reseter2.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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
using Reseter2.History;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reseter2.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,268 @@
|
|||
using Reseter2.History;
|
||||
using Reseter2.Seacher;
|
||||
using Reseter2.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 Reseter2.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()
|
||||
{
|
||||
object output = Load("res.dat");
|
||||
if (!(output is SSetting)) return;
|
||||
SSetting 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;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
using Reseter2.History;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reseter2.Setting
|
||||
{
|
||||
[Serializable]
|
||||
internal struct SSetting
|
||||
{
|
||||
public SettingWords settingWords;
|
||||
public List<HistoryItem> historyItems;
|
||||
public SettingExpand settingExpand;
|
||||
public SettingSCCM settingSCCM;
|
||||
public SettingReboot settingReboot;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 Reseter2.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 + "/" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reseter2.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
namespace Reseter2.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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 Reseter2.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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reseter2.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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,191 @@
|
|||
namespace Reseter2.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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
using Reseter2.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 Reseter2.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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
using Reseter2.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 Reseter2.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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
namespace Reseter2.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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
using Reseter2.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 Reseter2.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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Reseter2
|
||||
{
|
||||
class Shutdown
|
||||
{
|
||||
public static void Restart()
|
||||
{
|
||||
StartShutDown("-f -r -t 5");
|
||||
}
|
||||
public static void RestartPC(string param)
|
||||
{
|
||||
if (param.Length > 0)
|
||||
{
|
||||
//MessageBox.Show(@"-r -m \\" + param + " -f -t 5");
|
||||
StartShutDown(@"-r -m \\" + param + " -f -t 5");
|
||||
}
|
||||
|
||||
}
|
||||
public static void LogOff()
|
||||
{
|
||||
StartShutDown("-l");
|
||||
}
|
||||
|
||||
public static void Shut()
|
||||
{
|
||||
StartShutDown("-f -s -t 5");
|
||||
}
|
||||
private static void StartShutDown(string param)
|
||||
{
|
||||
ProcessStartInfo proc = new ProcessStartInfo();
|
||||
proc.FileName = "cmd";
|
||||
proc.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
proc.Arguments = "/C shutdown " + param;
|
||||
Process.Start(proc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reseter2
|
||||
{
|
||||
internal class StatusCanceled : AStatusTask
|
||||
{
|
||||
private PingResult PingResult;
|
||||
public StatusCanceled(ReseterTask reseterTask) : base(reseterTask)
|
||||
{
|
||||
resetertask.SetNameStage("Отмененно", 4);
|
||||
resetertask.historyItem.SetEndTime(DateTime.Now);
|
||||
PingResult = resetertask.Ping();
|
||||
reseterTask.sw.Stop();
|
||||
}
|
||||
|
||||
public override Task<PingResult> Tick()
|
||||
{
|
||||
return Task.FromResult(PingResult);
|
||||
}
|
||||
public override void Next()
|
||||
{
|
||||
}
|
||||
public override string GetName()
|
||||
{
|
||||
return "Canceled";
|
||||
}
|
||||
public override int ActionIs()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
using Reseter2.History;
|
||||
using Reseter2.Setting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
|
||||
|
||||
namespace Reseter2
|
||||
{
|
||||
internal class StatusReboot : AStatusTask
|
||||
{
|
||||
private int TimeCount;
|
||||
private int Timeout;
|
||||
|
||||
private PingResult PingResult = new PingResult(0, 0, null, false);
|
||||
public StatusReboot(ReseterTask reseterTask) : base(reseterTask)
|
||||
{
|
||||
resetertask.SetNameStage("Отправка в перезагрузку", 1);
|
||||
Shutdown.RestartPC(reseterTask.Comp.GetResetName());
|
||||
}
|
||||
|
||||
public override Task<PingResult> Tick()
|
||||
{
|
||||
PingResult = resetertask.Ping();
|
||||
return Task.FromResult(PingResult);
|
||||
}
|
||||
public override void Next()
|
||||
{
|
||||
if (PingResult.TimedOut == true)
|
||||
{
|
||||
TimeCount++;
|
||||
}
|
||||
if (TimeCount > 2)
|
||||
{
|
||||
resetertask.StatusTask = new StatusRebooting(resetertask, Timeout);
|
||||
HistoryList.Updated();
|
||||
}
|
||||
if (Timeout > SGlobalSetting.settingReboot.timeOutReboot)
|
||||
{
|
||||
resetertask.StatusTask = new StatusRebootError(resetertask, "Error RST");
|
||||
HistoryList.Updated();
|
||||
}
|
||||
Timeout++;
|
||||
|
||||
|
||||
}
|
||||
public override string GetName()
|
||||
{
|
||||
return "Send RST";
|
||||
}
|
||||
public override int ActionIs()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reseter2
|
||||
{
|
||||
internal class StatusRebootError : AStatusTask
|
||||
{
|
||||
private string _error;
|
||||
private PingResult PingResult = new PingResult(0, 0, null, false);
|
||||
public StatusRebootError(ReseterTask reseterTask, string error = "Error") : base(reseterTask)
|
||||
{
|
||||
_error = error;
|
||||
string messges = "Ошибка перезагрузки";
|
||||
if (error != "Error") messges = messges + "(" + error + ")";
|
||||
resetertask.SetNameStage(messges, 5, false);
|
||||
resetertask.historyItem.SetEndTime(DateTime.Now);
|
||||
reseterTask.sw.Stop();
|
||||
}
|
||||
|
||||
public override Task<PingResult> Tick()
|
||||
{
|
||||
return Task.FromResult(PingResult);
|
||||
}
|
||||
public override void Next()
|
||||
{
|
||||
}
|
||||
public override string GetName()
|
||||
{
|
||||
|
||||
return _error;
|
||||
}
|
||||
public override int ActionIs()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reseter2
|
||||
{
|
||||
internal class StatusRebootStop : AStatusTask
|
||||
{
|
||||
private PingResult PingResult;
|
||||
public StatusRebootStop(ReseterTask reseterTask) : base(reseterTask)
|
||||
{
|
||||
resetertask.SetNameStage("Остановленно", 6, false);
|
||||
PingResult = resetertask.pingResult;
|
||||
resetertask.historyItem.SetEndTime(DateTime.Now);
|
||||
reseterTask.sw.Stop();
|
||||
}
|
||||
|
||||
public override Task<PingResult> Tick()
|
||||
{
|
||||
return Task.FromResult(PingResult);
|
||||
}
|
||||
public override void Next()
|
||||
{
|
||||
}
|
||||
public override string GetName()
|
||||
{
|
||||
return "Stop";
|
||||
}
|
||||
public override int ActionIs()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reseter2
|
||||
{
|
||||
internal class StatusRebootSucces : AStatusTask
|
||||
{
|
||||
private PingResult PingResult;
|
||||
public StatusRebootSucces(ReseterTask reseterTask) : base(reseterTask)
|
||||
{
|
||||
resetertask.SetNameStage("Успешно перезагруженно", 7, false);
|
||||
resetertask.historyItem.SetEndTime(DateTime.Now);
|
||||
PingResult = resetertask.Ping();
|
||||
resetertask.Comp.SetIP(PingResult.Ip);
|
||||
reseterTask.sw.Stop();
|
||||
}
|
||||
|
||||
public override Task<PingResult> Tick()
|
||||
{
|
||||
return Task.FromResult(PingResult);
|
||||
}
|
||||
public override void Next()
|
||||
{
|
||||
}
|
||||
public override string GetName()
|
||||
{
|
||||
return "Succes";
|
||||
}
|
||||
public override int ActionIs()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
using Reseter2.History;
|
||||
using Reseter2.Setting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Reseter2
|
||||
{
|
||||
internal class StatusRebooting : AStatusTask
|
||||
{
|
||||
private int TimeCount;
|
||||
private int Timeout;
|
||||
private PingResult PingResult = new PingResult(0, 0, null, false);
|
||||
public StatusRebooting(ReseterTask reseterTask, int timeout = 0) : base(reseterTask)
|
||||
{
|
||||
resetertask.SetNameStage("Перезагрузка", 2);
|
||||
Timeout = timeout;
|
||||
}
|
||||
|
||||
public override Task<PingResult> Tick()
|
||||
{
|
||||
PingResult = resetertask.Ping();
|
||||
return Task.FromResult(PingResult);
|
||||
}
|
||||
public override void Next()
|
||||
{
|
||||
if (PingResult.Succes)
|
||||
{
|
||||
TimeCount++;
|
||||
}
|
||||
if (TimeCount > SGlobalSetting.settingReboot.timeCheckBeforReboot)
|
||||
{
|
||||
resetertask.StatusTask = new StatusRebootSucces(resetertask);
|
||||
HistoryList.Updated();
|
||||
}
|
||||
if (PingResult.TimedOut == true)
|
||||
{
|
||||
Timeout++;
|
||||
}
|
||||
if (Timeout > SGlobalSetting.settingReboot.timeOutReboot)
|
||||
{
|
||||
resetertask.StatusTask = new StatusRebootError(resetertask, "Error UP");
|
||||
HistoryList.Updated();
|
||||
}
|
||||
|
||||
}
|
||||
public override string GetName()
|
||||
{
|
||||
return "Rebooting";
|
||||
}
|
||||
public override int ActionIs()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
using System;
|
||||
using Reseter2.History;
|
||||
using Reseter2.Setting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
|
@ -8,17 +10,50 @@ namespace Reseter2
|
|||
{
|
||||
internal class StatusPreReboot : AStatusTask
|
||||
{
|
||||
private int timeOut;
|
||||
private PingResult PingResult = new PingResult(0,0,null, false);
|
||||
public StatusPreReboot(ReseterTask reseterTask) : base(reseterTask)
|
||||
{
|
||||
resetertask.SetNameStage("Проверка связи", 0);
|
||||
resetertask.sw.Restart();
|
||||
}
|
||||
|
||||
public override Task<PingResult> Tick()
|
||||
{
|
||||
|
||||
PingResult = resetertask.Ping();
|
||||
return Task.FromResult(PingResult);
|
||||
// return resetertask.DataContrl(pingResult.Ping.ToString(), pingResult.Ping.ToString());
|
||||
|
||||
}
|
||||
public override void Next()
|
||||
{
|
||||
|
||||
if (PingResult.Succes)
|
||||
{
|
||||
resetertask.StatusTask = new StatusReboot(resetertask);
|
||||
HistoryList.Updated();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
timeOut++;
|
||||
}
|
||||
if(timeOut > SGlobalSetting.settingReboot.checkConnect)
|
||||
{
|
||||
resetertask.StatusTask = new StatusRebootError(resetertask, "Error NET");
|
||||
HistoryList.Updated();
|
||||
}
|
||||
|
||||
}
|
||||
public override void Stop()
|
||||
public override string GetName()
|
||||
{
|
||||
|
||||
return "Check NET";
|
||||
}
|
||||
|
||||
public override int ActionIs()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,270 @@
|
|||
namespace Reseter2
|
||||
{
|
||||
partial class TaskControl
|
||||
{
|
||||
/// <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.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TaskControl));
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.lb_name = new System.Windows.Forms.Label();
|
||||
this.lb_ip = new System.Windows.Forms.Label();
|
||||
this.lb_stage = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.lb_ping = new System.Windows.Forms.Label();
|
||||
this.Timeout = new System.Windows.Forms.Label();
|
||||
this.lb_timeout = new System.Windows.Forms.Label();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.lb_time = new System.Windows.Forms.Label();
|
||||
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
|
||||
this.cm_task = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.cm_taskSave = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.cm_task.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(80, 16);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(50, 13);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Имя ПК:";
|
||||
this.label1.Click += new System.EventHandler(this.label1_Click);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(80, 30);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(27, 13);
|
||||
this.label2.TabIndex = 1;
|
||||
this.label2.Text = "Net:";
|
||||
//
|
||||
// lb_name
|
||||
//
|
||||
this.lb_name.AutoSize = true;
|
||||
this.lb_name.Location = new System.Drawing.Point(127, 16);
|
||||
this.lb_name.Name = "lb_name";
|
||||
this.lb_name.Size = new System.Drawing.Size(64, 13);
|
||||
this.lb_name.TabIndex = 2;
|
||||
this.lb_name.Text = "-------------------";
|
||||
//
|
||||
// lb_ip
|
||||
//
|
||||
this.lb_ip.AutoSize = true;
|
||||
this.lb_ip.Location = new System.Drawing.Point(103, 30);
|
||||
this.lb_ip.Name = "lb_ip";
|
||||
this.lb_ip.Size = new System.Drawing.Size(70, 13);
|
||||
this.lb_ip.TabIndex = 3;
|
||||
this.lb_ip.Text = "---------------------";
|
||||
//
|
||||
// lb_stage
|
||||
//
|
||||
this.lb_stage.AutoSize = true;
|
||||
this.lb_stage.Location = new System.Drawing.Point(80, 2);
|
||||
this.lb_stage.Name = "lb_stage";
|
||||
this.lb_stage.Size = new System.Drawing.Size(0, 13);
|
||||
this.lb_stage.TabIndex = 4;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(80, 43);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(31, 13);
|
||||
this.label4.TabIndex = 5;
|
||||
this.label4.Text = "Ping:";
|
||||
//
|
||||
// lb_ping
|
||||
//
|
||||
this.lb_ping.AutoSize = true;
|
||||
this.lb_ping.Location = new System.Drawing.Point(114, 43);
|
||||
this.lb_ping.Name = "lb_ping";
|
||||
this.lb_ping.Size = new System.Drawing.Size(0, 13);
|
||||
this.lb_ping.TabIndex = 6;
|
||||
//
|
||||
// Timeout
|
||||
//
|
||||
this.Timeout.AutoSize = true;
|
||||
this.Timeout.Location = new System.Drawing.Point(154, 43);
|
||||
this.Timeout.Name = "Timeout";
|
||||
this.Timeout.Size = new System.Drawing.Size(48, 13);
|
||||
this.Timeout.TabIndex = 7;
|
||||
this.Timeout.Text = "Timeout:";
|
||||
//
|
||||
// lb_timeout
|
||||
//
|
||||
this.lb_timeout.AutoSize = true;
|
||||
this.lb_timeout.Location = new System.Drawing.Point(205, 43);
|
||||
this.lb_timeout.Name = "lb_timeout";
|
||||
this.lb_timeout.Size = new System.Drawing.Size(0, 13);
|
||||
this.lb_timeout.TabIndex = 8;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(270, 1);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(96, 23);
|
||||
this.button1.TabIndex = 9;
|
||||
this.button1.Text = "Закрыть";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(270, 51);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(96, 23);
|
||||
this.button2.TabIndex = 10;
|
||||
this.button2.Text = "Перезапустить";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.Location = new System.Drawing.Point(6, 6);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(64, 64);
|
||||
this.pictureBox1.TabIndex = 11;
|
||||
this.pictureBox1.TabStop = false;
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.button3.Location = new System.Drawing.Point(270, 26);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(96, 23);
|
||||
this.button3.TabIndex = 12;
|
||||
this.button3.Text = "Остановить";
|
||||
this.button3.UseVisualStyleBackColor = true;
|
||||
this.button3.Click += new System.EventHandler(this.button3_Click);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(80, 58);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(49, 13);
|
||||
this.label3.TabIndex = 13;
|
||||
this.label3.Text = "Таймер:";
|
||||
//
|
||||
// lb_time
|
||||
//
|
||||
this.lb_time.AutoSize = true;
|
||||
this.lb_time.Location = new System.Drawing.Point(125, 58);
|
||||
this.lb_time.Name = "lb_time";
|
||||
this.lb_time.Size = new System.Drawing.Size(34, 13);
|
||||
this.lb_time.TabIndex = 14;
|
||||
this.lb_time.Text = "00:00";
|
||||
//
|
||||
// imageList1
|
||||
//
|
||||
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
|
||||
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
|
||||
this.imageList1.Images.SetKeyName(0, "1icon-64.png");
|
||||
this.imageList1.Images.SetKeyName(1, "2icon-64.png");
|
||||
this.imageList1.Images.SetKeyName(2, "3icon-64.png");
|
||||
this.imageList1.Images.SetKeyName(3, "8icon-64.png");
|
||||
this.imageList1.Images.SetKeyName(4, "6icon-64.png");
|
||||
this.imageList1.Images.SetKeyName(5, "4icon-64.png");
|
||||
this.imageList1.Images.SetKeyName(6, "5icon-64.png");
|
||||
this.imageList1.Images.SetKeyName(7, "7icon-64.png");
|
||||
//
|
||||
// cm_task
|
||||
//
|
||||
this.cm_task.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.cm_taskSave});
|
||||
this.cm_task.Name = "cm_task";
|
||||
this.cm_task.ShowImageMargin = false;
|
||||
this.cm_task.Size = new System.Drawing.Size(109, 26);
|
||||
this.cm_task.Text = "Сохранить";
|
||||
//
|
||||
// cm_taskSave
|
||||
//
|
||||
this.cm_taskSave.Name = "cm_taskSave";
|
||||
this.cm_taskSave.Size = new System.Drawing.Size(108, 22);
|
||||
this.cm_taskSave.Text = "Сохранить";
|
||||
this.cm_taskSave.Click += new System.EventHandler(this.cm_taskSave_Click);
|
||||
//
|
||||
// TaskControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.ContextMenuStrip = this.cm_task;
|
||||
this.Controls.Add(this.lb_time);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.button3);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.lb_timeout);
|
||||
this.Controls.Add(this.Timeout);
|
||||
this.Controls.Add(this.lb_ping);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.lb_stage);
|
||||
this.Controls.Add(this.lb_ip);
|
||||
this.Controls.Add(this.lb_name);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "TaskControl";
|
||||
this.Size = new System.Drawing.Size(371, 77);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
this.cm_task.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label lb_name;
|
||||
private System.Windows.Forms.Label lb_ip;
|
||||
private System.Windows.Forms.Label lb_stage;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label lb_ping;
|
||||
private System.Windows.Forms.Label Timeout;
|
||||
private System.Windows.Forms.Label lb_timeout;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.Button button3;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label lb_time;
|
||||
private System.Windows.Forms.ImageList imageList1;
|
||||
private System.Windows.Forms.ContextMenuStrip cm_task;
|
||||
private System.Windows.Forms.ToolStripMenuItem cm_taskSave;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
using Reseter2.Words;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace Reseter2
|
||||
{
|
||||
[DefaultEvent(nameof(TaskControl))]
|
||||
partial class TaskControl : UserControl
|
||||
{
|
||||
ReseterTask reseterTask;
|
||||
public delegate void DUpdateTree();
|
||||
public DUpdateTree UpdateTree;
|
||||
public TaskControl()
|
||||
{
|
||||
reseterTask = null;
|
||||
if (!this.DesignMode)
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Intit(ReseterTask res)
|
||||
{
|
||||
reseterTask = res;
|
||||
if (reseterTask.GetName() != null) lb_name.Text = reseterTask.GetName();
|
||||
if (reseterTask.Comp.GetNetNameStr() != null)
|
||||
{
|
||||
lb_ip.Text = reseterTask.Comp.GetNetNameStr();
|
||||
if (reseterTask.Comp.GetIP() != null && reseterTask.Comp.GetNetName() != null) lb_ip.Text = lb_ip.Text+"(" +reseterTask.Comp.GetIP().ToString()+")";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void DataContrl(string ping, string timeout, IPAddress ip, string netname, TimeSpan time)
|
||||
{
|
||||
lb_ping.Text = ping;
|
||||
lb_timeout.Text = timeout;
|
||||
lb_ip.Text = reseterTask.Comp.GetNetNameStr();
|
||||
|
||||
if (netname != null)
|
||||
{
|
||||
lb_ip.Text = netname;
|
||||
if (ip != null && netname != null) lb_ip.Text = lb_ip.Text + "(" + ip.ToString() + ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ip != null) lb_ip.Text = ip.ToString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
lb_time.Text = time.ToString(@"mm\:ss");
|
||||
|
||||
}
|
||||
public void TimeContrl(TimeSpan time)
|
||||
{
|
||||
lb_time.Text = time.ToString(@"mm\:ss");
|
||||
|
||||
}
|
||||
public void SetNameStage(string nameStage, int indexImg, bool pauseOn)
|
||||
{
|
||||
lb_stage.Text = nameStage;
|
||||
pictureBox1.Image = imageList1.Images[indexImg];
|
||||
button3.Enabled=pauseOn;
|
||||
}
|
||||
private void label1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
Reseter.Clear(reseterTask, this);
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
reseterTask.RebootStop();
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
reseterTask.RebootReturn();
|
||||
}
|
||||
|
||||
private void cm_taskSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
BilderWords bilderWords = new BilderWords(reseterTask.Comp);
|
||||
DialogResult result = bilderWords.ShowDialog();
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
UpdateTree();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,31 @@
|
|||
using Reseter2.Words;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Reseter2
|
||||
{
|
||||
[DefaultEvent(nameof(NewTreeView))]
|
||||
class NewTreeView:TreeView
|
||||
{
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
if(m.Msg == 0x0203)
|
||||
{
|
||||
Point localPos = this.PointToClient(Cursor.Position);
|
||||
var hitTestInfo = this.HitTest(localPos);
|
||||
if (hitTestInfo.Location == TreeViewHitTestLocations.StateImage)
|
||||
{
|
||||
m.Msg = 0x0201;
|
||||
}
|
||||
}
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,230 @@
|
|||
namespace Reseter2.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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,420 @@
|
|||
using Reseter2.History;
|
||||
using Reseter2.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 Reseter2.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
|
|
@ -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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
namespace Reseter2.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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 Reseter2.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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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>
|
||||
|
|
@ -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 Reseter2.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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
namespace Reseter2.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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 Reseter2.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
namespace Reseter2.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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 Reseter2.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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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>
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
namespace Reseter2.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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 Reseter2.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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -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>
|
||||
|
|
@ -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 Reseter2.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +1,121 @@
|
|||
using System;
|
||||
using Reseter2.History;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection.Emit;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.Remoting.Metadata.W3cXsd2001;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ToolTip;
|
||||
|
||||
namespace Reseter2
|
||||
{
|
||||
internal static class Reseter
|
||||
{
|
||||
private static List<ReseterTask> list_task;
|
||||
|
||||
private static List<ReseterTask> list_task = new List<ReseterTask>();
|
||||
private static Panel flow_conteiner;
|
||||
private static Form1 Main;
|
||||
|
||||
public static void AddTask(IComp compName)
|
||||
public static void SetForm(Panel flow_cntr, Form1 main)
|
||||
{
|
||||
list_task.Add(new ReseterTask(compName));
|
||||
flow_conteiner = flow_cntr;
|
||||
Main = main;
|
||||
}
|
||||
public static void AddTask(String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
IPAddress ip = IPAddress.Parse(name);
|
||||
CompId compid = new CompId(ip);
|
||||
AddTask(compid);
|
||||
}
|
||||
catch
|
||||
{
|
||||
CompId compid = new CompId(name);
|
||||
AddTask(compid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void Clear(ReseterTask reseterTask)
|
||||
public static void AddTask(List<IComp> comps)
|
||||
{
|
||||
foreach (var item in comps)
|
||||
{
|
||||
AddTask(item);
|
||||
}
|
||||
}
|
||||
public static void AddTask(IComp compName)
|
||||
{
|
||||
|
||||
TaskControl taskControl = new TaskControl();
|
||||
taskControl.UpdateTree = Main.UpdateTree;
|
||||
ReseterTask reseterTask = new ReseterTask(compName, taskControl);
|
||||
taskControl.Intit(reseterTask);
|
||||
flow_conteiner.Controls.Add(taskControl);
|
||||
list_task.Add(reseterTask);
|
||||
}
|
||||
|
||||
public static void ClearCanceled()
|
||||
{
|
||||
foreach (var item in list_task)
|
||||
{
|
||||
if (item.StatusTask.ActionIs() == 0)
|
||||
{
|
||||
flow_conteiner.Controls.Remove(item.taskControl);
|
||||
list_task.Remove(item);
|
||||
ClearCanceled();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static async void Clear(ReseterTask reseterTask, TaskControl taskControl)
|
||||
{
|
||||
if(!(reseterTask.StatusTask is StatusRebootError ||
|
||||
reseterTask.StatusTask is StatusRebootStop ||
|
||||
reseterTask.StatusTask is StatusRebootSucces))
|
||||
{
|
||||
reseterTask.StatusTask = new StatusCanceled(reseterTask);
|
||||
reseterTask.historyItem.SetEndTime(DateTime.Now);
|
||||
}
|
||||
|
||||
HistoryList.Updated();
|
||||
flow_conteiner.Controls.Remove(taskControl);
|
||||
list_task.Remove(reseterTask);
|
||||
|
||||
}
|
||||
public static void Tick(out int Action, out int Close)
|
||||
{
|
||||
Action = 0;
|
||||
Close = 0;
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var item in list_task)
|
||||
{
|
||||
|
||||
item.Tick();
|
||||
if(item.StatusTask.ActionIs() == 1)
|
||||
{
|
||||
Action++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Close++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
Loading…
Reference in New Issue