This commit is contained in:
2022-06-20 00:21:06 +00:00
parent 4d524efb4b
commit 7b99160632
9 changed files with 169 additions and 37 deletions

View File

@@ -97,6 +97,7 @@
<Compile Include="Properties\Resources.Designer.cs"> <Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen> <AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile> </Compile>
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
@@ -123,5 +124,11 @@
<Install>false</Install> <Install>false</Install>
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="Resources\user.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\pass.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@@ -17,12 +17,16 @@ namespace AyaNovaQBI
InitializeComponent(); InitializeComponent();
} }
private void MainForm_Load(object sender, EventArgs e) async private void MainForm_Load(object sender, EventArgs e)
{ {
//Initialize //Initialize
if(await util.InitializeQBI() == false)
{
Close();
}
grid.DataSource = util.GetInvoiceableItems(); // grid.DataSource = util.GetInvoiceableItems();
} }
private void grid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) private void grid_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)

View File

@@ -8,10 +8,10 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace AyaNovaQBI.Properties namespace AyaNovaQBI.Properties {
{ using System;
/// <summary> /// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc. /// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary> /// </summary>
@@ -19,53 +19,65 @@ namespace AyaNovaQBI.Properties
// class via a tool like ResGen or Visual Studio. // class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen // To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project. // 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.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources internal class Resources {
{
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture; private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() internal Resources() {
{
} }
/// <summary> /// <summary>
/// Returns the cached ResourceManager instance used by this class. /// Returns the cached ResourceManager instance used by this class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager internal static global::System.Resources.ResourceManager ResourceManager {
{ get {
get if (object.ReferenceEquals(resourceMan, null)) {
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AyaNovaQBI.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AyaNovaQBI.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;
} }
} }
/// <summary> /// <summary>
/// Overrides the current thread's CurrentUICulture property for all /// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class. /// resource lookups using this strongly typed resource class.
/// </summary> /// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture internal static global::System.Globalization.CultureInfo Culture {
{ get {
get
{
return resourceCulture; return resourceCulture;
} }
set set {
{
resourceCulture = value; resourceCulture = value;
} }
} }
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap pass {
get {
object obj = ResourceManager.GetObject("pass", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap user {
get {
object obj = ResourceManager.GetObject("user", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
} }
} }

View File

@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType> <xsd:complexType>
<xsd:choice maxOccurs="unbounded"> <xsd:choice maxOccurs="unbounded">
@@ -68,9 +69,10 @@
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" /> <xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" /> <xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="assembly"> <xsd:element name="assembly">
@@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="resheader"> <xsd:element name="resheader">
@@ -109,9 +112,16 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="user" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\user.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="pass" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\pass.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root> </root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

View File

@@ -31,11 +31,20 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(auth)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(auth));
this.edServerUrl = new System.Windows.Forms.TextBox(); this.edServerUrl = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label(); 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(); this.SuspendLayout();
// //
// edServerUrl // 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.Name = "edServerUrl";
this.edServerUrl.Size = new System.Drawing.Size(590, 20); this.edServerUrl.Size = new System.Drawing.Size(590, 20);
this.edServerUrl.TabIndex = 0; this.edServerUrl.TabIndex = 0;
@@ -43,19 +52,91 @@
// label1 // label1
// //
this.label1.AutoSize = true; 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.Name = "label1";
this.label1.Size = new System.Drawing.Size(123, 13); this.label1.Size = new System.Drawing.Size(123, 13);
this.label1.TabIndex = 1; this.label1.TabIndex = 1;
this.label1.Text = "AyaNova server address"; 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 // auth
// //
this.AcceptButton = this.btnLogin;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true; 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.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.label1);
this.Controls.Add(this.edServerUrl); this.Controls.Add(this.edServerUrl);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
@@ -63,6 +144,8 @@
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "AyaNova login"; this.Text = "AyaNova login";
this.Load += new System.EventHandler(this.auth_Load); this.Load += new System.EventHandler(this.auth_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -72,5 +155,12 @@
private System.Windows.Forms.TextBox edServerUrl; private System.Windows.Forms.TextBox edServerUrl;
private System.Windows.Forms.Label label1; 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;
} }
} }

View File

@@ -21,5 +21,10 @@ namespace AyaNovaQBI
{ {
edServerUrl.Text = util.SERVER_URL; edServerUrl.Text = util.SERVER_URL;
} }
private void btnTest_Click(object sender, EventArgs e)
{
}
} }
} }

View File

@@ -34,12 +34,16 @@ namespace AyaNovaQBI
} }
public static bool InitializeQBI() public static async Task<bool> 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 //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 //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 //LOGIN to v8 first
auth d = new auth();
if (d.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
return false;
//Fetch AyaNova license //Fetch AyaNova license
//Check if licensed //Check if licensed
//check if build date is within licensed date (how did I do that automated build date thing?) //check if build date is within licensed date (how did I do that automated build date thing?)