示例#1
0
        private void LoadQuestionInfo(int serialNumber)
        {
            try
            {
                INRMainService myMainService = BusinessStaticInstances.GetSingleMainServiceInstance();
                questionObj = myMainService.GetQuestionViewBySerialNumber(serialNumber, recordId);
                pb_QuestionProcess.Value           = questionObj.CurrentProgress * 100;
                textblock_FirstCategory.Text       = questionObj.FirstCategoryName;
                textblock_SecondCategory.Text      = questionObj.SecondCategoryName;
                textblock_QuestionDescription.Text = questionObj.Description;
                switch (questionObj.Type)
                {
                case QuestionType.Standard:
                    textblock_FirstCategory.Foreground       = new SolidColorBrush(Color.FromRgb(112, 237, 145));
                    textblock_SecondCategory.Foreground      = new SolidColorBrush(Color.FromRgb(112, 237, 145));
                    textblock_QuestionDescription.Foreground = new SolidColorBrush(Color.FromRgb(112, 237, 145));
                    pb_QuestionProcess.Foreground            = new SolidColorBrush(Color.FromRgb(112, 237, 145));
                    var control1 = new OptionControl_Type1(questionObj);
                    control1.FinishedInputEvent += Control_FinishedInputEvent;
                    grid_Options.Children.Add(control1);
                    break;

                case QuestionType.Optional:
                    textblock_FirstCategory.Foreground       = new SolidColorBrush(Color.FromRgb(249, 81, 114));
                    textblock_SecondCategory.Foreground      = new SolidColorBrush(Color.FromRgb(249, 81, 114));
                    textblock_QuestionDescription.Foreground = new SolidColorBrush(Color.FromRgb(249, 81, 114));
                    pb_QuestionProcess.Foreground            = new SolidColorBrush(Color.FromRgb(249, 81, 114));
                    var control2 = new OptionControl_Type2(questionObj);
                    control2.FinishedInputEvent += Control_FinishedInputEvent;
                    grid_Options.Children.Add(control2);
                    break;

                case QuestionType.Choice:
                    textblock_FirstCategory.Foreground       = new SolidColorBrush(Color.FromRgb(249, 81, 114));
                    textblock_SecondCategory.Foreground      = new SolidColorBrush(Color.FromRgb(249, 81, 114));
                    textblock_QuestionDescription.Foreground = new SolidColorBrush(Color.FromRgb(249, 81, 114));
                    pb_QuestionProcess.Foreground            = new SolidColorBrush(Color.FromRgb(249, 81, 114));
                    var control3 = new OptionControl_Type3(questionObj);
                    control3.FinishedInputEvent += Control_FinishedInputEvent;
                    grid_Options.Children.Add(control3);
                    break;

                default:
                    ReturnMainPage();
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("加载问题失败:" + ex.Message);
                ReturnMainPage();
            }
        }
 public OptionControl_Type2(QuestionViewDto questionObj)
 {
     InitializeComponent();
     _questionObj = questionObj;
 }