From de81dda59b26e8110d331897d9b525df814ee323 Mon Sep 17 00:00:00 2001 From: facat Date: Sat, 14 Nov 2020 13:46:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=93=E4=BA=A8=E5=8D=8F=E5=90=8C=E6=8E=92?= =?UTF-8?q?=E4=BD=8D=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: facat --- .gitignore | 3 + History.cs | 43 +++++ Message.Designer.cs | 62 ++++++++ Message.cs | 26 ++++ Message.resx | 120 ++++++++++++++ OrgSyncDGui.csproj | 104 +++++++++++++ Program.cs | 21 +++ Properties/AssemblyInfo.cs | 36 +++++ Properties/Resources.Designer.cs | 71 +++++++++ Properties/Resources.resx | 117 ++++++++++++++ Properties/Settings.Designer.cs | 30 ++++ Properties/Settings.settings | 7 + Win.Designer.cs | 260 +++++++++++++++++++++++++++++++ Win.cs | 170 ++++++++++++++++++++ Win.resx | 120 ++++++++++++++ 15 files changed, 1190 insertions(+) create mode 100644 .gitignore create mode 100644 History.cs create mode 100644 Message.Designer.cs create mode 100644 Message.cs create mode 100644 Message.resx create mode 100644 OrgSyncDGui.csproj create mode 100644 Program.cs create mode 100644 Properties/AssemblyInfo.cs create mode 100644 Properties/Resources.Designer.cs create mode 100644 Properties/Resources.resx create mode 100644 Properties/Settings.Designer.cs create mode 100644 Properties/Settings.settings create mode 100644 Win.Designer.cs create mode 100644 Win.cs create mode 100644 Win.resx diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..554e758 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +bin +obj +*.dll \ No newline at end of file diff --git a/History.cs b/History.cs new file mode 100644 index 0000000..d2912e5 --- /dev/null +++ b/History.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.IO; +using Newtonsoft.Json; + +namespace OrgSyncDGui +{ + class History + { + public Dictionary history; + private string jsonFilePath; + public History(string jsonFilePath) + { + this.history = new Dictionary(); + this.jsonFilePath=jsonFilePath; + } + public void load() + { + if (!File.Exists(this.jsonFilePath)) + { + return; + } + using (StreamReader reader = new StreamReader(this.jsonFilePath)) + { + string jsonStr = reader.ReadToEnd(); + this.history=JsonConvert.DeserializeObject>(jsonStr); + } + } + + public void save() + { + string jsonStr = JsonConvert.SerializeObject(this.history,Formatting.Indented); + using (StreamWriter writer = new StreamWriter(this.jsonFilePath)) + { + writer.Write(jsonStr); + } + } + + + } +} diff --git a/Message.Designer.cs b/Message.Designer.cs new file mode 100644 index 0000000..2978ebc --- /dev/null +++ b/Message.Designer.cs @@ -0,0 +1,62 @@ +namespace OrgSyncDGui +{ + partial class Message + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tBMsg = new System.Windows.Forms.TextBox(); + this.SuspendLayout(); + // + // tBMsg + // + this.tBMsg.Location = new System.Drawing.Point(24, 37); + this.tBMsg.Multiline = true; + this.tBMsg.Name = "tBMsg"; + this.tBMsg.ReadOnly = true; + this.tBMsg.Size = new System.Drawing.Size(396, 544); + this.tBMsg.TabIndex = 0; + // + // Message + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(453, 636); + this.Controls.Add(this.tBMsg); + this.Name = "Message"; + this.Text = "Message"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Message_FormClosing); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.TextBox tBMsg; + + } +} \ No newline at end of file diff --git a/Message.cs b/Message.cs new file mode 100644 index 0000000..47f1ede --- /dev/null +++ b/Message.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace OrgSyncDGui +{ + public partial class Message : Form + { + public Message() + { + InitializeComponent(); + } + + private void Message_FormClosing(object sender, FormClosingEventArgs e) + { + e.Cancel=true; + this.Hide(); + } + + } +} diff --git a/Message.resx b/Message.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/Message.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/OrgSyncDGui.csproj b/OrgSyncDGui.csproj new file mode 100644 index 0000000..5589a44 --- /dev/null +++ b/OrgSyncDGui.csproj @@ -0,0 +1,104 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {2D01F3F7-F6A0-48D9-BCA7-19F09B9D9C13} + WinExe + Properties + OrgSyncDGui + OrgSyncDGui + v3.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + .\Newtonsoft.Json.dll + + + + 3.5 + + + 3.5 + + + 3.5 + + + + + + + + + + + Form + + + Message.cs + + + Form + + + Win.cs + + + + + Message.cs + Designer + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + Win.cs + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + \ No newline at end of file diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..19412eb --- /dev/null +++ b/Program.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace OrgSyncDGui +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Win()); + } + } +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..35da7ec --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("OrgSyncDGui")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OrgSyncDGui")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("36d3378c-aa7f-4c63-9465-dd2ef3ca6eea")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs new file mode 100644 index 0000000..8167d64 --- /dev/null +++ b/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.8689 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OrgSyncDGui.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + 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() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OrgSyncDGui.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs new file mode 100644 index 0000000..5f74167 --- /dev/null +++ b/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.8689 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OrgSyncDGui.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Properties/Settings.settings b/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Win.Designer.cs b/Win.Designer.cs new file mode 100644 index 0000000..ee7a13b --- /dev/null +++ b/Win.Designer.cs @@ -0,0 +1,260 @@ +namespace OrgSyncDGui +{ + partial class Win + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lBSFile = new System.Windows.Forms.Label(); + this.tBSFile = new System.Windows.Forms.TextBox(); + this.bTSFile = new System.Windows.Forms.Button(); + this.bTDFile = new System.Windows.Forms.Button(); + this.tBDFile = new System.Windows.Forms.TextBox(); + this.lBDFile = new System.Windows.Forms.Label(); + this.bTClearSFile = new System.Windows.Forms.Button(); + this.bTClearDFile = new System.Windows.Forms.Button(); + this.bTGenerateTaFile = new System.Windows.Forms.Button(); + this.bTShowMsg = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); + this.bTTaFile = new System.Windows.Forms.Button(); + this.tBTaFile = new System.Windows.Forms.TextBox(); + this.lBTaFile = new System.Windows.Forms.Label(); + this.tBSyncMileage = new System.Windows.Forms.Button(); + this.bTSyncTowerHeight = new System.Windows.Forms.Button(); + this.bTSyncMileageAndHeight = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // lBSFile + // + this.lBSFile.AutoSize = true; + this.lBSFile.Location = new System.Drawing.Point(34, 31); + this.lBSFile.Name = "lBSFile"; + this.lBSFile.Size = new System.Drawing.Size(41, 12); + this.lBSFile.TabIndex = 0; + this.lBSFile.Text = "S文件:"; + // + // tBSFile + // + this.tBSFile.Location = new System.Drawing.Point(81, 28); + this.tBSFile.Name = "tBSFile"; + this.tBSFile.Size = new System.Drawing.Size(440, 21); + this.tBSFile.TabIndex = 1; + // + // bTSFile + // + this.bTSFile.Location = new System.Drawing.Point(540, 28); + this.bTSFile.Name = "bTSFile"; + this.bTSFile.Size = new System.Drawing.Size(75, 23); + this.bTSFile.TabIndex = 2; + this.bTSFile.Text = "选择S文件"; + this.bTSFile.UseVisualStyleBackColor = true; + this.bTSFile.Click += new System.EventHandler(this.bTSFile_Click); + // + // bTDFile + // + this.bTDFile.Location = new System.Drawing.Point(540, 67); + this.bTDFile.Name = "bTDFile"; + this.bTDFile.Size = new System.Drawing.Size(75, 23); + this.bTDFile.TabIndex = 5; + this.bTDFile.Text = "选择D文件"; + this.bTDFile.UseVisualStyleBackColor = true; + this.bTDFile.Click += new System.EventHandler(this.bTDFile_Click); + // + // tBDFile + // + this.tBDFile.Location = new System.Drawing.Point(81, 67); + this.tBDFile.Name = "tBDFile"; + this.tBDFile.Size = new System.Drawing.Size(440, 21); + this.tBDFile.TabIndex = 4; + // + // lBDFile + // + this.lBDFile.AutoSize = true; + this.lBDFile.Location = new System.Drawing.Point(34, 70); + this.lBDFile.Name = "lBDFile"; + this.lBDFile.Size = new System.Drawing.Size(41, 12); + this.lBDFile.TabIndex = 3; + this.lBDFile.Text = "D文件:"; + // + // bTClearSFile + // + this.bTClearSFile.Location = new System.Drawing.Point(621, 28); + this.bTClearSFile.Name = "bTClearSFile"; + this.bTClearSFile.Size = new System.Drawing.Size(33, 23); + this.bTClearSFile.TabIndex = 6; + this.bTClearSFile.Text = "C"; + this.bTClearSFile.UseVisualStyleBackColor = true; + this.bTClearSFile.Click += new System.EventHandler(this.bTClearSFile_Click); + // + // bTClearDFile + // + this.bTClearDFile.Location = new System.Drawing.Point(621, 67); + this.bTClearDFile.Name = "bTClearDFile"; + this.bTClearDFile.Size = new System.Drawing.Size(33, 23); + this.bTClearDFile.TabIndex = 7; + this.bTClearDFile.Text = "C"; + this.bTClearDFile.UseVisualStyleBackColor = true; + this.bTClearDFile.Click += new System.EventHandler(this.bTClearDFile_Click); + // + // bTGenerateTaFile + // + this.bTGenerateTaFile.Location = new System.Drawing.Point(79, 175); + this.bTGenerateTaFile.Name = "bTGenerateTaFile"; + this.bTGenerateTaFile.Size = new System.Drawing.Size(458, 56); + this.bTGenerateTaFile.TabIndex = 8; + this.bTGenerateTaFile.Text = "生成Ta文件"; + this.bTGenerateTaFile.UseVisualStyleBackColor = true; + this.bTGenerateTaFile.Click += new System.EventHandler(this.bTGenerateTaFile_Click); + // + // bTShowMsg + // + this.bTShowMsg.Location = new System.Drawing.Point(565, 175); + this.bTShowMsg.Name = "bTShowMsg"; + this.bTShowMsg.Size = new System.Drawing.Size(73, 56); + this.bTShowMsg.TabIndex = 9; + this.bTShowMsg.Text = "显示消息窗"; + this.bTShowMsg.UseVisualStyleBackColor = true; + this.bTShowMsg.Click += new System.EventHandler(this.bTShowMsg_Click); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(621, 110); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(33, 23); + this.button1.TabIndex = 13; + this.button1.Text = "C"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // bTTaFile + // + this.bTTaFile.Location = new System.Drawing.Point(540, 110); + this.bTTaFile.Name = "bTTaFile"; + this.bTTaFile.Size = new System.Drawing.Size(75, 23); + this.bTTaFile.TabIndex = 12; + this.bTTaFile.Text = "选择TA文件"; + this.bTTaFile.UseVisualStyleBackColor = true; + this.bTTaFile.Click += new System.EventHandler(this.bTTaFile_Click); + // + // tBTaFile + // + this.tBTaFile.Location = new System.Drawing.Point(81, 110); + this.tBTaFile.Name = "tBTaFile"; + this.tBTaFile.Size = new System.Drawing.Size(440, 21); + this.tBTaFile.TabIndex = 11; + // + // lBTaFile + // + this.lBTaFile.AutoSize = true; + this.lBTaFile.Location = new System.Drawing.Point(34, 113); + this.lBTaFile.Name = "lBTaFile"; + this.lBTaFile.Size = new System.Drawing.Size(47, 12); + this.lBTaFile.TabIndex = 10; + this.lBTaFile.Text = "TA文件:"; + // + // tBSyncMileage + // + this.tBSyncMileage.Location = new System.Drawing.Point(81, 255); + this.tBSyncMileage.Name = "tBSyncMileage"; + this.tBSyncMileage.Size = new System.Drawing.Size(458, 56); + this.tBSyncMileage.TabIndex = 14; + this.tBSyncMileage.Text = "同步里程"; + this.tBSyncMileage.UseVisualStyleBackColor = true; + this.tBSyncMileage.Click += new System.EventHandler(this.bTSyncronizeMileageToS_Click); + // + // bTSyncTowerHeight + // + this.bTSyncTowerHeight.Location = new System.Drawing.Point(81, 337); + this.bTSyncTowerHeight.Name = "bTSyncTowerHeight"; + this.bTSyncTowerHeight.Size = new System.Drawing.Size(458, 56); + this.bTSyncTowerHeight.TabIndex = 15; + this.bTSyncTowerHeight.Text = "同步塔高"; + this.bTSyncTowerHeight.UseVisualStyleBackColor = true; + this.bTSyncTowerHeight.Click += new System.EventHandler(this.bTSyncTowerHeight_Click); + // + // bTSyncMileageAndHeight + // + this.bTSyncMileageAndHeight.Location = new System.Drawing.Point(545, 255); + this.bTSyncMileageAndHeight.Name = "bTSyncMileageAndHeight"; + this.bTSyncMileageAndHeight.Size = new System.Drawing.Size(70, 138); + this.bTSyncMileageAndHeight.TabIndex = 16; + this.bTSyncMileageAndHeight.Text = "同步塔型和呼高"; + this.bTSyncMileageAndHeight.UseVisualStyleBackColor = true; + this.bTSyncMileageAndHeight.Click += new System.EventHandler(this.bTSyncMileageAndHeight_Click); + // + // Win + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(673, 429); + this.Controls.Add(this.bTSyncMileageAndHeight); + this.Controls.Add(this.bTSyncTowerHeight); + this.Controls.Add(this.tBSyncMileage); + this.Controls.Add(this.button1); + this.Controls.Add(this.bTTaFile); + this.Controls.Add(this.tBTaFile); + this.Controls.Add(this.lBTaFile); + this.Controls.Add(this.bTShowMsg); + this.Controls.Add(this.bTGenerateTaFile); + this.Controls.Add(this.bTClearDFile); + this.Controls.Add(this.bTClearSFile); + this.Controls.Add(this.bTDFile); + this.Controls.Add(this.tBDFile); + this.Controls.Add(this.lBDFile); + this.Controls.Add(this.bTSFile); + this.Controls.Add(this.tBSFile); + this.Controls.Add(this.lBSFile); + this.Name = "Win"; + this.Text = "DH协同排位"; + this.Load += new System.EventHandler(this.Win_Load); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Win_FormClosing); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lBSFile; + private System.Windows.Forms.TextBox tBSFile; + private System.Windows.Forms.Button bTSFile; + private System.Windows.Forms.Button bTDFile; + private System.Windows.Forms.TextBox tBDFile; + private System.Windows.Forms.Label lBDFile; + private System.Windows.Forms.Button bTClearSFile; + private System.Windows.Forms.Button bTClearDFile; + private System.Windows.Forms.Button bTGenerateTaFile; + private System.Windows.Forms.Button bTShowMsg; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button bTTaFile; + private System.Windows.Forms.TextBox tBTaFile; + private System.Windows.Forms.Label lBTaFile; + private System.Windows.Forms.Button tBSyncMileage; + private System.Windows.Forms.Button bTSyncTowerHeight; + private System.Windows.Forms.Button bTSyncMileageAndHeight; + } +} + diff --git a/Win.cs b/Win.cs new file mode 100644 index 0000000..8378f51 --- /dev/null +++ b/Win.cs @@ -0,0 +1,170 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.IO; +using System.Diagnostics; + +namespace OrgSyncDGui +{ + public partial class Win : Form + { + private Message win_msg; + private History history; + public Win() + { + InitializeComponent(); + this.win_msg = new Message(); + + } + + private void bTSFile_Click(object sender, EventArgs e) + { + OpenFileDialog dialog = new OpenFileDialog(); + dialog.Multiselect = true; + dialog.Filter = "S files (*.dat)|*.dat"; + if (dialog.ShowDialog() == DialogResult.OK) + { + this.tBSFile.Text = String.Join(",", dialog.FileNames); + } + } + + private void bTDFile_Click(object sender, EventArgs e) + { + OpenFileDialog dialog = new OpenFileDialog(); + dialog.Multiselect = true; + dialog.Filter = "D files (*.txt)|*.txt"; + if (dialog.ShowDialog() == DialogResult.OK) + { + this.tBDFile.Text = String.Join(",", dialog.FileNames); + } + } + + private void bTClearSFile_Click(object sender, EventArgs e) + { + this.tBSFile.Text = ""; + } + + private void bTClearDFile_Click(object sender, EventArgs e) + { + this.tBDFile.Text = ""; + } + + private void bTGenerateTaFile_Click(object sender, EventArgs e) + { + SaveFileDialog dialog = new SaveFileDialog(); + dialog.Filter = "道亨TA files (*.TA)|*.TA"; + String ta_file=""; + if (dialog.ShowDialog() == DialogResult.OK) + { + ta_file=dialog.FileName; + string cmd = String.Format("{0} generate-ta-file --s_files {1} --d_files {2} --ta_file {3}", @"d:\code\OrgSyncD\cli.py", this.tBSFile.Text, this.tBDFile.Text, ta_file); + execute_cmd(cmd); + this.tBTaFile.Text = ta_file; + } + + } + + private void bTSyncronizeMileageToS_Click(object sender, EventArgs e) + { + string ta_file = this.tBTaFile.Text; + string cmd = String.Format("{0} sync-all-tower-mileage-to-s --s_files {1} --ta_file {2}", @"d:\code\OrgSyncD\cli.py", this.tBSFile.Text,ta_file); + execute_cmd(cmd); + } + + private void execute_cmd(string cmd) + { + System.Diagnostics.Process exep = new System.Diagnostics.Process(); + exep.StartInfo.FileName =@"c:\Python38\python.exe"; + exep.StartInfo.Arguments = cmd; + exep.StartInfo.CreateNoWindow = true; + exep.StartInfo.UseShellExecute = false; + exep.StartInfo.RedirectStandardOutput = true; + exep.StartInfo.RedirectStandardError = true; + exep.Start(); + exep.WaitForExit();//关键,等待外部程序退出后才能往下执行 + StreamReader reader; + reader = exep.StandardOutput; + send_msg(reader.ReadToEnd()); + send_msg(exep.StandardError.ReadToEnd()); + } + + + private void send_msg(string msg) + { + this.win_msg.Show(); + this.win_msg.tBMsg.Text=String.Format("{0}\n{1}",this.win_msg.tBMsg.Text,msg); + } + + private void bTShowMsg_Click(object sender, EventArgs e) + { + this.win_msg.Show(); + } + + private void bTTaFile_Click(object sender, EventArgs e) + { + OpenFileDialog dialog = new OpenFileDialog(); + dialog.Multiselect = true; + dialog.Filter = "TA files (*.TA)|*.TA"; + if (dialog.ShowDialog() == DialogResult.OK) + { + this.tBTaFile.Text = String.Join(",", dialog.FileNames); + } + } + + private void bTSyncTowerHeight_Click(object sender, EventArgs e) + { + string ta_file = this.tBTaFile.Text; + string cmd = String.Format("{0} sync-all-tower-height-from-ta-to-s --s_files {1} --ta_file {2}", @"d:\code\OrgSyncD\cli.py", this.tBSFile.Text, ta_file); + execute_cmd(cmd); + } + + private void Win_Load(object sender, EventArgs e) + { + //加载历史记录 + var process = Process.GetCurrentProcess(); + string fullPath = process.MainModule.FileName; + string jsonFilePath=String.Format(@"{0}\history.json",Directory.GetParent(fullPath).ToString()); + this.history = new History(jsonFilePath); + this.history.load(); + if (this.history.history.ContainsKey("DFiles")) + { + this.tBDFile.Text = this.history.history["DFiles"]; + } + if (this.history.history.ContainsKey("SFiles")) + { + this.tBSFile.Text = this.history.history["SFiles"]; + } + if (this.history.history.ContainsKey("TaFile")) + { + this.tBTaFile.Text = this.history.history["TaFile"]; + } + + } + + private void Win_FormClosing(object sender, FormClosingEventArgs e) + { + this.history.history["DFiles"]=this.tBDFile.Text; + this.history.history["SFiles"]=this.tBSFile.Text; + this.history.history["TaFile"]=this.tBTaFile.Text; + this.history.save(); + } + + private void button1_Click(object sender, EventArgs e) + { + this.tBTaFile.Text = ""; + } + + private void bTSyncMileageAndHeight_Click(object sender, EventArgs e) + { + this.bTSyncTowerHeight_Click(null, null); + bTSyncronizeMileageToS_Click(null, null); + + } + + } +} diff --git a/Win.resx b/Win.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/Win.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file