Exemplo n.º 1
0
        private void method_0(object sender, RoutedEventArgs e)
        {
            this.MySurveyId            = SurveyHelper.SurveyID;
            this.CurPageId             = SurveyHelper.NavCurPage;
            SurveyHelper.PageStartTime = DateTime.Now;
            this.txtSurvey.Text        = this.MySurveyId;
            this.btnNav.Content        = this.btnNav_Content;
            this.oQuestion.Init(this.CurPageId, 0);
            this.MyNav.GroupLevel = this.oQuestion.QDefine.GROUP_LEVEL;
            if (this.MyNav.GroupLevel != "")
            {
                this.MyNav.GroupPageType  = this.oQuestion.QDefine.GROUP_PAGE_TYPE;
                this.MyNav.GroupCodeA     = this.oQuestion.QDefine.GROUP_CODEA;
                this.MyNav.CircleACurrent = SurveyHelper.CircleACurrent;
                this.MyNav.CircleACount   = SurveyHelper.CircleACount;
                if (this.MyNav.GroupLevel == "B")
                {
                    this.MyNav.GroupCodeB     = this.oQuestion.QDefine.GROUP_CODEB;
                    this.MyNav.CircleBCurrent = SurveyHelper.CircleBCurrent;
                    this.MyNav.CircleBCount   = SurveyHelper.CircleBCount;
                }
                this.MyNav.GetCircleInfo(this.MySurveyId);
                this.oQuestion.QuestionName = this.oQuestion.QuestionName + this.MyNav.QName_Add;
                List <VEAnswer> list = new List <VEAnswer>();
                list.Add(new VEAnswer
                {
                    QUESTION_NAME = this.MyNav.GroupCodeA,
                    CODE          = this.MyNav.CircleACode,
                    CODE_TEXT     = this.MyNav.CircleCodeTextA
                });
                SurveyHelper.CircleACode     = this.MyNav.CircleACode;
                SurveyHelper.CircleACodeText = this.MyNav.CircleCodeTextA;
                SurveyHelper.CircleACurrent  = this.MyNav.CircleACurrent;
                SurveyHelper.CircleACount    = this.MyNav.CircleACount;
                if (this.MyNav.GroupLevel == "B")
                {
                    list.Add(new VEAnswer
                    {
                        QUESTION_NAME = this.MyNav.GroupCodeB,
                        CODE          = this.MyNav.CircleBCode,
                        CODE_TEXT     = this.MyNav.CircleCodeTextB
                    });
                    SurveyHelper.CircleBCode     = this.MyNav.CircleBCode;
                    SurveyHelper.CircleBCodeText = this.MyNav.CircleCodeTextB;
                    SurveyHelper.CircleBCurrent  = this.MyNav.CircleBCurrent;
                    SurveyHelper.CircleBCount    = this.MyNav.CircleBCount;
                }
            }
            else
            {
                SurveyHelper.CircleACode     = "";
                SurveyHelper.CircleACodeText = "";
                SurveyHelper.CircleACurrent  = 0;
                SurveyHelper.CircleACount    = 0;
                SurveyHelper.CircleBCode     = "";
                SurveyHelper.CircleBCodeText = "";
                SurveyHelper.CircleBCurrent  = 0;
                SurveyHelper.CircleBCount    = 0;
                this.MyNav.GroupCodeA        = "";
                this.MyNav.CircleACurrent    = 0;
                this.MyNav.CircleACount      = 0;
                this.MyNav.GroupCodeB        = "";
                this.MyNav.CircleBCurrent    = 0;
                this.MyNav.CircleBCount      = 0;
            }
            this.oLogicEngine.SurveyID = this.MySurveyId;
            if (this.MyNav.GroupLevel != "")
            {
                this.oLogicEngine.CircleACode     = SurveyHelper.CircleACode;
                this.oLogicEngine.CircleACodeText = SurveyHelper.CircleACodeText;
                this.oLogicEngine.CircleACount    = SurveyHelper.CircleACount;
                this.oLogicEngine.CircleACurrent  = SurveyHelper.CircleACurrent;
                this.oLogicEngine.CircleBCode     = SurveyHelper.CircleBCode;
                this.oLogicEngine.CircleBCodeText = SurveyHelper.CircleBCodeText;
                this.oLogicEngine.CircleBCount    = SurveyHelper.CircleBCount;
                this.oLogicEngine.CircleBCurrent  = SurveyHelper.CircleBCurrent;
            }
            string        string_ = this.oQuestion.QDefine.QUESTION_TITLE;
            List <string> list2   = this.oBoldTitle.ParaToList(string_, "//");

            string_ = list2[0];
            this.oBoldTitle.SetTextBlock(this.txtQuestionTitle, string_, this.oQuestion.QDefine.TITLE_FONTSIZE, "", true);
            string_ = ((list2.Count > 1) ? list2[1] : this.oQuestion.QDefine.QUESTION_CONTENT);
            this.oBoldTitle.SetTextBlock(this.txtCircleTitle, string_, 0, "", true);
            if (this.oQuestion.QDefine.CONTROL_TYPE > 0)
            {
                this.txtFill.MaxLength = this.oQuestion.QDefine.CONTROL_TYPE;
                this.txtFill.Width     = (double)this.oQuestion.QDefine.CONTROL_TYPE * this.txtFill.FontSize * Math.Pow(0.955, (double)this.oQuestion.QDefine.CONTROL_TYPE);
            }
            if (this.oQuestion.QDefine.CONTROL_HEIGHT != 0)
            {
                this.txtFill.Height = (double)this.oQuestion.QDefine.CONTROL_HEIGHT;
            }
            if (this.oQuestion.QDefine.CONTROL_WIDTH != 0)
            {
                this.txtFill.Width = (double)this.oQuestion.QDefine.CONTROL_WIDTH;
            }
            if (this.oQuestion.QDefine.CONTROL_FONTSIZE > 0)
            {
                this.txtFill.FontSize = (double)this.oQuestion.QDefine.CONTROL_FONTSIZE;
            }
            if (this.oQuestion.QDefine.CONTROL_TOOLTIP.Trim() != "")
            {
                string_ = this.oQuestion.QDefine.CONTROL_TOOLTIP;
                list2   = this.oBoldTitle.ParaToList(string_, "//");
                string_ = list2[0];
                this.oBoldTitle.SetTextBlock(this.txtBefore, string_, this.oQuestion.QDefine.CONTROL_FONTSIZE, "", true);
                if (list2.Count > 1)
                {
                    string_ = list2[1];
                    this.oBoldTitle.SetTextBlock(this.txtAfter, string_, this.oQuestion.QDefine.CONTROL_FONTSIZE, "", true);
                }
            }
            if (this.oQuestion.QDefine.PRESET_LOGIC != "")
            {
                this.txtFill.Text = this.oLogicEngine.stringResult(this.oQuestion.QDefine.PRESET_LOGIC);
                this.txtFill.SelectAll();
            }
            this.txtFill.Focus();
            if (this.oQuestion.QDefine.DETAIL_ID != "")
            {
                if (this.oQuestion.QDefine.LIMIT_LOGIC != "")
                {
                    this.oLogicEngine.SurveyID = this.MySurveyId;
                    if (this.MyNav.GroupLevel != "")
                    {
                        this.oLogicEngine.CircleACode     = SurveyHelper.CircleACode;
                        this.oLogicEngine.CircleACodeText = SurveyHelper.CircleACodeText;
                        this.oLogicEngine.CircleACount    = SurveyHelper.CircleACount;
                        this.oLogicEngine.CircleACurrent  = SurveyHelper.CircleACurrent;
                        this.oLogicEngine.CircleBCode     = SurveyHelper.CircleBCode;
                        this.oLogicEngine.CircleBCodeText = SurveyHelper.CircleBCodeText;
                        this.oLogicEngine.CircleBCount    = SurveyHelper.CircleBCount;
                        this.oLogicEngine.CircleBCurrent  = SurveyHelper.CircleBCurrent;
                    }
                    string[]            array = this.oLogicEngine.aryCode(this.oQuestion.QDefine.LIMIT_LOGIC, ',');
                    List <SurveyDetail> list3 = new List <SurveyDetail>();
                    for (int i = 0; i < array.Count <string>(); i++)
                    {
                        foreach (SurveyDetail surveyDetail in this.oQuestion.QDetails)
                        {
                            if (surveyDetail.CODE == array[i].ToString())
                            {
                                list3.Add(surveyDetail);
                                break;
                            }
                        }
                    }
                    list3.Sort(new Comparison <SurveyDetail>(FillDec.Class4.instance.method_0));
                    this.oQuestion.QDetails = list3;
                }
                if (this.oQuestion.QDefine.DETAIL_ID.Substring(0, 1) == "#")
                {
                    for (int j = 0; j < this.oQuestion.QDetails.Count <SurveyDetail>(); j++)
                    {
                        this.oQuestion.QDetails[j].CODE_TEXT = this.oBoldTitle.ReplaceABTitle(this.oQuestion.QDetails[j].CODE_TEXT);
                    }
                }
                this.Button_Width    = 200.0;
                this.Button_Height   = SurveyHelper.BtnHeight;
                this.Button_FontSize = SurveyHelper.BtnFontSize;
                if (this.oQuestion.QDefine.CONTROL_HEIGHT != 0)
                {
                    this.Button_Height = this.oQuestion.QDefine.CONTROL_HEIGHT;
                }
                if (this.oQuestion.QDefine.CONTROL_WIDTH != 0)
                {
                    this.Button_Width = (double)this.oQuestion.QDefine.CONTROL_WIDTH;
                }
                if (this.oQuestion.QDefine.CONTROL_FONTSIZE != 0)
                {
                    this.Button_FontSize = this.oQuestion.QDefine.CONTROL_FONTSIZE;
                }
                this.method_1();
            }
            if (this.oQuestion.QDefine.NOTE != "")
            {
                string_ = this.oQuestion.QDefine.NOTE;
                list2   = this.oBoldTitle.ParaToList(string_, "//");
                string_ = list2[0];
                this.oBoldTitle.SetTextBlock(this.txtQuestionNote, string_, 0, "", true);
                if (list2.Count > 1)
                {
                    string text = "";
                    int    num  = list2[1].IndexOf(">");
                    if (num > 0)
                    {
                        text = this.method_8(list2[1], num + 1, -9999);
                        num  = this.method_10(this.method_6(list2[1], 1, num - 1));
                    }
                    else
                    {
                        text = list2[1];
                    }
                    if (this.oQuestion.QDefine.GROUP_LEVEL != "" && num > 0)
                    {
                        this.oQuestion.InitCircle();
                        string text2 = "";
                        if (this.MyNav.GroupLevel == "A")
                        {
                            text2 = this.MyNav.CircleACode;
                        }
                        if (this.MyNav.GroupLevel == "B")
                        {
                            text2 = this.MyNav.CircleBCode;
                        }
                        if (text2 != "")
                        {
                            foreach (SurveyDetail surveyDetail2 in this.oQuestion.QCircleDetails)
                            {
                                if (surveyDetail2.CODE == text2)
                                {
                                    text = surveyDetail2.EXTEND_1;
                                    break;
                                }
                            }
                        }
                    }
                    if (text != "")
                    {
                        string text3 = Environment.CurrentDirectory + "\\Media\\" + text;
                        if (this.method_7(text, 1) == "#")
                        {
                            text3 = "..\\Resources\\Pic\\" + this.method_8(text, 1, -9999);
                        }
                        else if (!File.Exists(text3))
                        {
                            text3 = "..\\Resources\\Pic\\" + text;
                        }
                        Image image = new Image();
                        if (num > 0)
                        {
                            image.Height = (double)num;
                        }
                        image.Stretch = Stretch.Uniform;
                        image.Margin  = new Thickness(0.0, 10.0, 20.0, 10.0);
                        image.SetValue(Grid.ColumnProperty, 0);
                        image.SetValue(Grid.RowProperty, 0);
                        image.HorizontalAlignment = HorizontalAlignment.Center;
                        image.VerticalAlignment   = VerticalAlignment.Center;
                        try
                        {
                            BitmapImage bitmapImage = new BitmapImage();
                            bitmapImage.BeginInit();
                            bitmapImage.UriSource = new Uri(text3, UriKind.RelativeOrAbsolute);
                            bitmapImage.EndInit();
                            image.Source = bitmapImage;
                            this.NoteArea.Children.Add(image);
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
            }
            if (SurveyMsg.FunctionAttachments == "FunctionAttachments_true" && this.oQuestion.QDefine.IS_ATTACH == 1)
            {
                this.btnAttach.Visibility = Visibility.Visible;
            }
            if (SurveyHelper.AutoFill)
            {
                AutoFill autoFill = new AutoFill();
                autoFill.oLogicEngine = this.oLogicEngine;
                if (this.txtFill.Text == "")
                {
                    this.txtFill.Text = autoFill.FillDec(this.oQuestion.QDefine);
                }
                if (autoFill.AutoNext(this.oQuestion.QDefine))
                {
                    this.btnNav_Click(this, e);
                }
            }
            Style  style        = (Style)base.FindResource("SelBtnStyle");
            string navOperation = SurveyHelper.NavOperation;

            if (!(navOperation == "Back"))
            {
                if (!(navOperation == "Normal"))
                {
                    if (!(navOperation == "Jump"))
                    {
                    }
                }
                else if (this.oQuestion.QDefine.EXTEND_1.Contains(SurveyHelper.Only1CodeMode3) && this.txtFill.Text != "" && !SurveyHelper.AutoFill)
                {
                    this.btnNav_Click(this, e);
                }
            }
            else
            {
                this.txtFill.Text = this.oQuestion.ReadAnswerByQuestionName(this.MySurveyId, this.oQuestion.QuestionName);
                foreach (object obj in this.wrapOther.Children)
                {
                    Button button = (Button)obj;
                    string b      = (string)button.Tag;
                    if (this.txtFill.Text == b)
                    {
                        button.Style            = style;
                        this.txtFill.Background = Brushes.LightGray;
                        this.txtFill.Foreground = Brushes.LightGray;
                        this.txtFill.IsEnabled  = false;
                        break;
                    }
                }
            }
            new SurveyBiz().ClearPageAnswer(this.MySurveyId, SurveyHelper.SurveySequence);
            this.SecondsWait = this.oQuestion.QDefine.PAGE_COUNT_DOWN;
            if (this.SecondsWait > 0)
            {
                this.SecondsCountDown  = this.SecondsWait;
                this.btnNav.Foreground = Brushes.Gray;
                this.btnNav.Content    = this.SecondsCountDown.ToString();
                this.timer.Interval    = TimeSpan.FromMilliseconds(1000.0);
                this.timer.Tick       += this.timer_Tick;
                this.timer.Start();
            }
            this.txtFill.SelectAll();
            this.PageLoaded = true;
        }