Files
ayanova7/source/Plugins/AyaNova.Plugin.QBOI/AyaMapDetails.cs
2018-06-29 19:47:36 +00:00

196 lines
6.6 KiB
C#

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace AyaNova.PlugIn.QBOI
{
/// <summary>
/// Summary description for AyaMapDetails.
/// </summary>
public class AyaMapDetails : System.Windows.Forms.Form
{
private System.Windows.Forms.Label lblDetails;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnUnlink;
private System.Windows.Forms.Button btnOK;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public AyaMapDetails()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
this.btnCancel.Image = Util.AyaImage("Cancel24");
this.btnOK.Image = Util.AyaImage("OK24");
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AyaMapDetails));
this.lblDetails = new System.Windows.Forms.Label();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnUnlink = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lblDetails
//
this.lblDetails.BackColor = System.Drawing.SystemColors.Window;
this.lblDetails.Dock = System.Windows.Forms.DockStyle.Top;
this.lblDetails.Location = new System.Drawing.Point(0, 0);
this.lblDetails.Name = "lblDetails";
this.lblDetails.Size = new System.Drawing.Size(553, 126);
this.lblDetails.TabIndex = 0;
//
// btnOK
//
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.btnOK.BackColor = System.Drawing.SystemColors.Control;
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(442, 153);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(101, 41);
this.btnOK.TabIndex = 28;
this.btnOK.UseVisualStyleBackColor = false;
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.BackColor = System.Drawing.SystemColors.Control;
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(7, 153);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(101, 41);
this.btnCancel.TabIndex = 27;
this.btnCancel.UseVisualStyleBackColor = false;
//
// btnUnlink
//
this.btnUnlink.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.btnUnlink.BackColor = System.Drawing.SystemColors.Control;
this.btnUnlink.Image = ((System.Drawing.Image)(resources.GetObject("btnUnlink.Image")));
this.btnUnlink.Location = new System.Drawing.Point(218, 157);
this.btnUnlink.Name = "btnUnlink";
this.btnUnlink.Size = new System.Drawing.Size(101, 40);
this.btnUnlink.TabIndex = 29;
this.btnUnlink.UseVisualStyleBackColor = false;
this.btnUnlink.Click += new System.EventHandler(this.btnUnlink_Click);
//
// AyaMapDetails
//
this.AcceptButton = this.btnOK;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(553, 202);
this.ControlBox = false;
this.Controls.Add(this.btnUnlink);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.lblDetails);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "AyaMapDetails";
this.Text = "Map details";
this.Load += new System.EventHandler(this.AyaMapDetails_Load);
this.ResumeLayout(false);
}
#endregion
private bool bIsLinked=false;
public bool IsLinked
{
get
{
return bIsLinked;
}
set
{
bIsLinked=value;
}
}
private string sObject="";
private string sLinkedTo="";
public string ObjectDescription
{
set
{
sObject=value;
}
}
public string LinkedToDescription
{
set
{
sLinkedTo=value;
}
}
private void DisplayDetails()
{
if(bIsLinked)
lblDetails.Text="AyaNova object: \r\n" + sObject+"\r\n" +
"Is linked to QuickBooks object:\r\n"+
sLinkedTo;
else
lblDetails.Text="AyaNova object: \r\n" + sObject+"\r\n" +
"Is NOT linked to any QuickBooks object";
}
private void btnUnlink_Click(object sender, System.EventArgs e)
{
if(MessageBox.Show("Are you sure you want to unlink this object?","Unlink",MessageBoxButtons.YesNo,MessageBoxIcon.Question)!=DialogResult.Yes) return;
bIsLinked=false;
btnUnlink.Visible=false;
this.btnCancel.Visible=true;
DisplayDetails();
}
private void AyaMapDetails_Load(object sender, System.EventArgs e)
{
Util.SetControlBackQBOIColor(this);
this.btnUnlink.Visible=bIsLinked;
this.btnCancel.Visible=false;
DisplayDetails();
}
}
}