- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Animation;
- using System.Windows.Shapes;
- namespace SFGS
- {
- public partial class Option : UserControl
- {
- public Option()
- {
- InitializeComponent();
- }
- public Option(string groupName)
- {
- InitializeComponent();
- this.rbA.GroupName = groupName;
- this.rbB.GroupName = groupName;
- this.rbC.GroupName = groupName;
- this.rbD.GroupName = groupName;
- }
- public Option(string serialNumber, string questionName, string optionA, string optionB, string optionC, string optionD,string groupName)
- {
- InitializeComponent();
- this.txtSerialNumber.Text = serialNumber + ".";
- this.txtQuestionName.Text = questionName;
- this.rbA.Content = optionA;
- this.rbB.Content = optionB;
- this.rbC.Content = optionC;
- this.rbD.Content = optionD;
- this.rbA.GroupName = groupName;
- this.rbB.GroupName = groupName;
- this.rbC.GroupName = groupName;
- this.rbD.GroupName = groupName;
- }
- public string SerialNumber
- {
- get { return this.txtSerialNumber.Text.Trim().Substring(0, this.txtSerialNumber.Text.Trim().Length - 1); }
- set { this.txtSerialNumber.Text = value + "."; }
- }
- public string QuestionName
- {
- get { return this.txtQuestionName.Text.Trim(); }
- set { this.txtQuestionName.Text = value; }
- }
- public string OptionA
- {
- get { return this.rbA.Content.ToString().Trim(); }
- set { this.rbA.Content = value; }
- }
- public string OptionB
- {
- get { return this.rbB.Content.ToString().Trim(); }
- set { this.rbB.Content = value; }
- }
- public string OptionC
- {
- get { return this.rbC.Content.ToString().Trim(); }
- set { this.rbC.Content = value; }
- }
- public string OptionD
- {
- get { return this.rbD.Content.ToString().Trim(); }
- set { this.rbD.Content = value; }
- }
- public string DefaultOption
- {
- set
- {
- switch(value.ToUpper())
- {
- case "A":
- this.rbA.IsChecked = true;
- break;
- case "B":
- this.rbB.IsChecked = true;
- break;
- case "C":
- this.rbC.IsChecked = true;
- break;
- case "D":
- this.rbD.IsChecked = true;
- break;
- default:
- this.rbA.IsChecked = true;
- break;
- }
- }
- }
- public string GroupName
- {
- set
- {
- this.rbA.GroupName = value;
- this.rbB.GroupName = value;
- this.rbC.GroupName = value;
- this.rbD.GroupName = value;
- }
- get
- {
- return this.rbA.GroupName;
- }
- }
- public string Checked
- {
- get
- {
- if (this.rbA.IsChecked==true)
- {
- return "A";
- }
- else if(this.rbB.IsChecked==true)
- {
- return "B";
- }
- else if(this.rbC.IsChecked==true)
- {
- return "C";
- }
- else
- {
- return "D";
- }
- }
- }
- }
- }