public override void Process(TagHelperContext context, TagHelperOutput output) { Name = Name.WithArraySuffix(); base.Process(context, output); if (!string.IsNullOrEmpty(Name)) { output.Attributes.Add($"data-{ElementName}-name", Name); } RenderFieldHeader(context, output); var id = GetDomId(); var datalistId = "suggestion-" + id ?? Guid.NewGuid().ToString(); var name = Name; output.Attributes.Add("data-aiplugs-tag-ignore-case", IgnoreCase.ToString().ToLower()); if (Ajax != null) { output.Attributes.Add($"data-aiplugs-tag-ajax-url", Ajax.Url ?? ""); if (Ajax.Headers != null) { foreach (var kv in Ajax.Headers) { output.Attributes.Add($"data-aiplugs-tag-ajax-headers-{kv.Key}", kv.Value); } } output.Attributes.Add("data-aiplugs-tag-ajax-label", Ajax.Label ?? "label"); output.Attributes.Add("data-aiplugs-tag-ajax-value", Ajax.Value ?? "value"); } RenderFieldFooter(context, output, name); output.Tag("div", () => { output.Attr("class", "aiplugs-tag__values"); output.Attr("data-target", "aiplugs-tag.items"); }, () => { RenderInput(context, output, name, target: false); output.Html("<template data-target=\"aiplugs-tag.template\">"); RenderValue(context, output, name); output.Html("</template>"); foreach (var value in Value ?? new string[0]) { RenderValue(context, output, name, value); } output.Tag("input", () => { output.Attr("list", datalistId); output.Attr("class", "aiplugs-tag__input val-ignore"); output.Attr("data-target", "aiplugs-tag.input"); output.Attr("data-action", "keydown->aiplugs-tag#onKeydown"); }); if (Ajax != null) { output.Html($"<datalist id=\"{datalistId}\" data-target=\"aiplugs-tag.suggestion\"></datalist>"); } }); }
public override XmlElement ToXml(XmlDocument doc) { var root = base.ToXml(doc); root["Comparison"].SetAttribute("ignoreCase", IgnoreCase.ToString()); root["Comparison"].SetAttribute("isContained", IsContained.ToString()); return(root); }
public override string ToString() { StringBuilder builder = new StringBuilder(); builder.AppendLine("Exclusions:"); foreach (CheckBoxModel exclusion in mExclusions) { builder.AppendLine(String.Format("\t{0}: {1}", exclusion.Text, exclusion.Checked.ToString())); } builder.AppendLine("Pattern: " + Pattern); builder.AppendLine("Scope: " + Scope); builder.AppendLine("Search Dir: " + SearchDirectory); builder.AppendLine("Ignore Case: " + IgnoreCase.ToString()); builder.AppendLine("UseRegex: " + UseRegex.ToString()); builder.AppendLine("Search Subdirectories: " + SearchSubdirectories.ToString()); builder.AppendLine("Whole Word: " + WholeWord.ToString()); builder.AppendLine("Sort By File: " + SortByFile.ToString()); builder.AppendLine("File Name Search: " + FileNameSearch.ToString()); return(builder.ToString()); }
/// <summary> /// Saves advanced find settings to isolated storage. /// </summary> public void SaveSettings() { string searchCategories = string.Empty; if (SearchCategories.Any(category => category.Selected)) { searchCategories = SearchCategories .Where(category => category.Selected) .Select(category => category.Name) .Aggregate((str1, str2) => str1 + "," + str2); } IsolatedStorageManager.WriteToIsolatedStorage("MeasurementSearchText", SearchText); IsolatedStorageManager.WriteToIsolatedStorage("MeasurementSearchIgnoreCase", IgnoreCase.ToString()); IsolatedStorageManager.WriteToIsolatedStorage("MeasurementSearchUseWildcards", UseWildcards.ToString()); IsolatedStorageManager.WriteToIsolatedStorage("MeasurementSearchUseRegex", UseRegex.ToString()); IsolatedStorageManager.WriteToIsolatedStorage("MeasurementSearchCategories", searchCategories); }
/// <summary> /// Query on Wolfram Alpha using the specified /// </summary> /// <param name="query">The query you would like to search for on Wolfram Alpha</param> /// <returns>The results of the query</returns> public QueryResult Query(string query) { //http://api.wolframalpha.com/v2/query?input=xx&appid=xxxxx RestRequest request = CreateRequest("query", query); //Output if (Formats.HasElements()) { request.AddParameter("format", string.Join(",", Formats)); } if (OutputUnit != Unit.NotSet) { request.AddParameter("units", OutputUnit.ToString().ToLower()); } if (Assumptions.HasElements()) { foreach (string assumption in Assumptions) { request.AddParameter("assumption", assumption); } } //Filtering if (IncludePodIDs.HasElements()) { foreach (string include in IncludePodIDs) { request.AddParameter("includepodid", include); } } if (ExcludePodIDs.HasElements()) { foreach (string exclude in ExcludePodIDs) { request.AddParameter("excludepodid", exclude); } } if (PodTitles.HasElements()) { foreach (string podTitle in PodTitles) { request.AddParameter("podtitle", podTitle); } } if (PodIndex.HasElements()) { request.AddParameter("podindex", string.Join(",", PodIndex)); } if (Scanners.HasElements()) { request.AddParameter("scanner", string.Join(",", Scanners)); } //Timeout if (ParseTimeout >= Epsilon) { request.AddParameter("parsetimeout", ParseTimeout.ToString(_culture)); } if (ScanTimeout >= Epsilon) { request.AddParameter("scantimeout", ScanTimeout.ToString(_culture)); } if (PodTimeout >= Epsilon) { request.AddParameter("podtimeout", PodTimeout.ToString(_culture)); } if (FormatTimeout >= Epsilon) { request.AddParameter("formattimeout", FormatTimeout.ToString(_culture)); } //Async if (UseAsync) { request.AddParameter("async", UseAsync.ToString().ToLower()); } //Location if (IpAddress != null) { request.AddParameter("ip", IpAddress.ToString()); } if (!string.IsNullOrEmpty(Location)) { request.AddParameter("location", Location); } if (GPSLocation != null) { request.AddParameter("latlong", GPSLocation.ToString()); } //Size if (Width >= 1f) { request.AddParameter("width", Width); } if (MaxWidth >= 1f) { request.AddParameter("maxwidth", MaxWidth); } if (PlotWidth >= 1f) { request.AddParameter("plotwidth", PlotWidth); } if (Magnification >= 0.1f) { request.AddParameter("mag", Magnification.ToString(_culture)); } //Misc if (!string.IsNullOrEmpty(Signature)) { request.AddParameter("sig", Signature); } if (ReInterpret.HasValue) { request.AddParameter("reinterpret", ReInterpret.ToString().ToLower()); } if (IgnoreCase.HasValue) { request.AddParameter("ignorecase", IgnoreCase.ToString().ToLower()); } if (EnableTranslate.HasValue) { request.AddParameter("translation", EnableTranslate.ToString().ToLower()); } QueryResult results = GetResponse <QueryResult>(request); return(results); }
public override void Process(TagHelperContext context, TagHelperOutput output) { base.Process(context, output); RenderFieldHeader(context, output); var id = GetDomId(); var type = (Type ?? "text").ToLower().Trim(); if (Ajax != null) { output.Attributes.Add($"data-aiplugs-input-ajax-url", Ajax.Url ?? ""); if (Ajax.Headers != null) { foreach (var kv in Ajax.Headers) { output.Attributes.Add($"data-aiplugs-input-ajax-headers-{kv.Key}", kv.Value); } } output.Attributes.Add("data-aiplugs-input-ajax-label", Ajax.Label ?? "label"); output.Attributes.Add("data-aiplugs-input-ajax-value", Ajax.Value ?? "value"); } output.Attributes.Add("data-aiplugs-input-unique", Unique.ToString().ToLower()); output.Attributes.Add("data-aiplugs-input-ignore-case", IgnoreCase.ToString().ToLower()); output.Html("<div class=\"aiplugs-input__field\">"); output.Tag("input", () => { output.Attr("type", type); output.Attr("data-target", "aiplugs-input.input"); output.Attr("data-action", "input->aiplugs-input#onInput blur->aiplugs-input#onBlur"); output.Attr("data-val", "true"); if (id != null) { output.Attr("id", id); output.Attr("list", $"suggestion-{id}"); } if (Name != null) { output.Attr("name", Name); } if (Value != null) { output.Attr("value", Value); } if (ValueFrom != null) { output.Attributes.Add("data-aiplugs-input-value-from", ValueFrom); } if (type == "email") { output.Attr("data-val-email", Localizer.MsgValEmail(Label)); } if (Readonly) { output.Html(" readonly"); } if (Required) { output.Html(" required"); output.Attr("data-val-required", Localizer.MsgValRequired(Label)); } if (!string.IsNullOrEmpty(Placeholder)) { output.Attr("placeholder", Placeholder); } if (!string.IsNullOrEmpty(Pattern)) { var message = !string.IsNullOrEmpty(PatternErrorMessage) ? PatternErrorMessage : Localizer.MsgValPattern(Label, Pattern); output.Attr("data-val-regex", message); output.Attr("data-val-regex-pattern", Pattern); } if (MaxLength.HasValue) { output.Attr("data-val-maxlength", Localizer.MsgValMaxLengthForString(Label, MaxLength.Value)); output.Attr("data-val-maxlength-max", MaxLength.ToString()); } if (MinLength.HasValue) { output.Attr("data-val-minlength", Localizer.MsgValMinLengthForString(Label, MinLength.Value)); output.Attr("data-val-minlength-min", MinLength.ToString()); } if (type == "number") { output.Attr("data-val-number", Localizer.MsgValNumber(Label)); if (Max.HasValue || Min.HasValue) { var message = Max.HasValue && Min.HasValue ? Localizer.MsgValRange(Label, Min.Value, Max.Value) : Max.HasValue ? Localizer.MsgValMaxValue(Label, Max.Value) : Localizer.MsgValMinValue(Label, Min.Value); output.Attr($"data-val-range", message); } if (Step.HasValue) { output.Html($"step=\"{Step}\""); } if (Max.HasValue) { output.Html($"max=\"{Max}\" data-val-range-max=\"{Max}\""); } if (Min.HasValue) { output.Html($"min=\"{Min}\" data-val-range-min=\"{Min}\""); } } }); output.Html("</div>"); if (id != null) { output.Tag("datalist", () => { output.Attr("id", $"suggestion-{id}"); output.Attr("data-target", "aiplugs-input.suggestion"); }); } RenderFieldFooter(context, output, Name); }