Exemplo n.º 1
0
        private void Add_quest_Click(object sender, RoutedEventArgs e)
        {
            int index = (int)questions_lb.SelectedValue;

            Clases.Profile profile = Clases.Database.data.GetProfile(index);
            titulo_encuesta.Text = profile.Question;
            OpenFileDialog of = new OpenFileDialog();

            of.Filter = "Image Files (*.bmp;*.jpg;*.jpeg,*.png)|*.BMP;*.JPG;*.JPEG;*.PNG";
            if (of.ShowDialog() == true)
            {
                pic.Source = new BitmapImage(new Uri(of.FileName));
            }
            byte[] imageArray = File.ReadAllBytes(of.FileName);
            ir            = Convert.ToBase64String(imageArray);
            profile.Image = ir;
            Clases.Database.data.save();
        }
Exemplo n.º 2
0
        private void questions_lb_MouseDown(object sender, MouseButtonEventArgs e)
        {
            index = questions_lb.SelectedIndex;
            Clases.Profile profile = Clases.Database.data.GetProfile(index);
            titulo_encuesta.Text = profile.Question;

            byte[] binaryData = Convert.FromBase64String(profile.Image);

            BitmapImage bi = new BitmapImage();

            bi.BeginInit();
            bi.StreamSource = new MemoryStream(binaryData);
            bi.EndInit();

            Image img = new Image();

            img.Source = bi;
            pic        = img;
        }
Exemplo n.º 3
0
        private void Add_quest_Click(object sender, RoutedEventArgs e)
        {
            Clases.Profile profile = new Clases.Profile(titulo_encuesta.Text, base64ImageRepresentation);

            Clases.Database.data.Profiles.Add(profile);

            Clases.Database.data.save();

            profiles.Add(profile.ID);
            int num = titulo_encuesta.Text.Length;

            if (titulo_encuesta.Text.Length > 0)
            {
                if (titulo_encuesta.Text[num - 1] != '?')
                {
                    titulo_encuesta.Text += '?';
                }
                questions_lb.Items.Add(titulo_encuesta.Text);
            }
        }