mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-22 13:57:28 +02:00
Mini survey added.
Minor fiexes.
This commit is contained in:
parent
ddfea49ea6
commit
e321764119
73 changed files with 1628 additions and 185 deletions
45
TINKLib/ViewModel/MiniSurvey/Question/CheckOneViewModel.cs
Normal file
45
TINKLib/ViewModel/MiniSurvey/Question/CheckOneViewModel.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace TINK.ViewModel.MiniSurvey.Question
|
||||
{
|
||||
public class CheckOneViewModel : IMiniSurveyQuestion
|
||||
{
|
||||
/// <summary> Constructs object. </summary>
|
||||
/// <param name="question">Holds the question with key asked to user.</param>
|
||||
/// <param name="answers">Holds the list of possible answers with their option keys.</param>
|
||||
public CheckOneViewModel(
|
||||
KeyValuePair<string, string> question,
|
||||
Dictionary<string, string> answers)
|
||||
{
|
||||
Question = question;
|
||||
Answers = answers ?? new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
/// <summary> Holds the question with key asked to user. </summary>
|
||||
public KeyValuePair<string, string> Question { get; }
|
||||
|
||||
/// <summary> Holds the question with key asked to user exposed to GUI. </summary>
|
||||
public string QuestionText => Question.Value;
|
||||
|
||||
/// <summary> Holds the list of possible answers with their option keys. </summary>
|
||||
public Dictionary<string, string> Answers { get; }
|
||||
|
||||
/// <summary> Holds the list of possible answers exposed to GUI. </summary>
|
||||
public IEnumerable<string> AnswersText
|
||||
{
|
||||
get => Answers.Select(x => x.Value).ToList();
|
||||
set => AnswersText = Answers.Select(x => x.Value).ToList();
|
||||
}
|
||||
|
||||
/// <summary> Holds the users selected answer (one of answers) with its option key. </summary>
|
||||
public KeyValuePair<string, string> Answer { get; private set; }
|
||||
|
||||
/// <summary> Holds the users selected answer (one of answers) in GUI. </summary>
|
||||
public string AnswerText
|
||||
{
|
||||
get => Answer.Value;
|
||||
set => Answer = Answers.FirstOrDefault(x => x.Value == value);
|
||||
}
|
||||
}
|
||||
}
|
32
TINKLib/ViewModel/MiniSurvey/Question/FreeTextViewModel.cs
Normal file
32
TINKLib/ViewModel/MiniSurvey/Question/FreeTextViewModel.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace TINK.ViewModel.MiniSurvey.Question
|
||||
{
|
||||
public class FreeTextViewModel : IMiniSurveyQuestion
|
||||
{
|
||||
/// <summary> Constructs object. </summary>
|
||||
/// <param name="question">Holds the question with key asked to user.</param>
|
||||
/// <param name="answers">Holds the list of possible answers with their option keys.</param>
|
||||
public FreeTextViewModel(
|
||||
KeyValuePair<string, string> question)
|
||||
{
|
||||
Question = question;
|
||||
}
|
||||
|
||||
/// <summary> Holds the question with key asked to user. </summary>
|
||||
public KeyValuePair<string, string> Question { get; }
|
||||
|
||||
/// <summary> Holds the question with key asked to user exposed to GUI. </summary>
|
||||
public string QuestionText => Question.Value;
|
||||
|
||||
/// <summary> Holds the users selected answer with its option key. </summary>
|
||||
public KeyValuePair<string, string> Answer { get; private set; }
|
||||
|
||||
/// <summary> Holds the list of possible answers exposed to GUI. </summary>
|
||||
public string AnswerText
|
||||
{
|
||||
get => null;
|
||||
set => Answer = new KeyValuePair<string, string>(value, null);
|
||||
}
|
||||
}
|
||||
}
|
13
TINKLib/ViewModel/MiniSurvey/Question/IMiniSurveyQuestion.cs
Normal file
13
TINKLib/ViewModel/MiniSurvey/Question/IMiniSurveyQuestion.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace TINK.ViewModel.MiniSurvey.Question
|
||||
{
|
||||
public interface IMiniSurveyQuestion
|
||||
{
|
||||
/// <summary> Holds the question with key asked to user. </summary>
|
||||
KeyValuePair<string, string> Question { get; }
|
||||
|
||||
/// <summary> Holds the users selected answer with its option key. </summary>
|
||||
KeyValuePair<string, string> Answer { get; }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue