示例#1
0
        private void Window_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (Visibility == Visibility.Visible)
            {
                //Console.WriteLine(Database.CurrentUser.Surveys.Count);
                //List<Clases.Survey> surveys = new List<Clases.Survey>();

                foreach (int id in Database.CurrentUser.Surveys)
                {
                    Clases.Survey survey = Database.data.GetSurvey(id);
                    Console.WriteLine(survey);
                    if (survey != null)
                    {
                        Label label = new Label();
                        label.Tag        = id;
                        label.Content    = $"{survey.Name} | Category: {survey.Category} - Views: {survey.Views}";
                        label.MouseDown += survey_Selected;
                        surveys.Children.Add(label);
                    }
                }

                //SurveyList.ItemsSource = surveys;
                //SurveyList.Items.Refresh();
            }
        }
示例#2
0
        private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Clases.Survey sac = new Clases.Survey();

            if (combo_cb.SelectedIndex == 0)
            {
                //h_pb.Maximum = sac.ViewsH;
                //m_pb.Maximum = sac.ViewsM;
                //x_pb.Maximum = sac.ViewsH + sac.ViewsM;

                //timer = new Timer(1);
                //timer.Elapsed += Timer_Elapsed;
                //timer.Enabled = true;

                int hombres = 10;
                int mujeres = 10;
                h_pb.Maximum = hombres;
                m_pb.Maximum = mujeres;
                //Maximum = hombres;
                //adios.Maximum = mujeres;

                x_pb.Maximum = hombres + mujeres;

                timer          = new Timer(1);
                timer.Elapsed += Timer_Elapsed;
                timer.Enabled  = true;
            }
        }
示例#3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (titulo_encuesta.Text.Length > 0 && categoria_encuesta.Text.Length > 0)
            {
                int[] owners = new int[]
                {
                    Clases.Database.CurrentUser.ID
                };
                survey = new Clases.Survey()
                {
                    Name     = titulo_encuesta.Text,
                    Category = categoria_encuesta.Text,
                    Public   = privadopublico(),
                    Owners   = owners
                };

                Database.data.Surveys.Add(survey);
                Database.CurrentUser.Surveys.Add(survey.ID);
                Database.data.save();

                AddQuestion aq = new AddQuestion();
                aq.Owner = this;
                aq.Show();
                Hide();
            }
            else
            {
                string h = "No deje espacios en blanco";
                MessageBox.Show(h);
            }
        }
示例#4
0
        private void survey_code_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                if (!int.TryParse(survey_code.Text, out int id))
                {
                    survey_code.SelectAll();
                    return;
                }

                Clases.Survey survey = Database.data.GetSurvey(id);

                if (survey == null)
                {
                    return;
                }

                Survey s = new Survey(survey);
                s.Owner = this;
                s.Show();
                Hide();
            }
        }
示例#5
0
 public Survey(Clases.Survey survey)
 {
     this.survey = survey;
     InitializeComponent();
 }
示例#6
0
 public EditSurvey(Clases.Survey survey)
 {
     InitializeComponent();
     this.survey = survey;
     questions_lb.ItemsSource = survey.profiles;
 }