using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace TaxSpoolerCETest
{
   /// 
   /// Summary description for Form1.
   /// 
   public class Form1 : System.Windows.Forms.Form
   {
private com.incahellas.cTAXCLIENT tc;
private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.ToolBar toolBar1; private System.Windows.Forms.TextBox textBox4; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox textBox3; private System.Windows.Forms.TabPage tabPage2; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // this.tabControl1.BackColor=Color.Beige; this.tabPage1.BackColor=Color.Beige; this.tabPage2.BackColor=Color.Beige; textBox1.Text=tc.IP; textBox2.Text=tc.Port.ToString(); textBox3.Text=tc.StrId; this.Menu=new MainMenu(); MenuItem mi=new MenuItem(); mi.Text="File"; this.Menu.MenuItems.Add(mi); MenuItem mi2=new MenuItem(); mi2.Text="Exit"; mi2.Click += new EventHandler(menuExit_Click); mi.MenuItems.Add(mi2); mi=new MenuItem(); mi.Text="Help"; this.Menu.MenuItems.Add(mi); mi2=new MenuItem(); mi2.Text="License"; mi2.Click += new EventHandler(menuLicense_Click); mi.MenuItems.Add(mi2); mi2=new MenuItem(); mi2.Text="About"; mi2.Click += new EventHandler(menuAbout_Click); mi.MenuItems.Add(mi2); set_text(); redraw_contents(); } private void redraw_contents() { int xtop=toolBar1.Top==0?toolBar1.Height:0; tabControl1.Top=xtop; tabControl1.Width=this.ClientSize.Width; tabControl1.Height=this.ClientSize.Height - xtop; textBox4.Width=tabPage1.ClientSize.Width; textBox4.Height=tabPage1.ClientSize.Height - 16 - button1.Height; button1.Top=textBox4.Height + 8; button2.Top=button1.Top; } private void menuExit_Click(object sender, System.EventArgs e) { Application.Exit(); } private void menuAbout_Click(object sender, System.EventArgs e) { MessageBox.Show("TaxSpooler thin .NET client\r\n" + "usage example.\r\n" + "Copyright (c) 2005 INCA Hellas Ltd\r\n" + "www.incahellas.com", "TaxSpooler sign test"); } private void menuLicense_Click(object sender, System.EventArgs e) { tc.RenewLicense(); } private void set_text() { textBox4.Text="Invoice\r\n" + "\r\n" + "Customer:\r\nBOSS International S.A.\r\n" + "Graphics\r\n429, Place de la Taconnerie\r\n12078 Geneva\r\nSwitserland\r\n" + "\r\n" + "Item Description Qua Price\r\n" + "145 NetSpooler 4 92.75\r\n" + "210a TaxSpooler 3 45.60\r\n" + "\r\n" + "Subtotal: 507.80 Euro\r\n" + "V.A.T. 19% 96.48\r\n" + "Grand total 604.28 Euro\r\n" + "בגדהוזחטיךכלםמןנסףפץצקרשע"; } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { base.Dispose( disposing ); } /// /// The main entry point for the application. /// static void Main() { Application.Run(new Form1()); } #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.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.button2 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.textBox4 = new System.Windows.Forms.TextBox(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.textBox3 = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.textBox2 = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.toolBar1 = new System.Windows.Forms.ToolBar(); this.tc = new com.incahellas.cTAXCLIENT(); // // tabControl1 // this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Location = new System.Drawing.Point(0, 16); this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(232, 224); // // tabPage1 // this.tabPage1.Controls.Add(this.button2); this.tabPage1.Controls.Add(this.button1); this.tabPage1.Controls.Add(this.textBox4); this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Size = new System.Drawing.Size(224, 198); this.tabPage1.Text = "Invoice"; // // button2 // this.button2.Location = new System.Drawing.Point(88, 168); this.button2.Text = "Reset"; this.button2.Click += new System.EventHandler(this.button2_Click); // // button1 // this.button1.Location = new System.Drawing.Point(8, 168); this.button1.Text = "Sign"; this.button1.Click += new System.EventHandler(this.button1_Click); // // textBox4 // this.textBox4.Multiline = true; this.textBox4.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.textBox4.Size = new System.Drawing.Size(216, 160); this.textBox4.Text = ""; this.textBox4.WordWrap = false; // // tabPage2 // this.tabPage2.Controls.Add(this.textBox3); this.tabPage2.Controls.Add(this.label3); this.tabPage2.Controls.Add(this.textBox2); this.tabPage2.Controls.Add(this.label2); this.tabPage2.Controls.Add(this.textBox1); this.tabPage2.Controls.Add(this.label1); this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Size = new System.Drawing.Size(224, 198); this.tabPage2.Text = "Settings"; // // textBox3 // this.textBox3.Location = new System.Drawing.Point(8, 120); this.textBox3.Text = ""; // // label3 // this.label3.Location = new System.Drawing.Point(8, 104); this.label3.Text = "String Id"; // // textBox2 // this.textBox2.Location = new System.Drawing.Point(8, 72); this.textBox2.Text = ""; // // label2 // this.label2.Location = new System.Drawing.Point(8, 56); this.label2.Text = "Port"; // // textBox1 // this.textBox1.Location = new System.Drawing.Point(8, 24); this.textBox1.Text = ""; // // label1 // this.label1.Location = new System.Drawing.Point(8, 8); this.label1.Text = "Host name"; // // tc // this.tc.IP = "192.168.53.1"; // // Form1 // this.ClientSize = new System.Drawing.Size(242, 489); this.Controls.Add(this.tabControl1); this.Controls.Add(this.toolBar1); this.Text = "TaxSpooler Test"; this.Resize += new System.EventHandler(this.Form1_Resize); } #endregion private void Form1_Resize(object sender, System.EventArgs e) { redraw_contents(); } private void button1_Click(object sender, System.EventArgs e) {
tc.IP = textBox1.Text; try { tc.Port = Convert.ToInt32(textBox2.Text); } catch { MessageBox.Show("Port number error!"); return; } tc.StrId = textBox3.Text; int ret=tc.GetSign(textBox4.Text); if (ret==0) { // o.k. textBox4.Text += tc.retStr; } MessageBox.Show("ret="+ret.ToString(), "TaxSpooler client");
} private void button2_Click(object sender, System.EventArgs e) { set_text(); } } }