Пример #1
0
        private void InsertClick(object sender, RoutedEventArgs e)
        {
            PUsuario        p  = new PUsuario();
            List <MUsuario> cs = p.Open();

            MUsuario u = new MUsuario();

            u.Nome  = txtUsuario.Text;
            u.Senha = txtSenha.Password;
            u.Foto  = foto;

            cs.Add(u);

            p.Save(cs);
        }
Пример #2
0
        private void List_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (list.SelectedItem != null)
            {
                MUsuario u = list.SelectedItem as MUsuario;
                txtUsuario.Text = u.Nome;

                byte[] b = Convert.FromBase64String(u.Foto);

                BitmapImage bi = new BitmapImage();
                bi.BeginInit();
                bi.StreamSource = new MemoryStream(b);
                bi.EndInit();

                image.Source = bi;
            }
        }