Example #1
0
        private void method_2()
        {
            AutoFill autoFill = new AutoFill();

            autoFill.oLogicEngine = this.oLogicEngine;
            Style style       = (Style)base.FindResource("SelBtnStyle");
            Style style2      = (Style)base.FindResource("UnSelBtnStyle");
            Style style3      = (Style)base.FindResource("ContentMediumStyle");
            Brush borderBrush = (Brush)base.FindResource("NormalBorderBrush");
            Brush foreground  = (Brush)base.FindResource("PressedBrush");
            HorizontalAlignment horizontalAlignment = HorizontalAlignment.Right;

            if (this.CL_TA == "C")
            {
                horizontalAlignment = HorizontalAlignment.Center;
            }
            else if (this.CL_TA == "L")
            {
                horizontalAlignment = HorizontalAlignment.Left;
            }
            VerticalAlignment verticalAlignment = VerticalAlignment.Center;

            if (this.CL_VA == "T")
            {
                verticalAlignment = VerticalAlignment.Top;
            }
            else if (this.CL_VA == "B")
            {
                verticalAlignment = VerticalAlignment.Bottom;
            }
            Grid   gridContent = this.GridContent;
            int    num         = 0;
            string text        = this.method_8(this.oQuestion.QDefine.CONTROL_MASK, 1);

            if (text == "#")
            {
                num = 1;
            }
            else if (text.ToUpper() == "G")
            {
                num = 2;
            }
            else if (this.oQuestion.QDefine.CONTROL_MASK != "" && this.oQuestion.QDefine.CONTROL_MASK != null)
            {
                num = 0;
                this.iNoOfInterval = (int)Convert.ToInt16(this.oQuestion.QDefine.CONTROL_MASK.ToString());
                if (this.iNoOfInterval < 1)
                {
                    this.iNoOfInterval = 9999;
                }
            }
            int num2 = 0;
            int num3 = 0;

            foreach (SurveyDetail surveyDetail in this.oQuestion.QCircleDetails)
            {
                string code      = surveyDetail.CODE;
                string code_TEXT = surveyDetail.CODE_TEXT;
                string text2     = "";
                if (SurveyHelper.NavOperation == "Back")
                {
                    string string_ = this.oQuestion.QuestionName + "_R" + code;
                    text2 = this.oQuestion.ReadAnswerByQuestionName(this.MySurveyId, string_);
                }
                gridContent.RowDefinitions.Add(new RowDefinition
                {
                    Height = GridLength.Auto
                });
                Border border = new Border();
                border.BorderThickness = new Thickness(1.0);
                border.BorderBrush     = borderBrush;
                bool flag = false;
                if (num == 1)
                {
                    if (this.oQuestion.QDefine.CONTROL_MASK.Contains("#" + code + "#"))
                    {
                        flag = true;
                    }
                }
                else if (num > 1)
                {
                    if (num3 == 0)
                    {
                        num3 = surveyDetail.RANDOM_SET;
                    }
                    else if (num3 != surveyDetail.RANDOM_SET)
                    {
                        if (num == 2)
                        {
                            num  = 3;
                            flag = true;
                        }
                        else
                        {
                            num = 2;
                        }
                        num3 = surveyDetail.RANDOM_SET;
                    }
                    else if (num == 3)
                    {
                        flag = true;
                    }
                }
                else if (num2 / this.iNoOfInterval % 2 > 0)
                {
                    flag = true;
                }
                if (flag)
                {
                    border.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(this.BackgroudColor));
                }
                border.SetValue(Grid.RowProperty, num2);
                border.SetValue(Grid.ColumnProperty, 0);
                gridContent.Children.Add(border);
                WrapPanel wrapPanel = new WrapPanel();
                wrapPanel.VerticalAlignment   = verticalAlignment;
                wrapPanel.HorizontalAlignment = horizontalAlignment;
                border.Child = wrapPanel;
                TextBlock textBlock = new TextBlock();
                textBlock.Text              = code_TEXT;
                textBlock.Style             = style3;
                textBlock.Foreground        = foreground;
                textBlock.TextWrapping      = TextWrapping.Wrap;
                textBlock.Margin            = new Thickness(5.0, 0.0, 5.0, 0.0);
                textBlock.VerticalAlignment = verticalAlignment;
                if (this.oQuestion.QCircleDefine.CONTROL_FONTSIZE > 0)
                {
                    textBlock.FontSize = (double)this.oQuestion.QCircleDefine.CONTROL_FONTSIZE;
                }
                wrapPanel.Children.Add(textBlock);
                border = new Border();
                border.BorderThickness = new Thickness(1.0);
                border.BorderBrush     = borderBrush;
                border.SetValue(Grid.RowProperty, num2);
                border.SetValue(Grid.ColumnProperty, 1);
                if (flag)
                {
                    border.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(this.BackgroudColor));
                }
                gridContent.Children.Add(border);
                WrapPanel wrapPanel2 = new WrapPanel();
                this.wrapSingle.Add(wrapPanel2);
                wrapPanel2.Orientation         = Orientation.Horizontal;
                wrapPanel2.VerticalAlignment   = VerticalAlignment.Center;
                wrapPanel2.HorizontalAlignment = HorizontalAlignment.Center;
                wrapPanel2.Margin = new Thickness(2.0, 5.0, 2.0, 5.0);
                wrapPanel2.Name   = "wR" + code;
                wrapPanel2.Tag    = code;
                border.Child      = wrapPanel2;
                this.oQuestion.SelectedCode.Add(text2);
                this.listButton = new List <Button>();
                foreach (SurveyDetail surveyDetail2 in this.oQuestion.QDetails)
                {
                    Button button = new Button();
                    button.Name    = "b_" + surveyDetail2.CODE;
                    button.Content = surveyDetail2.CODE_TEXT;
                    button.Margin  = new Thickness(2.0, 0.0, 2.0, 0.0);
                    button.Style   = ((surveyDetail2.CODE == text2) ? style : style2);
                    if (flag)
                    {
                        button.Opacity = 0.85;
                    }
                    button.Tag       = num2;
                    button.Click    += this.method_3;
                    button.FontSize  = (double)this.Button_FontSize;
                    button.MinWidth  = this.Button_Width;
                    button.MinHeight = (double)this.Button_Height;
                    wrapPanel2.Children.Add(button);
                    this.listButton.Add(button);
                }
                int num4 = 0;
                if ((!SurveyHelper.AutoFill || !(SurveyHelper.FillMode == "3")) && SurveyHelper.NavOperation != "Back")
                {
                    string extend_ = surveyDetail.EXTEND_4;
                    if (extend_ != "")
                    {
                        string[] array = this.oLogicEngine.aryCode(extend_, ',');
                        for (int i = 0; i < array.Count <string>(); i++)
                        {
                            using (List <Button> .Enumerator enumerator3 = this.listButton.GetEnumerator())
                            {
                                while (enumerator3.MoveNext())
                                {
                                    Button button2 = enumerator3.Current;
                                    if (button2.Name == "b_" + array[i])
                                    {
                                        num4 = 1;
                                        this.method_3(button2, new RoutedEventArgs());
                                        break;
                                    }
                                }
                                goto IL_876;
                            }
                            break;
                            IL_876 :;
                        }
                    }
                }
                if (num4 == 0 && this.oQuestion.QDetails.Count == 1 && !SurveyHelper.AutoFill && (this.oQuestion.QDefine.EXTEND_1.Contains(SurveyHelper.Only1CodeMode1) || this.oQuestion.QDefine.EXTEND_1.Contains(SurveyHelper.Only1CodeMode2)))
                {
                    this.method_3(this.listButton[0], new RoutedEventArgs());
                }
                if (SurveyHelper.AutoFill)
                {
                    Button button3;
                    if (this.oQuestion.QDefine.CONTROL_TYPE == 0)
                    {
                        button3 = autoFill.SingleButton(this.oQuestion.QDefine, this.listButton);
                    }
                    else
                    {
                        if (this.AutoFillButton == -1)
                        {
                            this.AutoFillButton = Convert.ToInt32(this.oFunc.INT((double)(this.listButton.Count <Button>() / 2), 0, 0, 0));
                        }
                        button3 = this.listButton[this.AutoFillButton];
                    }
                    if (button3 != null && num4 == 0)
                    {
                        this.method_3(button3, new RoutedEventArgs());
                    }
                }
                num2++;
            }
        }