public string FileHeaderTemplate => GetOption(CodeStyleOptions2.FileHeaderTemplate, defaultValue: string.Empty); // no fallback IDE option private TValue GetOption <TValue>(Option2 <TValue> option, TValue defaultValue) => _options.GetEditorConfigOption(option, defaultValue);
public static DiagnosticMode GetDiagnosticMode(this IGlobalOptionService globalOptions, Option2 <DiagnosticMode> option) { var diagnosticModeOption = globalOptions.GetOption(option); // If the workspace diagnostic mode is set to Default, defer to the feature flag service. if (diagnosticModeOption == DiagnosticMode.Default) { return(globalOptions.GetOption(DiagnosticOptions.LspPullDiagnosticsFeatureFlag) ? DiagnosticMode.Pull : DiagnosticMode.Push); } // Otherwise, defer to the workspace+option to determine what mode we're in. return(diagnosticModeOption); }
static void ResetOption2 <T>(IGlobalOptionService globalOptions, Option2 <T> option) { globalOptions.SetGlobalOption(new OptionKey(option, language: null), option.DefaultValue); }
// Update is called once per frame void Update() { switch (CurrentStage) { case EVENT_STAGE.NO_EVENT: if (CurrentEvent) { CurrentStage = EVENT_STAGE.CHOOSE_OPTION; } break; case EVENT_STAGE.CHOOSE_OPTION: EventPanel.SetActive(true); Option1.SetActive(true); Option2.SetActive(true); Option3.SetActive(true); // Apply UI/Text Title.text = CurrentEvent.GetComponent <EventBase>().Title; Description.text = CurrentEvent.GetComponent <EventBase>().Description; Option1.GetComponentInChildren <Text>().text = CurrentEvent.transform.GetChild(0).GetComponent <EventOption>().Description; Option2.GetComponentInChildren <Text>().text = CurrentEvent.transform.GetChild(1).GetComponent <EventOption>().Description; Option3.GetComponentInChildren <Text>().text = CurrentEvent.transform.GetChild(2).GetComponent <EventOption>().Description; if (Option3.GetComponentInChildren <Text>().text == "") { Option3.SetActive(false); } if (Option2.GetComponentInChildren <Text>().text == "") { Option2.SetActive(false); } if (Option1.GetComponentInChildren <Text>().text == "") { Option1.SetActive(false); CurrentEvent.transform.GetChild(0).gameObject.GetComponent <EventOption>().DoEffect(); CurrentStage = EVENT_STAGE.OUTCOME; } if (i_ChosenOption != 0) { CurrentEvent.transform.GetChild(i_ChosenOption - 1).gameObject.GetComponent <EventOption>().DoEffect(); SelectedOption = CurrentEvent.transform.GetChild(i_ChosenOption - 1).gameObject; CurrentStage = EVENT_STAGE.OUTCOME; } break; case EVENT_STAGE.OUTCOME: if (SelectedOption) { Description.text = SelectedOption.GetComponent <EventOption>().GetSelectedOutcome().GetComponent <EventOutcome>().Description; } Option1.SetActive(false); Option2.SetActive(false); Option3.SetActive(false); EndButton.SetActive(true); Destroy(CurrentEvent); break; } }
public void Add <T>(Option2 <CodeStyleOption2 <T> > option, T value, NotificationOption2 notification) => _options.Add(new OptionKey2(option), new CodeStyleOption2 <T>(value, notification));
public static ValueTask <ImmutableArray <DiagnosticData> > GetPushDiagnosticsAsync(this IDiagnosticService service, DiagnosticBucket bucket, bool includeSuppressedDiagnostics, Option2 <DiagnosticMode> diagnosticMode, CancellationToken cancellationToken) => service.GetPushDiagnosticsAsync(bucket.Workspace, bucket.ProjectId, bucket.DocumentId, bucket.Id, includeSuppressedDiagnostics, diagnosticMode, cancellationToken);
public static T GetOption <T>(this AnalyzerConfigOptions analyzerConfigOptions, Option2 <T> option) => GetOptionWithAssertOnFailure <T>(analyzerConfigOptions, option);
public void Add <T>(Option2 <T> option, T value) => _options.Add(new OptionKey2(option), value);
public DiagnosticMode GetDiagnosticMode(Option2 <DiagnosticMode> diagnosticMode) => _workspace.Options.GetOption(diagnosticMode);
public static T GetOption <T>(this AnalyzerOptions analyzerOptions, Option2 <T> option, SyntaxTree syntaxTree, CancellationToken cancellationToken) => GetOption <T>(analyzerOptions, option, language: null, syntaxTree, cancellationToken);
public ImmutableArray <DiagnosticBucket> GetPushDiagnosticBuckets(Workspace workspace, ProjectId?projectId, DocumentId?documentId, Option2 <DiagnosticMode> diagnosticMode, CancellationToken cancellationToken) { return(GetDiagnosticBuckets(workspace, projectId, documentId)); }
public ValueTask <ImmutableArray <DiagnosticData> > GetPushDiagnosticsAsync(Workspace workspace, ProjectId?projectId, DocumentId?documentId, object?id, bool includeSuppressedDiagnostics, Option2 <DiagnosticMode> diagnosticMode, CancellationToken cancellationToken) { return(new ValueTask <ImmutableArray <DiagnosticData> >(GetDiagnostics(workspace, projectId, documentId))); }
public DiagnosticMode GetDiagnosticMode(Option2 <DiagnosticMode> option) { var lazy = GetLazy(option); return(lazy.Value); }
public static bool IsPushDiagnostics(this IGlobalOptionService globalOptions, Option2 <DiagnosticMode> option) => GetDiagnosticMode(globalOptions, option) == DiagnosticMode.Push;
public ValueTask <ImmutableArray <DiagnosticData> > GetPushDiagnosticsAsync(Workspace workspace, ProjectId projectId, DocumentId documentId, object id, bool includeSuppressedDiagnostics, Option2 <DiagnosticMode> diagnosticMode, CancellationToken cancellationToken) => GetDiagnosticsAsync(workspace, projectId, documentId, id, includeSuppressedDiagnostics, forPullDiagnostics: false, diagnosticMode, cancellationToken);
public void Set <T>(Option2 <T> option, T value) => _options[new OptionKey2(option)] = value;
public ImmutableArray <DiagnosticBucket> GetPushDiagnosticBuckets(Workspace workspace, ProjectId projectId, DocumentId documentId, Option2 <DiagnosticMode> diagnosticMode, CancellationToken cancellationToken) => GetDiagnosticBuckets(workspace, projectId, documentId, forPullDiagnostics: false, diagnosticMode, cancellationToken);
public void Add <T>(Option2 <CodeStyleOption2 <T> > option, T value) => Add(option, value, option.DefaultValue.Notification);
public ActionResult AddQuestionnaire(QuestionnairesViewModel Model, string[] BlankOptions, string[] AnswerOptions) { try { VTSDBEntities objDB = new VTSDBEntities(); if (Model.QuestionType == DAL.Model.QuestionType.SingleLine) { Question1 question1 = new Question1(); question1.QuestionSentence = Model.QuestionText; question1.OriginalSentence = ""; List <Option1> QuesOptions = new List <Option1>(); foreach (string OptionText in BlankOptions) { Option1 EachOption = new Option1(); EachOption.OptionText = OptionText; EachOption.Question1 = question1; QuesOptions.Add(EachOption); } List <Answer1> AllAnswers = new List <Answer1>(); foreach (string AnswerText in AnswerOptions) { Answer1 EachAnswer = new Answer1(); EachAnswer.AnswerText = AnswerText; EachAnswer.Question1 = question1; AllAnswers.Add(EachAnswer); } question1.Answer1 = AllAnswers; question1.Option1 = QuesOptions; objDB.Question1.Add(question1); objDB.SaveChanges(); ViewBag.SuccessMsg = "Questionnaire added successfully."; } else if (Model.QuestionType == DAL.Model.QuestionType.MultiLine) { Question2 question2 = new Question2(); question2.QuestionText = Model.QuestionText; List <Option2> QuesOptions = new List <Option2>(); foreach (string OptionText in BlankOptions) { Option2 EachOption = new Option2(); EachOption.OptionText = OptionText; EachOption.Question2 = question2; QuesOptions.Add(EachOption); } List <Answer2> AllAnswers = new List <Answer2>(); Answer2 EachAnswer = new Answer2(); EachAnswer.Answer = Model.AnswerText; EachAnswer.Question2 = question2; AllAnswers.Add(EachAnswer); question2.Answer2 = AllAnswers; question2.Option2 = QuesOptions; objDB.Question2.Add(question2); objDB.SaveChanges(); ViewBag.SuccessMsg = "Questionnaire added successfully."; } else if (Model.QuestionType == DAL.Model.QuestionType.SingleOption) { Question3 question3 = new Question3(); question3.QuestionText = Model.QuestionText; List <Answer3> AllAnswers = new List <Answer3>(); foreach (string AnswerText in AnswerOptions) { Answer3 EachAnswer = new Answer3(); EachAnswer.Answer = AnswerText; EachAnswer.Question3 = question3; AllAnswers.Add(EachAnswer); } question3.Answer3 = AllAnswers; objDB.Question3.Add(question3); objDB.SaveChanges(); ViewBag.SuccessMsg = "Questionnaire added successfully."; } else if (Model.QuestionType == DAL.Model.QuestionType.MultiOption) { Question4 question4 = new Question4(); question4.QuestionText = Model.QuestionText; List <Answer4> AllAnswers = new List <Answer4>(); foreach (string AnswerText in AnswerOptions) { Answer4 EachAnswer = new Answer4(); EachAnswer.Answer = AnswerText; EachAnswer.Question4 = question4; AllAnswers.Add(EachAnswer); } question4.Answer4 = AllAnswers; objDB.Question4.Add(question4); objDB.SaveChanges(); ViewBag.SuccessMsg = "Questionnaire added successfully."; } else if (Model.QuestionType == DAL.Model.QuestionType.Date) { Question5 question5 = new Question5(); question5.QuestionText = Model.QuestionText; List <Answer5> AllAnswers = new List <Answer5>(); foreach (string AnswerText in AnswerOptions) { Answer5 EachAnswer = new Answer5(); EachAnswer.Answer = AnswerText; EachAnswer.Question5 = question5; AllAnswers.Add(EachAnswer); } question5.Answer5 = AllAnswers; objDB.Question5.Add(question5); objDB.SaveChanges(); ViewBag.SuccessMsg = "Questionnaire added successfully."; } } catch (System.Data.Entity.Validation.DbEntityValidationException dbEx) { Exception raise = dbEx; foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { string message = string.Format("{0}:{1}", validationErrors.Entry.Entity.ToString(), validationError.ErrorMessage); // raise a new exception nesting // the current instance as InnerException raise = new InvalidOperationException(message, raise); } } //throw raise; ViewBag.ErrorMsg = "An error occurred while saving the questionnaire."; } ModelState.Clear(); return(View()); }
internal static (OptionKey2, object) SingleOption <T>(Option2 <T> option, T enabled) => (new OptionKey2(option), enabled);
internal T GetOption <T>(Option2 <T> option) => _optionSet.GetOption(option);
public T?GetOption <T>(Option2 <T> option) => _globalOptionService.GetOption(option);
internal void SetOption <T>(Option2 <T> option, T value) { _optionSet = _optionSet.WithChangedOption(option, value); OnOptionChanged(new OptionKey(option)); }
public T GetOption <T>(Option2 <T> option) { return((T)_optionsByOption[option]); }
[return : MaybeNull] public T GetOption <T>(Option2 <T> option) => _globalOptionService.GetOption(option);