コード例 #1
0
        public Main(MainWindow mainWindow)
        {
            InitializeComponent();
            GridTemplate();
            Content.Children.Add(mainGrid);
            this.mainWindow = mainWindow;
            resetValues();
            TextBoxes = addTextBoxRows();
            foreach (QuestionGroup questionGroup in mainWindow.ModelFacade.Filter.QuestionGroups)
            {
                addRow();
                Label l = new Label()
                {
                    FontSize = 25,
                    Content = questionGroup.Title
                };
                Grid.SetRow(l, count++);
                Grid.SetColumn(l, 0);
                mainGrid.Children.Add(l);

                GridPresent gp = new GridPresent(questionGroup);
                grids.Add(gp);
                foreach (Question q in questionGroup.Questions)
                {
                    if (q.IsActive(mainWindow.ModelFacade.Filter))
                    {
                        RowEntity row = gp.addRow(q.Rank, q);
                        row.SelectionChanged += AnswerSelectionChanged;
                    }

                }

                addRow();
                Grid g = gp.LoadGrid();
                Grid.SetRow(g, count++);
                Grid.SetColumn(g, 0);
                mainGrid.Children.Add(g);
                checkActiveQuestions();
            }


            addRow();
            Button btn = new Button()
            {
               Content = "Print",
               Margin = new Thickness(0,40,0,40),
               Width = 50
            };
            btn.Click += print;

            Grid.SetRow(btn, count++);
            Grid.SetColumn(btn, 0);
            mainGrid.Children.Add(btn);

        }
コード例 #2
0
        private List<RowEntity> addTextBoxRows()
        {

            var myTempQuestionGroup = new List<QuestionGroup>()
            {
                new QuestionGroup()
                {
                    Title = "Settings",
                    Rank = 0,
                    Questions = new BindingList<Question>()
                    {
                         new Question()
                        {
                            Title = "FilterType",
                            PrintTitle = "1",
                            Id = 0
                        },
                        new Question()
                        {
                            Title = "Kunde",
                            PrintTitle = "2",
                            Id = 0
                        },
                         new Question()
                        {
                            Title = "Ordrenr",
                            PrintTitle = "3",
                            Id = 0
                        },
                        new Question()
                        {
                            Title = "Maskin nr",
                            PrintTitle = "4",
                            Id = 0
                        },
                        new Question()
                        {
                            Title = "Konfigurationsnavn",
                            PrintTitle = "5",
                            Id = 0
                        }

                    }
                }
            };

            List<RowEntity> textBoxSettings = new List<RowEntity>();
   
           foreach (QuestionGroup questionGroup in myTempQuestionGroup)
            {
                addRow();
                Label l = new Label()
                {
                    FontSize = 25,
                    Content = questionGroup.Title
                };
                Grid.SetRow(l, count++);
                Grid.SetColumn(l, 0);
                mainGrid.Children.Add(l);

                GridPresent gp = new GridPresent(questionGroup);
                grids.Add(gp);
                foreach (Question q in questionGroup.Questions)
                {
                    if (q.IsActive(mainWindow.ModelFacade.Filter))
                    {
                        RowEntity row = gp.addRow(q.Rank, q,true);
                        textBoxSettings.Add(row);
                        row.SelectionChanged += AnswerSelectionChanged;
                    }

                }

                addRow();
                Grid g = gp.LoadGrid();
                Grid.SetRow(g, count++);
                Grid.SetColumn(g, 0);
                mainGrid.Children.Add(g);

            }

            return textBoxSettings;

        }