private void RemoveOption(int item) { OptionTemp.RemoveAt(item); if (OptionTemp.Count != 0) { _question.QuestionOptions = ListToString(); } OptionText = null; }
private void AddOption() { switch (TypeConverter.type[new ViewModelLocator().Questionnaire.SelectedType.Type]) { case "Image": { Browse(); byte[] imageBytes = System.IO.File.ReadAllBytes(ImagePath); string base64String = Convert.ToBase64String(System.IO.File.ReadAllBytes(ImagePath)); if (_question.AmountOfAttachments == 1) { _question.Attachments.FirstOrDefault().FilePath = base64String; } else { _question.Attachments.Add(new Attachment { FilePath = base64String }); } break; } case "MultipleChoice": { //char c; //if (OptionTemp.Count != 0) //{ // c = OptionTemp.Last()[0]; // c++; //} //else c = 'A'; //OptionTemp.Add(c + ": " + OptionText); OptionTemp.Add(OptionText); _question.QuestionOptions = ListToString(); OptionText = null; break; } case "Table": { //char c; //if (OptionTemp.Count != 0) //{ // c = OptionTemp.Last()[0]; // c++; //} //else c = 'A'; //OptionTemp.Add(c + ": " + OptionText); OptionTemp.Add(OptionText); OptionText = null; break; } } }
public string ListToString() { return(OptionTemp.Aggregate((x, y) => x + ";" + y)); }