From 3f6242a158f42222bdf55785e5b72b271e4997e1 Mon Sep 17 00:00:00 2001 From: Tobin Crone Date: Mon, 13 Nov 2017 13:47:55 -0500 Subject: [PATCH 1/4] Safe basic commit Simple stringSend method addition. --- .../BTConnectionService.csproj | 1 + .../BTConnectionService/utils/KeySend.cs | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 BTConnectionService/BTConnectionService/utils/KeySend.cs diff --git a/BTConnectionService/BTConnectionService/BTConnectionService.csproj b/BTConnectionService/BTConnectionService/BTConnectionService.csproj index 4ec4d1f..a4df9e3 100644 --- a/BTConnectionService/BTConnectionService/BTConnectionService.csproj +++ b/BTConnectionService/BTConnectionService/BTConnectionService.csproj @@ -68,6 +68,7 @@ + diff --git a/BTConnectionService/BTConnectionService/utils/KeySend.cs b/BTConnectionService/BTConnectionService/utils/KeySend.cs new file mode 100644 index 0000000..d8968ce --- /dev/null +++ b/BTConnectionService/BTConnectionService/utils/KeySend.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using winRemoteDataBase.Model; + +namespace BTConnectionService +{ + class KeySend + { + public void stringSend(string str) + { + Log.write("stringSend to focused application; value: " + str); + SendKeys.Send(str); + } + + public void buttonSend(DBButton dbBtn) + { + + + } + } +} From ab77c702e0a8e75dcb6630291a2bde0267149b39 Mon Sep 17 00:00:00 2001 From: Tobin Crone Date: Mon, 27 Nov 2017 19:12:42 -0500 Subject: [PATCH 2/4] basic macro creation dataview and macro creation working. --- BTConnectionService/BTConnectionService.sln | 6 + .../WinRemoteDesktop_Test/App.config | 27 +++ .../WinRemoteDesktop_Test/DBHelper.cs | 105 +++++++++++ .../WinRemoteDesktop_Test/Form1.Designer.cs | 171 ++++++++++++++++++ .../WinRemoteDesktop_Test/Form1.cs | 77 ++++++++ .../WinRemoteDesktop_Test/Form1.resx | 123 +++++++++++++ .../WinRemoteDesktop_Test/Program.cs | 22 +++ .../Properties/AssemblyInfo.cs | 36 ++++ .../Properties/Resources.Designer.cs | 71 ++++++++ .../Properties/Resources.resx | 117 ++++++++++++ .../Properties/Settings.Designer.cs | 30 +++ .../Properties/Settings.settings | 7 + .../WinRemoteDesktop_Test.csproj | 145 +++++++++++++++ .../WinRemoteDesktop_Test/packages.config | 10 + 14 files changed, 947 insertions(+) create mode 100644 BTConnectionService/WinRemoteDesktop_Test/App.config create mode 100644 BTConnectionService/WinRemoteDesktop_Test/DBHelper.cs create mode 100644 BTConnectionService/WinRemoteDesktop_Test/Form1.Designer.cs create mode 100644 BTConnectionService/WinRemoteDesktop_Test/Form1.cs create mode 100644 BTConnectionService/WinRemoteDesktop_Test/Form1.resx create mode 100644 BTConnectionService/WinRemoteDesktop_Test/Program.cs create mode 100644 BTConnectionService/WinRemoteDesktop_Test/Properties/AssemblyInfo.cs create mode 100644 BTConnectionService/WinRemoteDesktop_Test/Properties/Resources.Designer.cs create mode 100644 BTConnectionService/WinRemoteDesktop_Test/Properties/Resources.resx create mode 100644 BTConnectionService/WinRemoteDesktop_Test/Properties/Settings.Designer.cs create mode 100644 BTConnectionService/WinRemoteDesktop_Test/Properties/Settings.settings create mode 100644 BTConnectionService/WinRemoteDesktop_Test/WinRemoteDesktop_Test.csproj create mode 100644 BTConnectionService/WinRemoteDesktop_Test/packages.config diff --git a/BTConnectionService/BTConnectionService.sln b/BTConnectionService/BTConnectionService.sln index 2607579..1910540 100644 --- a/BTConnectionService/BTConnectionService.sln +++ b/BTConnectionService/BTConnectionService.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 15.0.26730.16 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BTConnectionService", "BTConnectionService\BTConnectionService.csproj", "{2488A216-B753-42BB-A3DC-48B3DAB02B24}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinRemoteDesktop_Test", "WinRemoteDesktop_Test\WinRemoteDesktop_Test.csproj", "{DB80291E-30EE-4A3C-8774-80508595DF2E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {2488A216-B753-42BB-A3DC-48B3DAB02B24}.Debug|Any CPU.Build.0 = Debug|Any CPU {2488A216-B753-42BB-A3DC-48B3DAB02B24}.Release|Any CPU.ActiveCfg = Release|Any CPU {2488A216-B753-42BB-A3DC-48B3DAB02B24}.Release|Any CPU.Build.0 = Release|Any CPU + {DB80291E-30EE-4A3C-8774-80508595DF2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB80291E-30EE-4A3C-8774-80508595DF2E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB80291E-30EE-4A3C-8774-80508595DF2E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB80291E-30EE-4A3C-8774-80508595DF2E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/BTConnectionService/WinRemoteDesktop_Test/App.config b/BTConnectionService/WinRemoteDesktop_Test/App.config new file mode 100644 index 0000000..06266c8 --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/App.config @@ -0,0 +1,27 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BTConnectionService/WinRemoteDesktop_Test/DBHelper.cs b/BTConnectionService/WinRemoteDesktop_Test/DBHelper.cs new file mode 100644 index 0000000..30fe8e5 --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/DBHelper.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.IO; +using SQLite.Net.Platform.Generic; +using System.Data.SQLite; +using System.Data; + +namespace WinRemoteDesktop_Test +{ + class DBHelper + { + private const string DB_PATH = "C:\\Users\\Tobin\\Desktop\\winremote_db.sqlite"; + public static Dictionary codelib; + public static void CreateDatabase() + { + if (!File.Exists(DB_PATH)) + { + SQLiteConnection.CreateFile(DB_PATH); + buildStockDB(); + } + else + { + //DB already exists. + } + } + + public static void buildStockDB() + { + string macroTable = "CREATE TABLE WR_MACRO(mc_ID INTEGER PRIMARY KEY AUTOINCREMENT, mc_description VARCHAR(2000), mc_command VARCHAR(2000), mc_tag VARCHAR(2000))"; + string buttonTable = "CREATE TABLE WR_BUTTON(btn_ID INTEGER PRIMARY KEY AUTOINCREMENT, btn_mc_ID INT, btn_description VARCHAR(2000))"; + string keycodeTable = "CREATE TABLE WR_KEYCODE(kc_ID INTEGER PRIMARY KEY AUTOINCREMENT, kc_value VARCHAR(2000), kc_description VARCHAR(2000), kc_switch INT)"; + var conn = new SQLiteConnection("Data Source=" + DB_PATH + ";Version=3;"); + conn.Open(); + + SQLiteCommand cmd = new SQLiteCommand(macroTable, conn); + cmd.ExecuteNonQuery(); + cmd.CommandText = keycodeTable; + cmd.ExecuteNonQuery(); + cmd.CommandText = buttonTable; + cmd.ExecuteNonQuery(); + } + + public static void addKeyCodes(string code) + { + string query = "INSERT INTO WR_KEYCODE(kc_value, kc_description, kc_switch) VALUES('"+ code +"','ctrl key',1)"; + var conn = new SQLiteConnection("Data Source=" + DB_PATH + ";Version=3;"); + conn.Open(); + SQLiteCommand cmd = new SQLiteCommand(query, conn); + cmd.ExecuteNonQuery(); + conn.Close(); + } + + public static DataSet grabDataset(string table) + { + string sql = "Select * from " + table; + var conn = new SQLiteConnection("Data Source=" + DB_PATH + ";Version=3;"); + + DataSet ds = new DataSet(); + try + { + conn.Open(); + var da = new SQLiteDataAdapter(sql, conn); + da.Fill(ds); + } + catch (Exception) + { + throw; + } + conn.Close(); + return ds; + } + + public static void createSimpleMacro(string macro, string tag, string description) + { + string insert = "INSERT INTO WR_MACRO(mc_description, mc_command, mc_tag) VALUES('"+description+"','"+macro+"','"+tag+"')"; + var conn = new SQLiteConnection("Data Source=" + DB_PATH + ";Version=3;"); + conn.Open(); + SQLiteCommand cmd = new SQLiteCommand(insert, conn); + cmd.ExecuteNonQuery(); + conn.Close(); + } + + public static void createSimpleButton() + { + //string insert = "INSERT INTO WR_MACRO(mc_description, mc_command, mc_tag) VALUES('" + description + "','" + macro + "','" + tag + "')"; + //var conn = new SQLiteConnection("Data Source=" + DB_PATH + ";Version=3;"); + //conn.Open(); + //SQLiteCommand cmd = new SQLiteCommand(insert, conn); + //cmd.ExecuteNonQuery(); + //conn.Close(); + } + + public static Dictionary buildLibrary() + { + codelib = new Dictionary(); + + return codelib; + } + + + } +} diff --git a/BTConnectionService/WinRemoteDesktop_Test/Form1.Designer.cs b/BTConnectionService/WinRemoteDesktop_Test/Form1.Designer.cs new file mode 100644 index 0000000..ecae4e3 --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/Form1.Designer.cs @@ -0,0 +1,171 @@ +namespace WinRemoteDesktop_Test +{ + partial class Form1 + { + /// + /// 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.submitMacroBtn = new System.Windows.Forms.Button(); + this.macroTxtBox = new System.Windows.Forms.TextBox(); + this.macroDataGrid = new System.Windows.Forms.DataGridView(); + this.buttonDataGrid = new System.Windows.Forms.DataGridView(); + this.keycodeDataGrid = new System.Windows.Forms.DataGridView(); + this.tagCombo = new System.Windows.Forms.ComboBox(); + this.cmdLabel = new System.Windows.Forms.Label(); + this.descLabel = new System.Windows.Forms.Label(); + this.descTxtBox = new System.Windows.Forms.TextBox(); + ((System.ComponentModel.ISupportInitialize)(this.macroDataGrid)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.buttonDataGrid)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.keycodeDataGrid)).BeginInit(); + this.SuspendLayout(); + // + // submitMacroBtn + // + this.submitMacroBtn.Location = new System.Drawing.Point(12, 332); + this.submitMacroBtn.Name = "submitMacroBtn"; + this.submitMacroBtn.Size = new System.Drawing.Size(91, 23); + this.submitMacroBtn.TabIndex = 0; + this.submitMacroBtn.Text = "Submit"; + this.submitMacroBtn.UseVisualStyleBackColor = true; + this.submitMacroBtn.Click += new System.EventHandler(this.submitMacroBtn_Click); + // + // macroTxtBox + // + this.macroTxtBox.Location = new System.Drawing.Point(5, 68); + this.macroTxtBox.Name = "macroTxtBox"; + this.macroTxtBox.Size = new System.Drawing.Size(111, 20); + this.macroTxtBox.TabIndex = 1; + this.macroTxtBox.Visible = false; + this.macroTxtBox.TextChanged += new System.EventHandler(this.macroTxtBox_TextChanged); + // + // macroDataGrid + // + this.macroDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.macroDataGrid.Location = new System.Drawing.Point(129, 12); + this.macroDataGrid.Name = "macroDataGrid"; + this.macroDataGrid.Size = new System.Drawing.Size(298, 343); + this.macroDataGrid.TabIndex = 2; + this.macroDataGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.macroDataGrid_CellContentClick); + // + // buttonDataGrid + // + this.buttonDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.buttonDataGrid.Location = new System.Drawing.Point(434, 12); + this.buttonDataGrid.Name = "buttonDataGrid"; + this.buttonDataGrid.Size = new System.Drawing.Size(295, 343); + this.buttonDataGrid.TabIndex = 3; + this.buttonDataGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.buttonDataGrid_CellContentClick); + // + // keycodeDataGrid + // + this.keycodeDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.keycodeDataGrid.Location = new System.Drawing.Point(735, 12); + this.keycodeDataGrid.Name = "keycodeDataGrid"; + this.keycodeDataGrid.Size = new System.Drawing.Size(295, 343); + this.keycodeDataGrid.TabIndex = 4; + this.keycodeDataGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.keycodeDataGrid_CellContentClick); + // + // tagCombo + // + this.tagCombo.FormattingEnabled = true; + this.tagCombo.Items.AddRange(new object[] { + "String", + "Python", + "Windows Shortcut"}); + this.tagCombo.Location = new System.Drawing.Point(2, 19); + this.tagCombo.Name = "tagCombo"; + this.tagCombo.Size = new System.Drawing.Size(121, 21); + this.tagCombo.TabIndex = 5; + this.tagCombo.SelectedIndexChanged += new System.EventHandler(this.tagCombo_SelectedIndexChanged); + // + // cmdLabel + // + this.cmdLabel.AutoSize = true; + this.cmdLabel.Location = new System.Drawing.Point(2, 52); + this.cmdLabel.Name = "cmdLabel"; + this.cmdLabel.Size = new System.Drawing.Size(54, 13); + this.cmdLabel.TabIndex = 6; + this.cmdLabel.Text = "Command"; + this.cmdLabel.Visible = false; + // + // descLabel + // + this.descLabel.AutoSize = true; + this.descLabel.Location = new System.Drawing.Point(2, 111); + this.descLabel.Name = "descLabel"; + this.descLabel.Size = new System.Drawing.Size(60, 13); + this.descLabel.TabIndex = 7; + this.descLabel.Text = "Description"; + this.descLabel.Visible = false; + // + // descTxtBox + // + this.descTxtBox.Location = new System.Drawing.Point(5, 127); + this.descTxtBox.Multiline = true; + this.descTxtBox.Name = "descTxtBox"; + this.descTxtBox.Size = new System.Drawing.Size(111, 86); + this.descTxtBox.TabIndex = 8; + this.descTxtBox.Visible = false; + this.descTxtBox.TextChanged += new System.EventHandler(this.descTxtBox_TextChanged); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1038, 367); + this.Controls.Add(this.descTxtBox); + this.Controls.Add(this.descLabel); + this.Controls.Add(this.cmdLabel); + this.Controls.Add(this.tagCombo); + this.Controls.Add(this.keycodeDataGrid); + this.Controls.Add(this.buttonDataGrid); + this.Controls.Add(this.macroDataGrid); + this.Controls.Add(this.macroTxtBox); + this.Controls.Add(this.submitMacroBtn); + this.Name = "Form1"; + this.Text = "Form1"; + ((System.ComponentModel.ISupportInitialize)(this.macroDataGrid)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.buttonDataGrid)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.keycodeDataGrid)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button submitMacroBtn; + private System.Windows.Forms.TextBox macroTxtBox; + private System.Windows.Forms.DataGridView macroDataGrid; + private System.Windows.Forms.DataGridView buttonDataGrid; + private System.Windows.Forms.DataGridView keycodeDataGrid; + private System.Windows.Forms.ComboBox tagCombo; + private System.Windows.Forms.Label cmdLabel; + private System.Windows.Forms.Label descLabel; + private System.Windows.Forms.TextBox descTxtBox; + } +} + diff --git a/BTConnectionService/WinRemoteDesktop_Test/Form1.cs b/BTConnectionService/WinRemoteDesktop_Test/Form1.cs new file mode 100644 index 0000000..91d6c74 --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/Form1.cs @@ -0,0 +1,77 @@ +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 WinRemoteDesktop_Test +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + DBHelper.CreateDatabase(); + //DBHelper.buildStockDB(); + //DBHelper.addKeyCodes(""); + fillDataGrids(); + } + + private void macroTxtBox_TextChanged(object sender, EventArgs e) + { + } + + private void submitMacroBtn_Click(object sender, EventArgs e) + { + string macroFromTxt = macroTxtBox.Text; + string tag = tagCombo.Text; + string description = descTxtBox.Text; + DBHelper.createSimpleMacro(macroFromTxt, tag, description); + //DBHelper.addKeyCodes(macroFromTxt); + macroTxtBox.Clear(); + descTxtBox.Clear(); + fillDataGrids(); + + } + + private void macroDataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + } + + private void buttonDataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + } + + private void keycodeDataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + } + + private void fillDataGrids() + { + macroDataGrid.DataSource = DBHelper.grabDataset("WR_MACRO").Tables[0].DefaultView; + keycodeDataGrid.DataSource = DBHelper.grabDataset("WR_KEYCODE").Tables[0].DefaultView; + buttonDataGrid.DataSource = DBHelper.grabDataset("WR_Button").Tables[0].DefaultView; + } + + private void descTxtBox_TextChanged(object sender, EventArgs e) + { + + } + + private void tagCombo_SelectedIndexChanged(object sender, EventArgs e) + { + if(tagCombo.Text == "String") + { + cmdLabel.Visible = true; + macroTxtBox.Visible = true; + descLabel.Visible = true; + descTxtBox.Visible = true; + } + + } + } +} diff --git a/BTConnectionService/WinRemoteDesktop_Test/Form1.resx b/BTConnectionService/WinRemoteDesktop_Test/Form1.resx new file mode 100644 index 0000000..743f7a9 --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/Form1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + \ No newline at end of file diff --git a/BTConnectionService/WinRemoteDesktop_Test/Program.cs b/BTConnectionService/WinRemoteDesktop_Test/Program.cs new file mode 100644 index 0000000..ebb3cb9 --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace WinRemoteDesktop_Test +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/BTConnectionService/WinRemoteDesktop_Test/Properties/AssemblyInfo.cs b/BTConnectionService/WinRemoteDesktop_Test/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..bfc30e8 --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/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("WinRemoteDesktop_Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WinRemoteDesktop_Test")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[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("db80291e-30ee-4a3c-8774-80508595df2e")] + +// 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/BTConnectionService/WinRemoteDesktop_Test/Properties/Resources.Designer.cs b/BTConnectionService/WinRemoteDesktop_Test/Properties/Resources.Designer.cs new file mode 100644 index 0000000..932c064 --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WinRemoteDesktop_Test.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", "4.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("WinRemoteDesktop_Test.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/BTConnectionService/WinRemoteDesktop_Test/Properties/Resources.resx b/BTConnectionService/WinRemoteDesktop_Test/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/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/BTConnectionService/WinRemoteDesktop_Test/Properties/Settings.Designer.cs b/BTConnectionService/WinRemoteDesktop_Test/Properties/Settings.Designer.cs new file mode 100644 index 0000000..bff87eb --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WinRemoteDesktop_Test.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.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/BTConnectionService/WinRemoteDesktop_Test/Properties/Settings.settings b/BTConnectionService/WinRemoteDesktop_Test/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/BTConnectionService/WinRemoteDesktop_Test/WinRemoteDesktop_Test.csproj b/BTConnectionService/WinRemoteDesktop_Test/WinRemoteDesktop_Test.csproj new file mode 100644 index 0000000..110186a --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/WinRemoteDesktop_Test.csproj @@ -0,0 +1,145 @@ + + + + + Debug + AnyCPU + {DB80291E-30EE-4A3C-8774-80508595DF2E} + WinExe + WinRemoteDesktop_Test + WinRemoteDesktop_Test + v4.6.1 + 512 + true + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll + + + ..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll + + + ..\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll + + + ..\packages\SQLite.Net-PCL.3.1.1\lib\net40\SQLite.Net.Platform.Generic.dll + + + ..\packages\SQLite.Net-PCL.3.1.1\lib\net4\SQLite.Net.Platform.Win32.dll + + + + + + ..\packages\System.Data.SQLite.Core.1.0.106.0\lib\net46\System.Data.SQLite.dll + + + ..\packages\System.Data.SQLite.EF6.1.0.106.0\lib\net46\System.Data.SQLite.EF6.dll + + + ..\packages\System.Data.SQLite.Linq.1.0.106.0\lib\net46\System.Data.SQLite.Linq.dll + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + False + Microsoft .NET Framework 4.6.1 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/BTConnectionService/WinRemoteDesktop_Test/packages.config b/BTConnectionService/WinRemoteDesktop_Test/packages.config new file mode 100644 index 0000000..9c1db58 --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/packages.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file From d16093bc15ebd35266ea26713444b3bf7d2f0298 Mon Sep 17 00:00:00 2001 From: Tobin Crone Date: Thu, 30 Nov 2017 03:49:57 -0500 Subject: [PATCH 3/4] working button add button add works. --- .../ButtonForm.Designer.cs | 174 ++++++++++++++++++ .../WinRemoteDesktop_Test/ButtonForm.cs | 108 +++++++++++ .../WinRemoteDesktop_Test/ButtonForm.resx | 120 ++++++++++++ .../WinRemoteDesktop_Test/DBHelper.cs | 33 +++- .../WinRemoteDesktop_Test/Form1.Designer.cs | 5 +- .../WinRemoteDesktop_Test/Form1.cs | 38 +++- .../HomeScreen.Designer.cs | 166 +++++++++++++++++ .../WinRemoteDesktop_Test/HomeScreen.cs | 94 ++++++++++ .../WinRemoteDesktop_Test/HomeScreen.resx | 135 ++++++++++++++ .../MacroForm.Designer.cs | 47 +++++ .../WinRemoteDesktop_Test/MacroForm.cs | 25 +++ .../WinRemoteDesktop_Test/MacroForm.resx | 120 ++++++++++++ .../WinRemoteDesktop_Test/Program.cs | 3 +- .../WinRemoteDesktop_Test.csproj | 27 +++ 14 files changed, 1079 insertions(+), 16 deletions(-) create mode 100644 BTConnectionService/WinRemoteDesktop_Test/ButtonForm.Designer.cs create mode 100644 BTConnectionService/WinRemoteDesktop_Test/ButtonForm.cs create mode 100644 BTConnectionService/WinRemoteDesktop_Test/ButtonForm.resx create mode 100644 BTConnectionService/WinRemoteDesktop_Test/HomeScreen.Designer.cs create mode 100644 BTConnectionService/WinRemoteDesktop_Test/HomeScreen.cs create mode 100644 BTConnectionService/WinRemoteDesktop_Test/HomeScreen.resx create mode 100644 BTConnectionService/WinRemoteDesktop_Test/MacroForm.Designer.cs create mode 100644 BTConnectionService/WinRemoteDesktop_Test/MacroForm.cs create mode 100644 BTConnectionService/WinRemoteDesktop_Test/MacroForm.resx diff --git a/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.Designer.cs b/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.Designer.cs new file mode 100644 index 0000000..a4557af --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.Designer.cs @@ -0,0 +1,174 @@ +namespace WinRemoteDesktop_Test +{ + partial class ButtonForm + { + /// + /// 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.macroDataGrid = new System.Windows.Forms.DataGridView(); + this.addMacroBtn = new System.Windows.Forms.Button(); + this.btnTempDataGrid = new System.Windows.Forms.DataGridView(); + this.saveBtn = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.removeMacroBtn = new System.Windows.Forms.Button(); + this.descTxtBox = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.macroDataGrid)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.btnTempDataGrid)).BeginInit(); + this.SuspendLayout(); + // + // macroDataGrid + // + this.macroDataGrid.AllowUserToAddRows = false; + this.macroDataGrid.AllowUserToDeleteRows = false; + this.macroDataGrid.AllowUserToResizeColumns = false; + this.macroDataGrid.AllowUserToResizeRows = false; + this.macroDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.macroDataGrid.Location = new System.Drawing.Point(12, 34); + this.macroDataGrid.MultiSelect = false; + this.macroDataGrid.Name = "macroDataGrid"; + this.macroDataGrid.ReadOnly = true; + this.macroDataGrid.Size = new System.Drawing.Size(298, 415); + this.macroDataGrid.TabIndex = 4; + this.macroDataGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.macroDataGrid_CellContentClick); + // + // addMacroBtn + // + this.addMacroBtn.Location = new System.Drawing.Point(382, 219); + this.addMacroBtn.Name = "addMacroBtn"; + this.addMacroBtn.Size = new System.Drawing.Size(121, 23); + this.addMacroBtn.TabIndex = 5; + this.addMacroBtn.Text = "Add Macro"; + this.addMacroBtn.UseVisualStyleBackColor = true; + this.addMacroBtn.Click += new System.EventHandler(this.addMacroBtn_Click); + // + // btnTempDataGrid + // + this.btnTempDataGrid.AllowUserToAddRows = false; + this.btnTempDataGrid.AllowUserToDeleteRows = false; + this.btnTempDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.btnTempDataGrid.Location = new System.Drawing.Point(574, 34); + this.btnTempDataGrid.Name = "btnTempDataGrid"; + this.btnTempDataGrid.Size = new System.Drawing.Size(298, 415); + this.btnTempDataGrid.TabIndex = 6; + this.btnTempDataGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.btnTempDataGrid_CellContentClick); + // + // saveBtn + // + this.saveBtn.Location = new System.Drawing.Point(405, 427); + this.saveBtn.Name = "saveBtn"; + this.saveBtn.Size = new System.Drawing.Size(75, 22); + this.saveBtn.TabIndex = 7; + this.saveBtn.Text = "Save Button"; + this.saveBtn.UseVisualStyleBackColor = true; + this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(125, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(72, 20); + this.label1.TabIndex = 8; + this.label1.Text = "Macros:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(670, 11); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(107, 20); + this.label2.TabIndex = 9; + this.label2.Text = "New Button:"; + // + // removeMacroBtn + // + this.removeMacroBtn.Location = new System.Drawing.Point(382, 249); + this.removeMacroBtn.Name = "removeMacroBtn"; + this.removeMacroBtn.Size = new System.Drawing.Size(121, 23); + this.removeMacroBtn.TabIndex = 10; + this.removeMacroBtn.Text = "Remove Macro"; + this.removeMacroBtn.UseVisualStyleBackColor = true; + this.removeMacroBtn.Click += new System.EventHandler(this.removeMacroBtn_Click); + // + // descTxtBox + // + this.descTxtBox.Location = new System.Drawing.Point(382, 312); + this.descTxtBox.Multiline = true; + this.descTxtBox.Name = "descTxtBox"; + this.descTxtBox.Size = new System.Drawing.Size(121, 96); + this.descTxtBox.TabIndex = 11; + this.descTxtBox.TextChanged += new System.EventHandler(this.descTxtBox_TextChanged); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(411, 296); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(63, 13); + this.label3.TabIndex = 12; + this.label3.Text = "Description:"; + // + // ButtonForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(884, 461); + this.Controls.Add(this.label3); + this.Controls.Add(this.descTxtBox); + this.Controls.Add(this.removeMacroBtn); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.saveBtn); + this.Controls.Add(this.btnTempDataGrid); + this.Controls.Add(this.addMacroBtn); + this.Controls.Add(this.macroDataGrid); + this.Name = "ButtonForm"; + this.Text = "ButtonForm"; + this.Load += new System.EventHandler(this.ButtonForm_Load); + ((System.ComponentModel.ISupportInitialize)(this.macroDataGrid)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.btnTempDataGrid)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.DataGridView macroDataGrid; + private System.Windows.Forms.Button addMacroBtn; + private System.Windows.Forms.DataGridView btnTempDataGrid; + private System.Windows.Forms.Button saveBtn; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button removeMacroBtn; + private System.Windows.Forms.TextBox descTxtBox; + private System.Windows.Forms.Label label3; + } +} \ No newline at end of file diff --git a/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.cs b/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.cs new file mode 100644 index 0000000..41fe6ff --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections; +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 WinRemoteDesktop_Test +{ + public partial class ButtonForm : Form + { + public ButtonForm() + { + InitializeComponent(); + fillDataGrids(); + + btnTempDataGrid.ColumnCount = 2; + btnTempDataGrid.Columns[0].Name = "Command ID"; + btnTempDataGrid.Columns[1].Name = "Description"; + macroDataGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + btnTempDataGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + + } + + private void macroDataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + + } + + public static void buildTempButtonGrid() + { + + } + + private void fillDataGrids() + { + macroDataGrid.DataSource = DBHelper.grabDataset("WR_Macro").Tables[0].DefaultView; + } + + private void addTempButton(string ID, string desc) + { + btnTempDataGrid.Rows.Add(ID, desc); + } + + private void btnTempDataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + + } + + private void addMacroBtn_Click(object sender, EventArgs e) + { + string ID = "", desc = ""; + + foreach(DataGridViewRow row in macroDataGrid.SelectedRows) + { + ID = row.Cells[0].Value.ToString(); + desc = row.Cells[1].Value.ToString(); + } + + addTempButton(ID, desc); + + } + + private void ButtonForm_Load(object sender, EventArgs e) + { + + } + + private void removeMacroBtn_Click(object sender, EventArgs e) + { + foreach (DataGridViewRow row in btnTempDataGrid.SelectedRows) + { + btnTempDataGrid.Rows.RemoveAt(row.Index); + } + } + + private void saveBtn_Click(object sender, EventArgs e) + { + ArrayList macroIDs = new ArrayList(); + string ID = ""; + foreach (DataGridViewRow row in btnTempDataGrid.Rows) + { + ID = row.Cells[0].Value.ToString(); + macroIDs.Add(ID); + //MessageBox.Show(ID); + } + + string csvcmd = string.Join(",", (string[])macroIDs.ToArray(Type.GetType("System.String"))); + string tag = "BTN"; + string description = descTxtBox.Text; + + DBHelper.createSimpleMacro(csvcmd, tag, "customer user button"); + string mcid = DBHelper.getNewBtnID(); + DBHelper.createSimpleButton(mcid, description); + this.Close(); + + } + + private void descTxtBox_TextChanged(object sender, EventArgs e) + { + + } + } +} diff --git a/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.resx b/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/BTConnectionService/WinRemoteDesktop_Test/DBHelper.cs b/BTConnectionService/WinRemoteDesktop_Test/DBHelper.cs index 30fe8e5..54fd907 100644 --- a/BTConnectionService/WinRemoteDesktop_Test/DBHelper.cs +++ b/BTConnectionService/WinRemoteDesktop_Test/DBHelper.cs @@ -73,6 +73,15 @@ public static DataSet grabDataset(string table) return ds; } + public static void executeQuery(string query) + { + var conn = new SQLiteConnection("Data Source=" + DB_PATH + ";Version=3;"); + conn.Open(); + SQLiteCommand cmd = new SQLiteCommand(query, conn); + cmd.ExecuteNonQuery(); + conn.Close(); + } + public static void createSimpleMacro(string macro, string tag, string description) { string insert = "INSERT INTO WR_MACRO(mc_description, mc_command, mc_tag) VALUES('"+description+"','"+macro+"','"+tag+"')"; @@ -83,14 +92,24 @@ public static void createSimpleMacro(string macro, string tag, string descriptio conn.Close(); } - public static void createSimpleButton() + public static void createSimpleButton(string mcID, string desc) + { + string insert = "INSERT INTO WR_BUTTON(btn_mc_ID, btn_description) VALUES('" + mcID + "','" + desc + "')"; + var conn = new SQLiteConnection("Data Source=" + DB_PATH + ";Version=3;"); + conn.Open(); + SQLiteCommand cmd = new SQLiteCommand(insert, conn); + cmd.ExecuteNonQuery(); + conn.Close(); + } + + public static string getNewBtnID() { - //string insert = "INSERT INTO WR_MACRO(mc_description, mc_command, mc_tag) VALUES('" + description + "','" + macro + "','" + tag + "')"; - //var conn = new SQLiteConnection("Data Source=" + DB_PATH + ";Version=3;"); - //conn.Open(); - //SQLiteCommand cmd = new SQLiteCommand(insert, conn); - //cmd.ExecuteNonQuery(); - //conn.Close(); + string query = "SELECT MAX(mc_ID) FROM WR_MACRO WHERE mc_tag = 'BTN'"; + var conn = new SQLiteConnection("Data Source=" + DB_PATH + ";Version=3;"); + conn.Open(); + SQLiteCommand cmd = new SQLiteCommand(query, conn); + string btnid = cmd.ExecuteScalar().ToString(); + return btnid; } public static Dictionary buildLibrary() diff --git a/BTConnectionService/WinRemoteDesktop_Test/Form1.Designer.cs b/BTConnectionService/WinRemoteDesktop_Test/Form1.Designer.cs index ecae4e3..2ad7706 100644 --- a/BTConnectionService/WinRemoteDesktop_Test/Form1.Designer.cs +++ b/BTConnectionService/WinRemoteDesktop_Test/Form1.Designer.cs @@ -93,8 +93,7 @@ private void InitializeComponent() this.tagCombo.FormattingEnabled = true; this.tagCombo.Items.AddRange(new object[] { "String", - "Python", - "Windows Shortcut"}); + "Button"}); this.tagCombo.Location = new System.Drawing.Point(2, 19); this.tagCombo.Name = "tagCombo"; this.tagCombo.Size = new System.Drawing.Size(121, 21); @@ -140,11 +139,11 @@ private void InitializeComponent() this.Controls.Add(this.descLabel); this.Controls.Add(this.cmdLabel); this.Controls.Add(this.tagCombo); - this.Controls.Add(this.keycodeDataGrid); this.Controls.Add(this.buttonDataGrid); this.Controls.Add(this.macroDataGrid); this.Controls.Add(this.macroTxtBox); this.Controls.Add(this.submitMacroBtn); + this.Controls.Add(this.keycodeDataGrid); this.Name = "Form1"; this.Text = "Form1"; ((System.ComponentModel.ISupportInitialize)(this.macroDataGrid)).EndInit(); diff --git a/BTConnectionService/WinRemoteDesktop_Test/Form1.cs b/BTConnectionService/WinRemoteDesktop_Test/Form1.cs index 91d6c74..56ebc0f 100644 --- a/BTConnectionService/WinRemoteDesktop_Test/Form1.cs +++ b/BTConnectionService/WinRemoteDesktop_Test/Form1.cs @@ -16,8 +16,11 @@ public Form1() { InitializeComponent(); DBHelper.CreateDatabase(); + macroDataGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + buttonDataGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; //DBHelper.buildStockDB(); //DBHelper.addKeyCodes(""); + //DBHelper.executeQuery("CREATE TABLE WR_TEMP()"); fillDataGrids(); } @@ -27,15 +30,14 @@ private void macroTxtBox_TextChanged(object sender, EventArgs e) private void submitMacroBtn_Click(object sender, EventArgs e) { - string macroFromTxt = macroTxtBox.Text; + string cmd = macroTxtBox.Text; string tag = tagCombo.Text; string description = descTxtBox.Text; - DBHelper.createSimpleMacro(macroFromTxt, tag, description); + DBHelper.createSimpleMacro(cmd, tag, description); //DBHelper.addKeyCodes(macroFromTxt); macroTxtBox.Clear(); descTxtBox.Clear(); fillDataGrids(); - } private void macroDataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) @@ -64,14 +66,40 @@ private void descTxtBox_TextChanged(object sender, EventArgs e) private void tagCombo_SelectedIndexChanged(object sender, EventArgs e) { - if(tagCombo.Text == "String") + if (tagCombo.Text == "String") + { + viewStringInterface(1); + } + else if (tagCombo.Text == "Button") + { + //Nothing yet but hide buttons. + viewStringInterface(0); + ButtonForm btnform = new ButtonForm(); + btnform.Show(); + + } + + } + + private void viewStringInterface(int bit) + { + if(bit == 0) + { + cmdLabel.Visible = false; + macroTxtBox.Visible = false; + descLabel.Visible = false; + descTxtBox.Visible = false; + submitMacroBtn.Visible = false; + } + else if(bit == 1) { cmdLabel.Visible = true; macroTxtBox.Visible = true; descLabel.Visible = true; descTxtBox.Visible = true; + submitMacroBtn.Visible = true; } - + } } } diff --git a/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.Designer.cs b/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.Designer.cs new file mode 100644 index 0000000..2ce6bcd --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.Designer.cs @@ -0,0 +1,166 @@ +using System; + +namespace WinRemoteDesktop_Test +{ + partial class HomeScreen + { + /// + /// 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() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HomeScreen)); + this.macroDataGrid = new System.Windows.Forms.DataGridView(); + this.buttonDataGrid = new System.Windows.Forms.DataGridView(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.createButtonBtn = new System.Windows.Forms.Button(); + this.deleteButtonBtn = new System.Windows.Forms.Button(); + this.createMacroBtn = new System.Windows.Forms.Button(); + this.deleteMacroBtn = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.macroDataGrid)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.buttonDataGrid)).BeginInit(); + this.SuspendLayout(); + // + // macroDataGrid + // + this.macroDataGrid.AllowUserToAddRows = false; + this.macroDataGrid.AllowUserToDeleteRows = false; + this.macroDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.macroDataGrid.Location = new System.Drawing.Point(574, 12); + this.macroDataGrid.Name = "macroDataGrid"; + this.macroDataGrid.Size = new System.Drawing.Size(298, 415); + this.macroDataGrid.TabIndex = 3; + this.macroDataGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.macroDataGrid_CellContentClick); + // + // buttonDataGrid + // + this.buttonDataGrid.AllowUserToAddRows = false; + this.buttonDataGrid.AllowUserToDeleteRows = false; + this.buttonDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.buttonDataGrid.Location = new System.Drawing.Point(12, 12); + this.buttonDataGrid.Name = "buttonDataGrid"; + this.buttonDataGrid.Size = new System.Drawing.Size(298, 415); + this.buttonDataGrid.TabIndex = 4; + this.buttonDataGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.buttonDataGrid_CellContentClick); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(354, 12); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(176, 33); + this.label1.TabIndex = 5; + this.label1.Text = "WinRemote"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(326, 158); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(233, 144); + this.label2.TabIndex = 6; + this.label2.Text = resources.GetString("label2.Text"); + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // createButtonBtn + // + this.createButtonBtn.Location = new System.Drawing.Point(12, 433); + this.createButtonBtn.Name = "createButtonBtn"; + this.createButtonBtn.Size = new System.Drawing.Size(142, 23); + this.createButtonBtn.TabIndex = 7; + this.createButtonBtn.Text = "Create Button"; + this.createButtonBtn.UseVisualStyleBackColor = true; + this.createButtonBtn.Click += new System.EventHandler(this.createButtonBtn_Click); + // + // deleteButtonBtn + // + this.deleteButtonBtn.Location = new System.Drawing.Point(168, 433); + this.deleteButtonBtn.Name = "deleteButtonBtn"; + this.deleteButtonBtn.Size = new System.Drawing.Size(142, 23); + this.deleteButtonBtn.TabIndex = 8; + this.deleteButtonBtn.Text = "Delete Button"; + this.deleteButtonBtn.UseVisualStyleBackColor = true; + this.deleteButtonBtn.Click += new System.EventHandler(this.deleteButtonBtn_Click); + // + // createMacroBtn + // + this.createMacroBtn.Location = new System.Drawing.Point(574, 433); + this.createMacroBtn.Name = "createMacroBtn"; + this.createMacroBtn.Size = new System.Drawing.Size(142, 23); + this.createMacroBtn.TabIndex = 9; + this.createMacroBtn.Text = "Create Macro"; + this.createMacroBtn.UseVisualStyleBackColor = true; + this.createMacroBtn.Click += new System.EventHandler(this.createMacroBtn_Click); + // + // deleteMacroBtn + // + this.deleteMacroBtn.Location = new System.Drawing.Point(730, 433); + this.deleteMacroBtn.Name = "deleteMacroBtn"; + this.deleteMacroBtn.Size = new System.Drawing.Size(142, 23); + this.deleteMacroBtn.TabIndex = 10; + this.deleteMacroBtn.Text = "Delete Macro"; + this.deleteMacroBtn.UseVisualStyleBackColor = true; + this.deleteMacroBtn.Click += new System.EventHandler(this.deleteMacroBtn_Click); + // + // HomeScreen + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(884, 461); + this.Controls.Add(this.deleteMacroBtn); + this.Controls.Add(this.createMacroBtn); + this.Controls.Add(this.deleteButtonBtn); + this.Controls.Add(this.createButtonBtn); + this.Controls.Add(this.label1); + this.Controls.Add(this.buttonDataGrid); + this.Controls.Add(this.macroDataGrid); + this.Controls.Add(this.label2); + this.MaximizeBox = false; + this.Name = "HomeScreen"; + this.Text = "HomeScreen"; + this.Load += new System.EventHandler(this.HomeScreen_Load); + this.Shown += new System.EventHandler(this.HomeScreen_Show); + ((System.ComponentModel.ISupportInitialize)(this.macroDataGrid)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.buttonDataGrid)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.DataGridView macroDataGrid; + private System.Windows.Forms.DataGridView buttonDataGrid; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button createButtonBtn; + private System.Windows.Forms.Button deleteButtonBtn; + private System.Windows.Forms.Button createMacroBtn; + private System.Windows.Forms.Button deleteMacroBtn; + } +} \ No newline at end of file diff --git a/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.cs b/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.cs new file mode 100644 index 0000000..2cc2a4e --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.cs @@ -0,0 +1,94 @@ +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 WinRemoteDesktop_Test +{ + public partial class HomeScreen : Form + { + public HomeScreen() + { + InitializeComponent(); + fillDataGrids(); + Form1 form = new Form1(); + form.Show(); + } + + private void fillDataGrids() + { + macroDataGrid.DataSource = DBHelper.grabDataset("WR_MACRO").Tables[0].DefaultView; + buttonDataGrid.DataSource = DBHelper.grabDataset("WR_Button").Tables[0].DefaultView; + } + + private void createButtonBtn_Click(object sender, EventArgs e) + { + ButtonForm btnform = new ButtonForm(); + btnform.Closed += (s, args) => this.Show(); + btnform.Closed += (s, args) => fillDataGrids(); + btnform.Show(); + this.Hide(); + } + + private void deleteButtonBtn_Click(object sender, EventArgs e) + { + string ID = ""; + foreach (DataGridViewRow row in buttonDataGrid.SelectedRows) + { + ID = row.Cells[0].Value.ToString(); + } + //call DBHelper with ID to delete button. + + fillDataGrids(); + } + + private void createMacroBtn_Click(object sender, EventArgs e) + { + MacroForm macroform = new MacroForm(); + macroform.Closed += (s, args) => this.Show(); + macroform.Closed += (s, args) => fillDataGrids(); + macroform.Show(); + + this.Hide(); + } + + private void deleteMacroBtn_Click(object sender, EventArgs e) + { + string ID = ""; + foreach (DataGridViewRow row in macroDataGrid.SelectedRows) + { + ID = row.Cells[0].Value.ToString(); + } + //call DBHelper with ID to delete macro. + + fillDataGrids(); + } + + private void buttonDataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + + } + + private void macroDataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + + } + + private void HomeScreen_Load(object sender, EventArgs e) + { + macroDataGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + buttonDataGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + fillDataGrids(); + } + + private void HomeScreen_Show(object sender, EventArgs e ) + { + fillDataGrids(); + } + } +} diff --git a/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.resx b/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.resx new file mode 100644 index 0000000..d818d08 --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Instructions: +Create shortcuts for windows using +the Macro Creation button to the right. +Use the Button Creator to add your +custom macros to buttons in your app. +Buttons can be assigned one or more +macros to be executed instantly. + + + + + + True + + \ No newline at end of file diff --git a/BTConnectionService/WinRemoteDesktop_Test/MacroForm.Designer.cs b/BTConnectionService/WinRemoteDesktop_Test/MacroForm.Designer.cs new file mode 100644 index 0000000..3671b9d --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/MacroForm.Designer.cs @@ -0,0 +1,47 @@ +namespace WinRemoteDesktop_Test +{ + partial class MacroForm + { + /// + /// 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.SuspendLayout(); + // + // MacroForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(884, 461); + this.Name = "MacroForm"; + this.Text = "MacroForm"; + this.Load += new System.EventHandler(this.MacroForm_Load); + this.ResumeLayout(false); + + } + + #endregion + } +} \ No newline at end of file diff --git a/BTConnectionService/WinRemoteDesktop_Test/MacroForm.cs b/BTConnectionService/WinRemoteDesktop_Test/MacroForm.cs new file mode 100644 index 0000000..6c8af73 --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/MacroForm.cs @@ -0,0 +1,25 @@ +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 WinRemoteDesktop_Test +{ + public partial class MacroForm : Form + { + public MacroForm() + { + InitializeComponent(); + } + + private void MacroForm_Load(object sender, EventArgs e) + { + + } + } +} diff --git a/BTConnectionService/WinRemoteDesktop_Test/MacroForm.resx b/BTConnectionService/WinRemoteDesktop_Test/MacroForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/BTConnectionService/WinRemoteDesktop_Test/MacroForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/BTConnectionService/WinRemoteDesktop_Test/Program.cs b/BTConnectionService/WinRemoteDesktop_Test/Program.cs index ebb3cb9..b6be4d8 100644 --- a/BTConnectionService/WinRemoteDesktop_Test/Program.cs +++ b/BTConnectionService/WinRemoteDesktop_Test/Program.cs @@ -16,7 +16,8 @@ static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); + //Application.Run(new Form1()); + Application.Run(new HomeScreen()); } } } diff --git a/BTConnectionService/WinRemoteDesktop_Test/WinRemoteDesktop_Test.csproj b/BTConnectionService/WinRemoteDesktop_Test/WinRemoteDesktop_Test.csproj index 110186a..f0eeb5b 100644 --- a/BTConnectionService/WinRemoteDesktop_Test/WinRemoteDesktop_Test.csproj +++ b/BTConnectionService/WinRemoteDesktop_Test/WinRemoteDesktop_Test.csproj @@ -87,6 +87,12 @@ + + Form + + + ButtonForm.cs + Form @@ -94,11 +100,32 @@ Form1.cs + + Form + + + HomeScreen.cs + + + Form + + + MacroForm.cs + + + ButtonForm.cs + Form1.cs + + HomeScreen.cs + + + MacroForm.cs + ResXFileCodeGenerator Resources.Designer.cs From 386a3f3c299884617a57c3c3782c818f520ac2a9 Mon Sep 17 00:00:00 2001 From: Tobin Crone Date: Thu, 30 Nov 2017 12:05:30 -0500 Subject: [PATCH 4/4] My stuff Working macro and button creation. Missing a few things. Stock database is populated with just a few simple macros. ctrl-c, ctrl-v, ctrl-a, alt-tab. you can create a button that string them together to do multiple functions. --- .../ButtonForm.Designer.cs | 4 +- .../WinRemoteDesktop_Test/ButtonForm.cs | 15 ---- .../WinRemoteDesktop_Test/DBHelper.cs | 13 ++- .../HomeScreen.Designer.cs | 2 + .../WinRemoteDesktop_Test/HomeScreen.cs | 6 +- .../MacroForm.Designer.cs | 89 +++++++++++++++++++ .../WinRemoteDesktop_Test/MacroForm.cs | 37 ++++++++ 7 files changed, 145 insertions(+), 21 deletions(-) diff --git a/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.Designer.cs b/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.Designer.cs index a4557af..243c3d6 100644 --- a/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.Designer.cs +++ b/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.Designer.cs @@ -54,7 +54,7 @@ private void InitializeComponent() this.macroDataGrid.ReadOnly = true; this.macroDataGrid.Size = new System.Drawing.Size(298, 415); this.macroDataGrid.TabIndex = 4; - this.macroDataGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.macroDataGrid_CellContentClick); + //this.macroDataGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.macroDataGrid_CellContentClick); // // addMacroBtn // @@ -75,7 +75,7 @@ private void InitializeComponent() this.btnTempDataGrid.Name = "btnTempDataGrid"; this.btnTempDataGrid.Size = new System.Drawing.Size(298, 415); this.btnTempDataGrid.TabIndex = 6; - this.btnTempDataGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.btnTempDataGrid_CellContentClick); + //this.btnTempDataGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.btnTempDataGrid_CellContentClick); // // saveBtn // diff --git a/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.cs b/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.cs index 41fe6ff..9897c8b 100644 --- a/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.cs +++ b/BTConnectionService/WinRemoteDesktop_Test/ButtonForm.cs @@ -26,16 +26,6 @@ public ButtonForm() } - private void macroDataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) - { - - } - - public static void buildTempButtonGrid() - { - - } - private void fillDataGrids() { macroDataGrid.DataSource = DBHelper.grabDataset("WR_Macro").Tables[0].DefaultView; @@ -46,11 +36,6 @@ private void addTempButton(string ID, string desc) btnTempDataGrid.Rows.Add(ID, desc); } - private void btnTempDataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) - { - - } - private void addMacroBtn_Click(object sender, EventArgs e) { string ID = "", desc = ""; diff --git a/BTConnectionService/WinRemoteDesktop_Test/DBHelper.cs b/BTConnectionService/WinRemoteDesktop_Test/DBHelper.cs index 54fd907..d8bfaf7 100644 --- a/BTConnectionService/WinRemoteDesktop_Test/DBHelper.cs +++ b/BTConnectionService/WinRemoteDesktop_Test/DBHelper.cs @@ -20,6 +20,7 @@ public static void CreateDatabase() { SQLiteConnection.CreateFile(DB_PATH); buildStockDB(); + createStockMacros(); } else { @@ -65,9 +66,11 @@ public static DataSet grabDataset(string table) var da = new SQLiteDataAdapter(sql, conn); da.Fill(ds); } - catch (Exception) + catch (Exception e) { + Console.WriteLine(e.StackTrace); throw; + } conn.Close(); return ds; @@ -119,6 +122,12 @@ public static Dictionary buildLibrary() return codelib; } - + public static void createStockMacros() + { + createSimpleMacro("^C","Win","Ctrl-C"); + createSimpleMacro("^V", "Win", "Ctrl-V"); + createSimpleMacro("^A", "Win", "Ctrl-A"); + createSimpleMacro("&{TAB}", "Win", "Alt-Tab"); + } } } diff --git a/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.Designer.cs b/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.Designer.cs index 2ce6bcd..53ecc99 100644 --- a/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.Designer.cs +++ b/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.Designer.cs @@ -105,6 +105,7 @@ private void InitializeComponent() this.deleteButtonBtn.TabIndex = 8; this.deleteButtonBtn.Text = "Delete Button"; this.deleteButtonBtn.UseVisualStyleBackColor = true; + this.deleteButtonBtn.Visible = false; this.deleteButtonBtn.Click += new System.EventHandler(this.deleteButtonBtn_Click); // // createMacroBtn @@ -125,6 +126,7 @@ private void InitializeComponent() this.deleteMacroBtn.TabIndex = 10; this.deleteMacroBtn.Text = "Delete Macro"; this.deleteMacroBtn.UseVisualStyleBackColor = true; + this.deleteMacroBtn.Visible = false; this.deleteMacroBtn.Click += new System.EventHandler(this.deleteMacroBtn_Click); // // HomeScreen diff --git a/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.cs b/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.cs index 2cc2a4e..66ea782 100644 --- a/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.cs +++ b/BTConnectionService/WinRemoteDesktop_Test/HomeScreen.cs @@ -15,9 +15,10 @@ public partial class HomeScreen : Form public HomeScreen() { InitializeComponent(); + DBHelper.CreateDatabase(); fillDataGrids(); - Form1 form = new Form1(); - form.Show(); + //Form1 form = new Form1(); + //form.Show(); } private void fillDataGrids() @@ -83,6 +84,7 @@ private void HomeScreen_Load(object sender, EventArgs e) { macroDataGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; buttonDataGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + DBHelper.CreateDatabase(); fillDataGrids(); } diff --git a/BTConnectionService/WinRemoteDesktop_Test/MacroForm.Designer.cs b/BTConnectionService/WinRemoteDesktop_Test/MacroForm.Designer.cs index 3671b9d..1ea0c0b 100644 --- a/BTConnectionService/WinRemoteDesktop_Test/MacroForm.Designer.cs +++ b/BTConnectionService/WinRemoteDesktop_Test/MacroForm.Designer.cs @@ -28,20 +28,109 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.descTxtBox = new System.Windows.Forms.TextBox(); + this.descLabel = new System.Windows.Forms.Label(); + this.cmdLabel = new System.Windows.Forms.Label(); + this.tagCombo = new System.Windows.Forms.ComboBox(); + this.macroTxtBox = new System.Windows.Forms.TextBox(); + this.submitMacroBtn = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); this.SuspendLayout(); // + // descTxtBox + // + this.descTxtBox.Location = new System.Drawing.Point(383, 253); + this.descTxtBox.Multiline = true; + this.descTxtBox.Name = "descTxtBox"; + this.descTxtBox.Size = new System.Drawing.Size(121, 86); + this.descTxtBox.TabIndex = 14; + this.descTxtBox.TextChanged += new System.EventHandler(this.descTxtBox_TextChanged); + // + // descLabel + // + this.descLabel.AutoSize = true; + this.descLabel.Location = new System.Drawing.Point(383, 237); + this.descLabel.Name = "descLabel"; + this.descLabel.Size = new System.Drawing.Size(60, 13); + this.descLabel.TabIndex = 13; + this.descLabel.Text = "Description"; + // + // cmdLabel + // + this.cmdLabel.AutoSize = true; + this.cmdLabel.Location = new System.Drawing.Point(383, 123); + this.cmdLabel.Name = "cmdLabel"; + this.cmdLabel.Size = new System.Drawing.Size(54, 13); + this.cmdLabel.TabIndex = 12; + this.cmdLabel.Text = "Command"; + // + // tagCombo + // + this.tagCombo.FormattingEnabled = true; + this.tagCombo.Items.AddRange(new object[] { + "String", + "Button"}); + this.tagCombo.Location = new System.Drawing.Point(383, 25); + this.tagCombo.Name = "tagCombo"; + this.tagCombo.Size = new System.Drawing.Size(121, 21); + this.tagCombo.TabIndex = 11; + this.tagCombo.SelectedIndexChanged += new System.EventHandler(this.tagCombo_SelectedIndexChanged); + // + // macroTxtBox + // + this.macroTxtBox.Location = new System.Drawing.Point(383, 139); + this.macroTxtBox.Name = "macroTxtBox"; + this.macroTxtBox.Size = new System.Drawing.Size(121, 20); + this.macroTxtBox.TabIndex = 10; + this.macroTxtBox.TextChanged += new System.EventHandler(this.macroTxtBox_TextChanged); + // + // submitMacroBtn + // + this.submitMacroBtn.Location = new System.Drawing.Point(398, 426); + this.submitMacroBtn.Name = "submitMacroBtn"; + this.submitMacroBtn.Size = new System.Drawing.Size(91, 23); + this.submitMacroBtn.TabIndex = 9; + this.submitMacroBtn.Text = "Submit"; + this.submitMacroBtn.UseVisualStyleBackColor = true; + this.submitMacroBtn.Click += new System.EventHandler(this.submitMacroBtn_Click); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(383, 6); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(31, 13); + this.label1.TabIndex = 15; + this.label1.Text = "Type"; + // // MacroForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(884, 461); + this.Controls.Add(this.label1); + this.Controls.Add(this.descTxtBox); + this.Controls.Add(this.descLabel); + this.Controls.Add(this.cmdLabel); + this.Controls.Add(this.tagCombo); + this.Controls.Add(this.macroTxtBox); + this.Controls.Add(this.submitMacroBtn); this.Name = "MacroForm"; this.Text = "MacroForm"; this.Load += new System.EventHandler(this.MacroForm_Load); this.ResumeLayout(false); + this.PerformLayout(); } #endregion + + private System.Windows.Forms.TextBox descTxtBox; + private System.Windows.Forms.Label descLabel; + private System.Windows.Forms.Label cmdLabel; + private System.Windows.Forms.ComboBox tagCombo; + private System.Windows.Forms.TextBox macroTxtBox; + private System.Windows.Forms.Button submitMacroBtn; + private System.Windows.Forms.Label label1; } } \ No newline at end of file diff --git a/BTConnectionService/WinRemoteDesktop_Test/MacroForm.cs b/BTConnectionService/WinRemoteDesktop_Test/MacroForm.cs index 6c8af73..ee871d8 100644 --- a/BTConnectionService/WinRemoteDesktop_Test/MacroForm.cs +++ b/BTConnectionService/WinRemoteDesktop_Test/MacroForm.cs @@ -21,5 +21,42 @@ private void MacroForm_Load(object sender, EventArgs e) { } + + private void descTxtBox_TextChanged(object sender, EventArgs e) + { + + } + + private void tagCombo_SelectedIndexChanged(object sender, EventArgs e) + { + if (tagCombo.Text == "String") + { + + } + else if (tagCombo.Text == "WinShortcut") + { + //Nothing yet but hide buttons. + + + } + } + + private void submitMacroBtn_Click(object sender, EventArgs e) + { + string cmd = macroTxtBox.Text; + string tag = tagCombo.Text; + string description = descTxtBox.Text; + DBHelper.createSimpleMacro(cmd, tag, description); + //DBHelper.addKeyCodes(macroFromTxt); + macroTxtBox.Clear(); + descTxtBox.Clear(); + this.Close(); + + } + + private void macroTxtBox_TextChanged(object sender, EventArgs e) + { + + } } }