Ejemplo n.º 1
0
        private void btSelecionarCliente_Click(object sender, RoutedEventArgs e)
        {
            UCSelecaoCliente ucsc = new UCSelecaoCliente();
            CustomMessageBox cmb  = new CustomMessageBox()
            {
                Content            = ucsc,
                LeftButtonContent  = "Selecionar",
                RightButtonContent = "Cancelar"
            };

            cmb.Dismissing += (s1, e1) =>
            {
                switch (e1.Result)
                {
                case CustomMessageBoxResult.LeftButton:
                    if (ucsc.listClientes.SelectedItem == null)
                    {
                        e1.Cancel = true;
                    }
                    if (ucsc.listClientes.SelectedItem != null)
                    {
                        novoPedido.IdCliente        = (ucsc.listClientes.SelectedItem as Cliente).Id;
                        btSelecionarCliente.Content = (ucsc.listClientes.SelectedItem as Cliente).Nome;
                    }
                    break;
                }
            };
            cmb.Show();
        }
Ejemplo n.º 2
0
 private void btSelecionarCliente_Click(object sender, RoutedEventArgs e)
 {
     UCSelecaoCliente ucsc = new UCSelecaoCliente();
     CustomMessageBox cmb = new CustomMessageBox()
     {
         Content = ucsc,
         LeftButtonContent = "Selecionar",
         RightButtonContent = "Cancelar"
     };
     cmb.Dismissing += (s1, e1) =>
     {
         switch (e1.Result)
         {
             case CustomMessageBoxResult.LeftButton:
                 if (ucsc.listClientes.SelectedItem == null)
                     e1.Cancel = true;
                 if (ucsc.listClientes.SelectedItem != null)
                 {
                     novoPedido.IdCliente = (ucsc.listClientes.SelectedItem as Cliente).Id;
                     btSelecionarCliente.Content = (ucsc.listClientes.SelectedItem as Cliente).Nome;
                 }
                 break;
         }
     };
     cmb.Show();
 }