private void Window_KeyDown(object sender, KeyEventArgs e) { List <Key> keys = new List <Key>() { Key.D1, Key.D2, Key.D3, Key.D4, Key.D5, Key.D6, Key.D7, Key.D8, Key.D9, Key.D0, Key.NumPad0, Key.NumPad1, Key.NumPad2, Key.NumPad3, Key.NumPad4, Key.NumPad5, Key.NumPad6, Key.NumPad7, Key.NumPad8, Key.NumPad9, }; if (keys.Contains(e.Key)) { wAddArtigoByKeryboard temp = null; foreach (Window openWin in System.Windows.Application.Current.Windows) { if (openWin is wAddArtigoByKeryboard) { temp = (wAddArtigoByKeryboard)openWin; } } if (temp != null) { temp.Focus(); } else { temp = new wAddArtigoByKeryboard(e.Key); temp.ShowDialog(); if (temp.idArtigo != -1) { Artigo aux = ControlArtigos.DevolveArtigoById(temp.idArtigo); if (aux != null) { if (_quantidade != 0) { DataCart.InsertArtigo(aux.Id, Quantidade); Quantidade = 0; } else { DataCart.InsertArtigo(aux.Id, aux.Quantidade); } } } temp.Visibility = Visibility.Hidden; } } }
private void BtnLimpar_Click(object sender, RoutedEventArgs e) { if (DataCart.TotalItems != 0) { wConfimacao check = new wConfimacao("Deseja limpar o carrinho de compras?"); check.ShowDialog(); if (check.Checked) { DataCart.LimpaCart(); } } else { new wMessage("Carrinho de compras vazio").ShowDialog(); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 14 "..\..\..\Windows\wMenu.xaml" ((View.wMenu)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden #line 15 "..\..\..\Windows\wMenu.xaml" ((View.wMenu)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Window_MouseDown); #line default #line hidden #line 16 "..\..\..\Windows\wMenu.xaml" ((View.wMenu)(target)).KeyDown += new System.Windows.Input.KeyEventHandler(this.Window_KeyDown); #line default #line hidden return; case 2: this.ScrollFamily = ((View.ScrollViewerFamily)(target)); return; case 3: this.ScrollArtigo = ((View.ScrollViewerArtigos)(target)); return; case 4: this.btnLogotipo = ((System.Windows.Controls.Button)(target)); #line 77 "..\..\..\Windows\wMenu.xaml" this.btnLogotipo.Click += new System.Windows.RoutedEventHandler(this.BtnLogotipo_Click); #line default #line hidden return; case 5: this.lbClienteSelecionar = ((System.Windows.Controls.Label)(target)); return; case 6: this.DataCart = ((View.DataCart)(target)); return; case 7: this.btnClientes = ((System.Windows.Controls.Button)(target)); #line 128 "..\..\..\Windows\wMenu.xaml" this.btnClientes.Click += new System.Windows.RoutedEventHandler(this.BtnClientes_Click); #line default #line hidden return; case 8: this.btnLimpar = ((System.Windows.Controls.Button)(target)); #line 133 "..\..\..\Windows\wMenu.xaml" this.btnLimpar.Click += new System.Windows.RoutedEventHandler(this.BtnLimpar_Click); #line default #line hidden return; case 9: this.btnQtd = ((System.Windows.Controls.Button)(target)); #line 138 "..\..\..\Windows\wMenu.xaml" this.btnQtd.Click += new System.Windows.RoutedEventHandler(this.BtnQtd_Click); #line default #line hidden return; case 10: this.columnQtd = ((System.Windows.Controls.RowDefinition)(target)); return; case 11: this.lbQtd = ((System.Windows.Controls.Label)(target)); return; case 12: this.btnNif = ((System.Windows.Controls.Button)(target)); #line 150 "..\..\..\Windows\wMenu.xaml" this.btnNif.Click += new System.Windows.RoutedEventHandler(this.BtnNif_Click); #line default #line hidden return; case 13: this.btnPagar = ((System.Windows.Controls.Button)(target)); #line 155 "..\..\..\Windows\wMenu.xaml" this.btnPagar.Click += new System.Windows.RoutedEventHandler(this.BtnQtd_Click); #line default #line hidden return; case 14: this.btnClose = ((System.Windows.Controls.Button)(target)); #line 186 "..\..\..\Windows\wMenu.xaml" this.btnClose.Click += new System.Windows.RoutedEventHandler(this.BtnClose_Click); #line default #line hidden return; case 15: this.btnSettings = ((System.Windows.Controls.Button)(target)); #line 193 "..\..\..\Windows\wMenu.xaml" this.btnSettings.Click += new System.Windows.RoutedEventHandler(this.BtnSettings_Click); #line default #line hidden return; } this._contentLoaded = true; }