Ejemplo n.º 1
0
		public ViewOrderEdit() : base()
		{
			comboorder = new ComboBoxOrders();
			comboorder.Changed += OnOrderChanged;
			comboorder.WidthRequest = 200;
			
			butneworder = new Button();
			butneworder.Add( new Image(Stock.New, IconSize.Button) );
			butneworder.Clicked += OnNewOrderClicked;
			
			buteditorder = new Button();
			buteditorder.Add( new Image(Stock.Edit, IconSize.Button) );
			buteditorder.Clicked += OnEditOrderClicked;

			butdelorder = new Button();
			butdelorder.Add( new Image(Stock.Delete, IconSize.Button) );
			butdelorder.Clicked += OnDeleteOrderClicked;

			HBox hb = new HBox();
			hb.PackStart(butdelorder, false, false, 0);
			hb.PackStart(comboorder,true, true, 0 );
			hb.PackStart(butneworder, false, false, 0 );
			hb.PackStart(buteditorder, false,false,0 );
			
			viewtot = new ViewOrderTotal();
			
			view = new ViewOrderDetails();
			view.HeaderVisible = true;
			view.FilterColumn="OrderId";			
			view.SelectionChanged += OnOrderDetailChanged;
			
			Frame frame = new Frame();
			frame.Label = "Oder item";
			viewdet = new ViewOrderDetailEdit();
			frame.Add(viewdet);
			
			pad = new KeyPad();
			pad.Clicked += OnPadClicked;
			
			PackStart(hb, false, true, 0);
			PackStart(viewtot, false, true, 3);
			PackStart(view, true, true, 3);
			PackStart(frame, false, false,3);
			PackStart(pad, false, true, 3);
		}
Ejemplo n.º 2
0
		public void OnPadClicked(object sender, KeyPad.KeypadEventArgs args)
		{
			switch(args.code) {
			case KeyPad.KeyCode.Ok:
				ApplyDetailChange();
				break;
			default :
				this.viewdet.HandleKeypad(args.code);
				break;
			}
		}
Ejemplo n.º 3
0
		public void HandleKeypad( KeyPad.KeyCode code)
		{
			string strinput = activestring;
			System.Console.WriteLine( "handleleypad: {0}",strinput);
			switch (code) {
			case KeyPad.KeyCode.DoubleZero:
				strinput += "00";
				break;
			case KeyPad.KeyCode.Dot:
				strinput += ".";
				break;
			case KeyPad.KeyCode.Zero:
			case KeyPad.KeyCode.One:
			case KeyPad.KeyCode.Two:
			case KeyPad.KeyCode.Three:
			case KeyPad.KeyCode.Four:
			case KeyPad.KeyCode.Five:
			case KeyPad.KeyCode.Six:
			case KeyPad.KeyCode.Seven:
			case KeyPad.KeyCode.Eight:
			case KeyPad.KeyCode.Nine:
				strinput += ((int)code).ToString();
				break;
			default:
				break;
			}
				
			 
			if ( rex.IsMatch(strinput) )
			{				
				string strres="";
				Match match = rex.Match(strinput);
				
				if (match.Groups["int"] != null && match.Groups["int"].Value!="" )
				{
					strres = match.Groups["int"].Value;
					if( code == KeyPad.KeyCode.Minus )
						strres = (double.Parse(strres)-1.0f).ToString();
					if( code == KeyPad.KeyCode.Plus )
						strres = (double.Parse(strres)+1.0f).ToString();
				}
				if (match.Groups["sep"] != null )
					{
						strres += match.Groups["sep"].Value;
						if (match.Groups["dec"] != null )
						{
							strres += match.Groups["dec"].Value;
						}
					}
				System.Console.WriteLine("result : {0}", strres);
				this.SetActiveFromString(strres);
			}
		}