From 7b9916063299e84c9b59dcb811f92477f4499288 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 20 Jun 2022 00:21:06 +0000 Subject: [PATCH] --- AyaNovaQBI/AyaNovaQBI.csproj | 7 ++ AyaNovaQBI/MainForm.cs | 8 +- AyaNovaQBI/Properties/Resources.Designer.cs | 64 +++++++------ AyaNovaQBI/Properties/Resources.resx | 20 +++- AyaNovaQBI/Resources/pass.png | Bin 0 -> 517 bytes AyaNovaQBI/Resources/user.png | Bin 0 -> 446 bytes AyaNovaQBI/auth.Designer.cs | 96 +++++++++++++++++++- AyaNovaQBI/auth.cs | 5 + AyaNovaQBI/util.cs | 6 +- 9 files changed, 169 insertions(+), 37 deletions(-) create mode 100644 AyaNovaQBI/Resources/pass.png create mode 100644 AyaNovaQBI/Resources/user.png diff --git a/AyaNovaQBI/AyaNovaQBI.csproj b/AyaNovaQBI/AyaNovaQBI.csproj index 98e8beb..7c7a034 100644 --- a/AyaNovaQBI/AyaNovaQBI.csproj +++ b/AyaNovaQBI/AyaNovaQBI.csproj @@ -97,6 +97,7 @@ True Resources.resx + True SettingsSingleFileGenerator @@ -123,5 +124,11 @@ false + + + + + + \ No newline at end of file diff --git a/AyaNovaQBI/MainForm.cs b/AyaNovaQBI/MainForm.cs index f8729b6..ea91164 100644 --- a/AyaNovaQBI/MainForm.cs +++ b/AyaNovaQBI/MainForm.cs @@ -17,12 +17,16 @@ namespace AyaNovaQBI InitializeComponent(); } - private void MainForm_Load(object sender, EventArgs e) + async private void MainForm_Load(object sender, EventArgs e) { //Initialize + if(await util.InitializeQBI() == false) + { + Close(); + } - grid.DataSource = util.GetInvoiceableItems(); +// grid.DataSource = util.GetInvoiceableItems(); } private void grid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) diff --git a/AyaNovaQBI/Properties/Resources.Designer.cs b/AyaNovaQBI/Properties/Resources.Designer.cs index d06d579..b367272 100644 --- a/AyaNovaQBI/Properties/Resources.Designer.cs +++ b/AyaNovaQBI/Properties/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace AyaNovaQBI.Properties -{ - - +namespace AyaNovaQBI.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,53 +19,65 @@ namespace AyaNovaQBI.Properties // 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.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// /// 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)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AyaNovaQBI.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 - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap pass { + get { + object obj = ResourceManager.GetObject("pass", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap user { + get { + object obj = ResourceManager.GetObject("user", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } diff --git a/AyaNovaQBI/Properties/Resources.resx b/AyaNovaQBI/Properties/Resources.resx index ffecec8..3dc6631 100644 --- a/AyaNovaQBI/Properties/Resources.resx +++ b/AyaNovaQBI/Properties/Resources.resx @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,6 +60,7 @@ : and then encoded with base64 encoding. --> + @@ -68,9 +69,10 @@ - + + @@ -85,9 +87,10 @@ - + + @@ -109,9 +112,16 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\user.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\pass.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/AyaNovaQBI/Resources/pass.png b/AyaNovaQBI/Resources/pass.png new file mode 100644 index 0000000000000000000000000000000000000000..a7ce9ad338148a42c6bf6866ff77a8a5d9d7485b GIT binary patch literal 517 zcmV+g0{Z=lP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0h&ofK~zXfV`Lx^ z%wK)*|G|^j84jGd&hX&L8?cyzg(es`6a-_KN0J2&5iS2g2IB$(d|V6#NggN`5p98h zUh4l3pT0qP_(4L5EyIGI46xZuU=ad;UK_7NrVyu@Mbg^00j#u zoXG)<_=*BhurwBikQ5~7fG8hO0+{?=ji5|aKuNG500RR6!!e?OujGY*00000NkvXX Hu0mjf*}}-S literal 0 HcmV?d00001 diff --git a/AyaNovaQBI/Resources/user.png b/AyaNovaQBI/Resources/user.png new file mode 100644 index 0000000000000000000000000000000000000000..d3bad7bfde57d355aade55400bcc01a09b077881 GIT binary patch literal 446 zcmeAS@N?(olHy`uVBq!ia0vp^5anMpoU;i7sn6}?_>$dgnzG^|MTwA`fse^(rnnV zH{tBU{{fkM8U(!_vnU+ai>YRLx{!%k*RqZK_N|Yz8pDI`Z~pZE=<6H2?Tk*-3>-6g zF4&h_J05mqcw!wO;IvbMVL9sogSJf^&7Ggi9U^A{xkq-$u@xK@CFP2Lkkp6GM_rcBBCBV;kAC=@wq-9qZpWe=qRRGTx6JX&Qa`O7ngu^ z{H^8M2VU9+Bz}8vGTUJHLIsJ{yV^Lj5AF+?Ajqo9wI<7e<@N9DfAZ(-kUQnf$|p7} z;n#uA*9lUxCL%0}7HqA~KC2X2E^ymd*fH#!69jZ_NKV6q!_3ajI*Y^>^s_GLamr0tpvu4OpqNVAE#qhEyNo}4E^1=cWK=MA lNMqeKd(jg^DMmInhVJOLFK5zLd<2F$gQu&X%Q~loCIFMFr+xqc literal 0 HcmV?d00001 diff --git a/AyaNovaQBI/auth.Designer.cs b/AyaNovaQBI/auth.Designer.cs index b5fc522..f0abe3b 100644 --- a/AyaNovaQBI/auth.Designer.cs +++ b/AyaNovaQBI/auth.Designer.cs @@ -31,11 +31,20 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(auth)); this.edServerUrl = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); + this.btnTest = new System.Windows.Forms.Button(); + this.edUserName = new System.Windows.Forms.TextBox(); + this.edPassword = new System.Windows.Forms.TextBox(); + this.pictureBox2 = new System.Windows.Forms.PictureBox(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.btnLogin = new System.Windows.Forms.Button(); + this.btnCancel = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // edServerUrl // - this.edServerUrl.Location = new System.Drawing.Point(12, 71); + this.edServerUrl.Location = new System.Drawing.Point(12, 46); this.edServerUrl.Name = "edServerUrl"; this.edServerUrl.Size = new System.Drawing.Size(590, 20); this.edServerUrl.TabIndex = 0; @@ -43,19 +52,91 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(13, 52); + this.label1.Location = new System.Drawing.Point(13, 27); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(123, 13); this.label1.TabIndex = 1; this.label1.Text = "AyaNova server address"; // + // btnTest + // + this.btnTest.Location = new System.Drawing.Point(12, 73); + this.btnTest.Name = "btnTest"; + this.btnTest.Size = new System.Drawing.Size(75, 23); + this.btnTest.TabIndex = 2; + this.btnTest.Text = "Test connection"; + this.btnTest.UseVisualStyleBackColor = true; + this.btnTest.Click += new System.EventHandler(this.btnTest_Click); + // + // edUserName + // + this.edUserName.Location = new System.Drawing.Point(52, 137); + this.edUserName.Name = "edUserName"; + this.edUserName.Size = new System.Drawing.Size(550, 20); + this.edUserName.TabIndex = 3; + // + // edPassword + // + this.edPassword.Location = new System.Drawing.Point(52, 200); + this.edPassword.Name = "edPassword"; + this.edPassword.Size = new System.Drawing.Size(550, 20); + this.edPassword.TabIndex = 4; + // + // pictureBox2 + // + this.pictureBox2.Image = global::AyaNovaQBI.Properties.Resources.pass; + this.pictureBox2.InitialImage = null; + this.pictureBox2.Location = new System.Drawing.Point(12, 200); + this.pictureBox2.Name = "pictureBox2"; + this.pictureBox2.Size = new System.Drawing.Size(24, 24); + this.pictureBox2.TabIndex = 8; + this.pictureBox2.TabStop = false; + // + // pictureBox1 + // + this.pictureBox1.Image = global::AyaNovaQBI.Properties.Resources.user; + this.pictureBox1.InitialImage = null; + this.pictureBox1.Location = new System.Drawing.Point(12, 137); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(24, 24); + this.pictureBox1.TabIndex = 7; + this.pictureBox1.TabStop = false; + // + // btnLogin + // + this.btnLogin.Location = new System.Drawing.Point(527, 262); + this.btnLogin.Name = "btnLogin"; + this.btnLogin.Size = new System.Drawing.Size(75, 23); + this.btnLogin.TabIndex = 9; + this.btnLogin.Text = "Login"; + this.btnLogin.UseVisualStyleBackColor = true; + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(12, 262); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 10; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + // // auth // + this.AcceptButton = this.btnLogin; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoSize = true; - this.ClientSize = new System.Drawing.Size(614, 408); + this.CancelButton = this.btnCancel; + this.ClientSize = new System.Drawing.Size(614, 321); this.ControlBox = false; + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.btnLogin); + this.Controls.Add(this.pictureBox2); + this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.edPassword); + this.Controls.Add(this.edUserName); + this.Controls.Add(this.btnTest); this.Controls.Add(this.label1); this.Controls.Add(this.edServerUrl); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); @@ -63,6 +144,8 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "AyaNova login"; this.Load += new System.EventHandler(this.auth_Load); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -72,5 +155,12 @@ private System.Windows.Forms.TextBox edServerUrl; private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btnTest; + private System.Windows.Forms.TextBox edUserName; + private System.Windows.Forms.TextBox edPassword; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.PictureBox pictureBox2; + private System.Windows.Forms.Button btnLogin; + private System.Windows.Forms.Button btnCancel; } } \ No newline at end of file diff --git a/AyaNovaQBI/auth.cs b/AyaNovaQBI/auth.cs index 4e1ccd4..12dc009 100644 --- a/AyaNovaQBI/auth.cs +++ b/AyaNovaQBI/auth.cs @@ -21,5 +21,10 @@ namespace AyaNovaQBI { edServerUrl.Text = util.SERVER_URL; } + + private void btnTest_Click(object sender, EventArgs e) + { + + } } } diff --git a/AyaNovaQBI/util.cs b/AyaNovaQBI/util.cs index 6e9e908..a6b1d45 100644 --- a/AyaNovaQBI/util.cs +++ b/AyaNovaQBI/util.cs @@ -34,12 +34,16 @@ namespace AyaNovaQBI } - public static bool InitializeQBI() + public static async Task InitializeQBI() { //COPY most of this code from qbi v7 becuase it has a lot of edge cases in it and it's complex and thorough, but break it into abstracted bits so can be replicated in other accounting add-on's more easily //This is pre-pfc block of stuff that doesn't map well from v7 qbi plugin to here so replicate it in spirit here but not much is copyable just the concepts //LOGIN to v8 first + auth d = new auth(); + if (d.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) + return false; + //Fetch AyaNova license //Check if licensed //check if build date is within licensed date (how did I do that automated build date thing?)