/// <summary> /// Method used to query database for English language results. This will return the /// data in XML format. There is no way to create an additional WebGet so that we /// can return the same data in JSON format. /// </summary> /// <param name="language">The language needed to do the lookup</param> /// <param name="criteria">The partial text used to query the database</param> /// <param name="maxRows">The maximum number of rows that the database will return. a value of zero will return the entire set</param> /// <param name="contains">Indicator on whether the text is to be search from the beginning of the text or anywhere in the string</param> /// <returns>Returns the search results</returns> private AutoSuggestSearchServiceCollection Search(string language, string criteria, int maxRows, bool contains) { // create the collection variable AutoSuggestSearchServiceCollection sc = new AutoSuggestSearchServiceCollection(); try { // language passed to an enum DisplayLanguage displayLanguage = (DisplayLanguage)Enum.Parse(typeof(DisplayLanguage), language); // Call the database query AutoSuggestSearchCollection dc = AutoSuggestSearchManager.Search(language, criteria, maxRows, contains); // Use Linq to extract the data from the business layer and create // the service data objects // TermID is 0 always , that value is not part of the result received from the call to // Stroed procedure.But can be used in the future for other purposes. var collection = dc.ConvertAll(entry => new AutoSuggestSearchServiceItem( entry.TermID, entry.TermName, string.Empty )); sc.AddRange(collection); } catch (Exception ex) { // Log the error that occured CancerGovError.LogError("AutoSuggestSearch", 2, ex); } return(sc); }
/// <summary> /// A private method that is used by both GetTermDictionary by id and Name. /// </summary> /// <param name="byType">The value that specifies the type of search to be performed.</param> /// <param name="language">This is English or Spanish</param> /// <param name="termId">The CDRID of the term</param> /// <param name="termName">The term name</param> /// <param name="audience">This Patient or HealthProfessional</param> /// <returns>TermDictionaryServiceItem instance</returns> private TermDictionaryServiceItem getTermDictionary(TermDefinitionByType byType, string language, int termId, string termName, string audience) { TermDictionaryServiceItem termDicSvcItem = null; try { // language passed to an enum calling this also validates the language value passed is meaningful DisplayLanguage DisplayLanguage displayLanguage = (DisplayLanguage)Enum.Parse(typeof(DisplayLanguage), language); // Call the database query TermDictionaryDataItem termDicDataItem = null; if (byType == TermDefinitionByType.ById) { termDicDataItem = TermDictionaryManager.GetDefinitionByTermID(language, termId.ToString(), audience, 1); } else { termDicDataItem = TermDictionaryManager.GetDefinitionByTermName(displayLanguage, termName, audience, 1); } if (termDicDataItem != null) { termDicSvcItem = createTermDictionarySvcItem(termDicDataItem); } } catch (Exception ex) { // Log the error that occured CancerGovError.LogError("TermDictionary", 2, ex); } return(termDicSvcItem); }
/// <summary> /// Method used to query database for English language results. This will return the /// data in XML format. There is no way to create an additional WebGet so that we /// can return the same data in JSON format. /// </summary> /// <param name="language">The language needed to do the lookup</param> /// <param name="criteria">The partial text used to query the database</param> /// <param name="maxRows">The maximum number of rows that the database will return. a value of zero will return the entire set</param> /// <param name="contains">Indicator on whether the text is to be search from the beginning of the text or anywhere in the string</param> /// <param name="dictionary">Which Term dicitonary to search - Cancer.gov or Genetics</param> /// <param name="audience">Definition audience - Patient or Health professional</param> /// <returns>Returns the search results</returns> private TermDictionaryServiceCollection Search(string language, string criteria, int maxRows, bool contains, string dictionary, string audience) { // create the collection variable TermDictionaryServiceCollection sc = new TermDictionaryServiceCollection(); try { // language passed to an enum DisplayLanguage displayLanguage = (DisplayLanguage)Enum.Parse(typeof(DisplayLanguage), language); // Call the database query TermDictionaryCollection dc = TermDictionaryManager.Search(language, criteria, maxRows, contains, dictionary, audience); // Use Linq to extract the data from the business layer and create // the service data objects var collection = dc.ConvertAll(entry => new TermDictionaryServiceItem( entry.GlossaryTermID, entry.TermName, string.Empty )); sc.AddRange(collection); } catch (Exception ex) { // Log the error that occured CancerGovError.LogError("TermDictionary", 2, ex); } return(sc); }
/// <summary> /// This class is the business layer that interfaces between the user interface and the API layer. /// </summary> public static BestBetUIResult[] GetBestBets(string searchTerm, DisplayLanguage lang) { List <BestBetUIResult> rtnResults = new List <BestBetUIResult>(); BestBetAPIResult[] apiResults = null; // Set collection based on current environment string collection = Settings.IsLive ? "live" : "preview"; // Set language string // Default to English, as only "en" and "es" are accepted by API string twoCharLang = "en"; if (lang == DisplayLanguage.Spanish) { twoCharLang = "es"; } try { // Call API to retrieve autosuggest results apiResults = Client.Search(collection, twoCharLang, searchTerm); } catch (Exception ex) { // Log error if unable to retrieve results log.Error("Error retrieving results from Best Bets API Client in BestBetsPresentationManager", ex); } rtnResults = apiResults.Select(r => new BestBetUIResult { CategoryName = r.Name, CategoryDisplay = r.HTML }).ToList(); return(rtnResults.ToArray()); }
/// <summary> /// This methods filters the information passed to it in order to refine what /// will be called by the API client. /// </summary> /// <param name="language">Enumeration indicating language</param> /// <param name="searchText">The partial text to search for</param> /// <param name="size">The maximum number of items that the API will return</param> /// <param name="contains">Indicates whether the text will be searched starting from the beginning or anywhere in the string</param> /// <returns>Returns the AutoSuggest API search results</returns> public static AutoSuggestAPIResultCollection Search(DisplayLanguage language, string searchText, int size, bool contains) { AutoSuggestAPIResultCollection rtnResults = new AutoSuggestAPIResultCollection(); // Set collection based on web.config setting string collection = ConfigurationManager.AppSettings["SiteWideSearchAPICollection"]; // Set language string // Default to English, as only "en" and "es" are accepted by API string twoCharLang = "en"; if (language == DisplayLanguage.Spanish) { twoCharLang = "es"; } try { // Call API to retrieve autosuggest results rtnResults = Client.Autosuggest(collection, twoCharLang, searchText, size); } catch (Exception ex) { // Log error if unable to retrieve results log.Error("Error retrieving results from SiteWideSearch API Client in AutoSuggestSearchManager", ex); } return(rtnResults); }
/// <summary> /// Method used to query API for results. /// </summary> /// <param name="language">The language used to query the API</param> /// <param name="criteria">The partial text used to query the API</param> /// <param name="size">The maximum number of items that the API will return</param> /// <param name="contains">Indicator on whether the text is to be search from the beginning of the text or anywhere in the string</param> /// <returns>Returns the search results</returns> private AutoSuggestSearchServiceCollection Search(string language, string criteria, int size, bool contains) { // Create the collection variable AutoSuggestSearchServiceCollection sc = new AutoSuggestSearchServiceCollection(); // Language converted to an enum DisplayLanguage displayLanguage = (DisplayLanguage)Enum.Parse(typeof(DisplayLanguage), language); try { // Pass the given API parameters to the business layer AutoSuggestAPIResultCollection apiCollection = AutoSuggestSearchManager.Search(displayLanguage, criteria, size, contains); // Use Linq to extract the data from the business layer and create the service data objects // TermID is 0 always, that value is not part of the result received from the API call. //But can be used in the future for other purposes. var collection = apiCollection.Results.Select(r => new AutoSuggestSearchServiceItem( 0, r.Term, string.Empty )); sc.AddRange(collection); } catch (Exception ex) { // Log the error that occured log.Error("Error in AutoSuggestSearchService", ex); } return(sc); }
public MenuBuilder(ICollection <ProductCategory> categories, DisplayLanguage language) { this.categories = categories; this.lang = language; this.leftItemsBuilder = new StringBuilder(); this.rightItemsBuilder = new StringBuilder(); this.templatesBuilder = new StringBuilder(); this.categoriesBuilder = new StringBuilder(); }
public void ChangeLanguage(DisplayLanguage language) { this.GameLanguage = language; if (OnLocalizationChanged != null) { OnLocalizationChanged.Invoke(); } EventQueue.Instance.AddQuickInfoPanel(LocalizationManager.Instance.GetLocalizedValue("LanguageChanged"), 1); }
private void DisplayDecompiledCode(DisplayLanguage displayLanguage) { _currentlyDisplayedDecompiledCode = displayLanguage == DisplayLanguage.CSharp ? _generatedTypesAndDecompiledCSharpCode[_currentlySelectedTypeDefinition] : _generatedTypesAndDecompiledILCode[_currentlySelectedTypeDefinition]; _decompiledCodeField.itemsSource = _currentlyDisplayedDecompiledCode; _currentDecompilationStatus = DecompilationStatus.Complete; }
private static void DisplayDecompiledCode(DisplayLanguage displayLanguage) { s_currentlyDisplayedDecompiledCode = displayLanguage == DisplayLanguage.CSharp ? GeneratedTypesAndDecompiledCSharpCode[s_currentlySelectedType] : GeneratedTypesAndDecompiledIlCode[s_currentlySelectedType]; s_decompiledCodeField.itemsSource = s_currentlyDisplayedDecompiledCode; s_currentDecompilationStatus = DecompilationStatus.Complete; }
public static BestBetUIResult[] GetBestBets(string searchTerm, DisplayLanguage lang) { List <BestBetUIResult> rtnResults = new List <BestBetUIResult>(); //Note, new NCI.Search.BestBets.BestBetsManager will clean terms for us, so we //do not have to worry about that. string twoCharLang = string.Empty; //To search all, pass in string.empty if (lang == DisplayLanguage.Spanish) { twoCharLang = "es"; } else { twoCharLang = "en"; } //TODO: Language!!!! //NOTE: This can throw an exception - in the past we left it unhandled. That is stupid, because //we log other errors. Put that logging here! BestBetResult[] rawResults = BestBetsManager.Search(searchTerm, twoCharLang); //Loop through the cats and get the list items. foreach (BestBetResult res in rawResults) { try { if (string.IsNullOrEmpty(res.CategoryID)) { log.Warn("GetBestBets(): category id is null/empty"); continue; } string bbResFileName = String.Format(ContentDeliveryEngineConfig.PathInformation.BestBetsResultPath.Path, res.CategoryID); BestBetUIResult bbResult = ModuleObjectFactory <BestBetUIResult> .GetObjectFromFile(bbResFileName); if (bbResult != null && bbResult.Display) { rtnResults.Add(bbResult); } } catch (Exception ex) { // The bestbet result xml file may not always be there, so catch the exception and log the error // and ignore the exception log.WarnFormat("GetBestBets(): could not find bb result for category id {0} Category name {1}", ex, res.CategoryID, res.CategoryName); } } return(rtnResults.ToArray()); }
/// <summary> /// Returns a TermDictionaryServiceList which contains a collection of Term Dictionary /// items and the total number of records. /// </summary> /// <param name="language"></param> /// <param name="criteria"></param> /// <param name="contains"></param> /// <param name="maxRows">Maxrows is treated as recordPerPage or the topN records. /// Used for records per page when pagenumber is 0 or greater than 0. /// If pagenumber is -1 number records returned is specified by maxRows. /// If maxRows=0 and pageNumber=-1 all records are returned.</param> /// <param name="pageNumber">Specifies the pagenumber for which the records should be returned. /// If pagenumber is -1 number records returned is specified by maxRows. /// If maxRows=0 and pageNumber=-1 all records are returned.</param> /// <returns></returns> private TermDictionaryServiceList getTermDictionaryList(string language, string criteria, bool contains, int maxRows, int pageNumber) { TermDictionaryServiceList sc = new TermDictionaryServiceList(); sc.TermDictionaryServiceCollection = new TermDictionaryServiceCollection(); sc.TotalRecordCount = 0; try { int totalRecordCount = 0; // No criteria specified if (string.IsNullOrEmpty(criteria)) { return(sc); } // if maxrows is 0 and pagenumber is > 0 then return empty. if ((maxRows == 0 && pageNumber >= 0) || (maxRows < 0)) { return(sc); } if (pageNumber == 0) { pageNumber = 1; } // language passed to an enum DisplayLanguage displayLanguage = (DisplayLanguage)Enum.Parse(typeof(DisplayLanguage), language); // Call the database query TermDictionaryCollection dc = TermDictionaryManager.GetTermDictionaryList(language, criteria, contains, maxRows, pageNumber, ref totalRecordCount); // Use Linq to extract the data from the business layer and create // the service data objects sc.TermDictionaryServiceCollection.AddRange( from entry in dc select createTermDictionarySvcItem(entry) ); sc.TotalRecordCount = totalRecordCount; } catch (Exception ex) { // Log the error that occured CancerGovError.LogError("TermDictionary", 2, ex); } return(sc); }
private void RegisterCallbacks() { Button copyCodeButton = rootVisualElement.Q <Button>("Copy Code"); copyCodeButton.clicked += () => { EditorGUIUtility.systemCopyBuffer = string.Join(Environment.NewLine, (string[])s_decompiledCodeField.itemsSource); }; var generatedTypesListView = rootVisualElement.Q <ListView>("Scripts ListView"); SetupListView(generatedTypesListView, FilteredTypes, 15, MakeScriptLabel, BindScriptLabel); generatedTypesListView.selectionType = SelectionType.Single; #if UNITY_2020_1_OR_NEWER generatedTypesListView.onSelectionChange += OnScriptSelected; #else generatedTypesListView.onSelectionChanged += OnScriptSelected; #endif var searchField = rootVisualElement.Q <ToolbarSearchField>("Script Search Field"); searchField.RegisterCallback <ChangeEvent <string>, ListView>(OnFilter, generatedTypesListView); SetupListView(s_decompiledCodeField, s_currentlyDisplayedDecompiledCode, 15, MakeScriptLineLabel, BindScriptLineLabel); var language = rootVisualElement.Q <EnumField>("Language Popup"); language.Init(defaultValue: DisplayLanguage.CSharp); language.RegisterValueChangedCallback(changeEvent => { s_currentDisplayLanguage = (DisplayLanguage)changeEvent.newValue; StartDecompilationOrDisplayDecompiledCode(); }); var fontSizes = new PopupField <int>( choices: Enumerable.Range(start: 12, count: 7).ToList(), defaultIndex: 0, formatSelectedValueCallback: GetFontSizeHeader, formatListItemCallback: GetFontSize ); fontSizes.RegisterValueChangedCallback(changeEvent => { s_decompiledCodeField.style.fontSize = changeEvent.newValue; s_decompiledCodeField.itemHeight = Mathf.CeilToInt(changeEvent.newValue * 1.5f); }); VisualElement fontSizeRoot = rootVisualElement.Q("Fontsize Popup"); fontSizeRoot.Add(fontSizes); s_decompilationStatusLabel.binding = new DecompilationStatusLabelBinding(); }
private static void UpdateLanguageChecks(DisplayLanguage language) { var menus = new Dictionary <DisplayLanguage, string> { { DisplayLanguage.Auto, VRCQuestToolsMenus.MenuPaths.LanguageAuto }, { DisplayLanguage.English, VRCQuestToolsMenus.MenuPaths.LanguageEnglish }, { DisplayLanguage.Japanese, VRCQuestToolsMenus.MenuPaths.LanguageJapanese }, }; Debug.Assert(menus.Count == Enum.GetValues(typeof(DisplayLanguage)).Length); foreach (var kvp in menus) { Menu.SetChecked(kvp.Value, kvp.Key == language); } }
private void SetReturnToTop(DisplayVersions version, DisplayLanguage language) { this.Class = "backtotop-link"; switch (language) { case DisplayLanguage.Spanish: this.InnerHtml = "Volver arriba"; break; } if (version != DisplayVersions.Text) { HtmlImage backToTopArrow = new HtmlImage("/images/backtotop_red.gif", this.InnerHtml); backToTopArrow.Border = "0"; this.InnerHtml = backToTopArrow.Render() + this.InnerHtml; } }
/// <summary> /// Method will return a single TermDictionaryItem with its associated /// TermDictionaryNeighbors /// </summary> /// <param name="language"></param> /// <param name="termName"></param> /// <param name="nMatches"></param> /// <returns></returns> public static TermDictionaryDataItem GetDefinitionByTermName(DisplayLanguage language, string termName, string audience, int nNeighborMatches) { TermDictionaryDataItem di = null; // default the audience if there was none supplied if (string.IsNullOrEmpty(audience)) { audience = "Patient"; } try { // Call the database layer and get data DataTable dt = TermDictionaryQuery.GetDefinitionByTermName( language.ToString(), termName, audience); // Get the entry record if (dt.Rows.Count == 1) { // build the data item di = GetEntryFromDR(dt.Rows[0]); // Get the neighbors GetTermNeighbors(di, language.ToString(), nNeighborMatches); } else if (dt.Rows.Count > 0) { throw new Exception("GetDefinitionByTermName returned more than 1 record."); } } catch (Exception ex) { CancerGovError.LogError("TermDictionaryManager", 2, ex); throw ex; } return(di); }
/// <summary> /// Changes the current language /// </summary> /// <param name="newLanguage">The new language</param> protected virtual void ChangeLanguage(DisplayLanguage newLanguage) { CurrentLanguage = newLanguage; }
protected void Page_Load(object sender, EventArgs e) { //base.OnLoad(e); string input_term = string.Empty; string term = string.Empty; string id = string.Empty; string mediaHtml = ""; PDQVersion version; string pronunciation = string.Empty; string termDefinition = string.Empty; DisplayLanguage dl = new DisplayLanguage(); if (Request.QueryString["language"] == "English") { dl = DisplayLanguage.English; } else if (Request.QueryString["language"] == "Spanish") { dl = DisplayLanguage.Spanish; } else { dl = DisplayLanguage.English; } try { //include page title this.pageHtmlHead.Title = "Definition - National Cancer Institute"; input_term = Strings.Clean(Request.Params["term"]); id = Strings.IfNull(Strings.Clean(Request.Params["id"]), Strings.Clean(Request.Params["cdrid"])); //version = PDQVersion.Patient; } catch (Exception ex) { log.Error("TCGA:Definition.cs:PageLoad", ex); } version = PDQVersionResolver.GetPDQVersion(Strings.Clean(Request.Params["version"])); ArrayList result = null; try { term = "Error"; pronunciation = "invalid input"; termDefinition = string.Empty; if (input_term == null && id == null) { termDefinition = "You have not specified either a CDRID nor a term name."; } else { if (input_term != null && input_term.Length > 0) { result = get_definition("term", input_term, version, dl); if (result == null && input_term.EndsWith("s")) { result = get_definition("term", input_term.Substring(0, input_term.Length - 1), version, dl); if (result == null && input_term.EndsWith("es")) { result = get_definition("term", input_term.Substring(0, input_term.Length - 2), version, dl); if (result == null && input_term.EndsWith("ies")) { result = get_definition("term", input_term.Substring(0, input_term.Length - 3) + "y", version, dl); if (result == null && input_term.EndsWith("um")) { result = get_definition("term", input_term.Substring(0, input_term.Length - 2) + "a", version, dl); if (result == null && input_term.EndsWith("ly")) { result = get_definition("term", input_term.Substring(0, input_term.Length - 2), version, dl); if (result == null && input_term.EndsWith("ii")) { result = get_definition("term", input_term.Substring(0, input_term.Length - 2) + "us", version, dl); } } } } } } } else { id = Regex.Replace(id, "^CDR0+", "", RegexOptions.Compiled); result = get_definition("id", id, version, dl); } if (result == null) { term = "term not found"; pronunciation = ""; termDefinition = "The term you are looking for does not exist in the glossary."; } else { term = result[0].ToString(); pronunciation = result[1].ToString(); termDefinition = result[2].ToString(); mediaHtml = result[3].ToString(); mediaHtml = mediaHtml.Replace("[__imagelocation]", ConfigurationManager.AppSettings["CDRImageLocation"]); } } } catch (Exception ex) { log.Error("TCGA:Definition.cs:PageLoad", ex); } if (dl == DisplayLanguage.Spanish) { strSendPrinter = "Imprima esta página"; pronunciation = String.Empty; //strHeading = "<h3 class='popup-definition'>Definición del Diccionario de cáncer del NCI</h3>"; strHeading = "<div class=\"heading\">Definición:</div>"; } content = new HtmlSegment("<div class=\"audioPronounceLink\">" + String.Format("<span class=\"term\">{0}</span>", term) + String.Format("<span class=\"pronunciation\">{0}</span>", ((Strings.Clean(pronunciation) != null) ? " " + pronunciation : "")) + "</div>" + String.Format("<div class=\"definition\">{0}</div>", termDefinition) + String.Format("<div class=\"definitionImage\">{0}</div>", mediaHtml) ); //String.Format("<span class=\"black-text-b\">{0}</span>", term) + ((Strings.Clean(pronunciation) != null) ? " " + pronunciation : "") + "<p>" + termDefinition + "<p>" + mediaHtml); }
private ArrayList get_definition(string type, string param, PDQVersion pdqVersion, DisplayLanguage language) { string lng = string.Empty; if (language == DisplayLanguage.English) { lng = "English"; } else { lng = "Spanish"; } ArrayList returnvalue = new ArrayList(3); returnvalue = CancerGov.CDR.TermDictionary.TermDictionaryManager.GetDefinition(type, param, pdqVersion, lng); return(returnvalue); }
public NewsBuilder(ICollection <News> news, DisplayLanguage language) { this.news = news; this.lang = language; }
private void OnEnable() { this.minSize = new Vector2(1500f, 400f); if (_allDOTSCompilerGeneratedTypes == null) { _allDOTSCompilerGeneratedTypes = _dotsCompilerGeneratedTypesToDisplay = TypeCache.GetTypesWithAttribute <DOTSCompilerGeneratedAttribute>() .Select(GetTypeDefinition) .Where(t => t != null) .OrderBy(t => t.GetUserFriendlyName()) .ToArray(); } VisualElement searchBarAndGeneratedTypeListView = new VisualElement { style = { width = new StyleLength(new Length(20, LengthUnit.Percent)) }, name = "Search bar and list view for DOTS compiler-generated types" }; ListView generatedTypesListView = new ListView( itemsSource: _dotsCompilerGeneratedTypesToDisplay, itemHeight: 15, makeItem: () => new Label { style = { color = new Color(0.71f, 1f, 0f) } }, bindItem: (element, index) => { ((Label)element).text = _dotsCompilerGeneratedTypesToDisplay[index].GetUserFriendlyName(); }) { style = { width = new StyleLength(new Length(100, LengthUnit.Percent)), height = new StyleLength(new Length(98, LengthUnit.Percent)), top = new StyleLength(new Length(10, LengthUnit.Pixel)) }, name = "List view for DOTS compiler-generated types" }; var searchFieldToolbar = new Toolbar { style = { width = new StyleLength(new Length(100, LengthUnit.Percent)), flexGrow = 0 } }; var searchField = new ToolbarSearchField { style = { width = new StyleLength(new Length(98, LengthUnit.Percent)) }, name = "Search bar for DOTS compiler-generated types" }; searchField.RegisterValueChangedCallback(changeEvent => { _dotsCompilerGeneratedTypesToDisplay = string.IsNullOrWhiteSpace(changeEvent.newValue) ? _allDOTSCompilerGeneratedTypes : _allDOTSCompilerGeneratedTypes .Where(t => IsFilteredType(t, changeEvent.newValue)) .ToArray(); generatedTypesListView.itemsSource = _dotsCompilerGeneratedTypesToDisplay; }); searchFieldToolbar.Add(searchField); searchBarAndGeneratedTypeListView.style.flexDirection = FlexDirection.Column; searchBarAndGeneratedTypeListView.Add(searchFieldToolbar); searchBarAndGeneratedTypeListView.Add(generatedTypesListView); var canvasForOtherContents = new VisualElement { style = { width = new StyleLength(new Length(80, LengthUnit.Percent)) }, name = "Canvas for: Font selection tool bar; copy buttons; displaying decompiled code" }; var canvasForDisplayingDecompiledCode = new VisualElement { style = { width = new StyleLength(new Length(100, LengthUnit.Percent)), height = new StyleLength(new Length(95, LengthUnit.Percent)) }, name = "Canvas for displaying decompiled code" }; _decompiledCodeField = new ListView( itemsSource: _currentlyDisplayedDecompiledCode, itemHeight: 15, makeItem: () => new Label { style = { color = Color.white } }, bindItem: (element, i) => ((Label)element).text = $"{i}\t{_currentlyDisplayedDecompiledCode[i]}" ) { style = { width = new StyleLength(new Length(100, LengthUnit.Percent)), height = new StyleLength(new Length(100, LengthUnit.Percent)), borderLeftWidth = new StyleFloat(5f), borderLeftColor = new StyleColor(Color.grey) }, name = "List view for decompiled code. (A regular text field cannot display that much text.)" }; _decompilationStatusLabel = new Label { style = { height = new StyleLength(new Length(100, LengthUnit.Percent)), width = new StyleLength(new Length(600, LengthUnit.Pixel)), unityTextAlign = new StyleEnum <TextAnchor>(TextAnchor.MiddleRight), color = new Color(0.71f, 1f, 0f) } }; #if UNITY_2020 generatedTypesListView.onSelectionChange += o => { _currentlySelectedTypeDefinition = (TypeDefinition)o.Single(); _userMadeAtLeastOneSelection = true; StartDecompilationOrDisplayDecompiledCode(); }; #else generatedTypesListView.onSelectionChanged += o => { _currentlySelectedTypeDefinition = (TypeDefinition)o.Single(); _userMadeAtLeastOneSelection = true; StartDecompilationOrDisplayDecompiledCode(); }; #endif canvasForDisplayingDecompiledCode.style.flexDirection = FlexDirection.Row; canvasForDisplayingDecompiledCode.Add(_decompiledCodeField); var toolBar = new Toolbar { style = { flexGrow = 0, height = new StyleLength(new Length(20, LengthUnit.Pixel)), width = new StyleLength(new Length(100, LengthUnit.Percent)) }, name = "Canvas for: font size selector; copy button" }; var fontSizeSelector = new ToolbarMenu { style = { height = new StyleLength(new Length(100, LengthUnit.Percent)), width = new StyleLength(new Length(80, LengthUnit.Pixel)) }, text = "Font size", name = "Font size selection toolbar" }; foreach (int i in Enumerable.Range(start: 12, count: 7)) { fontSizeSelector.menu.AppendAction(actionName: $"{i}", action => { _decompiledCodeField.style.fontSize = i; _decompiledCodeField.itemHeight = Mathf.CeilToInt(i * 1.5f); }); } var decompiledLanguageSelector = new ToolbarMenu { style = { height = new StyleLength(new Length(100, LengthUnit.Percent)), width = new StyleLength(new Length(80, LengthUnit.Pixel)) }, text = "Language", name = "Decompiled language selection toolbar" }; decompiledLanguageSelector.menu.AppendAction( "C#", action => { _currentDisplayLanguage = DisplayLanguage.CSharp; StartDecompilationOrDisplayDecompiledCode(); }); decompiledLanguageSelector.menu.AppendAction( "IL", action => { _currentDisplayLanguage = DisplayLanguage.IL; StartDecompilationOrDisplayDecompiledCode(); }); var copyDecompiledCodeButton = new ToolbarButton { style = { height = new StyleLength(new Length(100, LengthUnit.Percent)), width = new StyleLength(new Length(150, LengthUnit.Pixel)), unityTextAlign = new StyleEnum <TextAnchor>(TextAnchor.MiddleCenter) }, text = "Copy decompiled code", name = "Button to copy decompiled code" }; copyDecompiledCodeButton.clicked += () => EditorGUIUtility.systemCopyBuffer = string.Join(Environment.NewLine, (string[])_decompiledCodeField.itemsSource); toolBar.style.flexDirection = FlexDirection.RowReverse; toolBar.Add(fontSizeSelector); toolBar.Add(decompiledLanguageSelector); toolBar.Add(copyDecompiledCodeButton); toolBar.Add(_decompilationStatusLabel); canvasForOtherContents.style.flexDirection = FlexDirection.Column; canvasForOtherContents.Add(toolBar); canvasForOtherContents.Add(canvasForDisplayingDecompiledCode); rootVisualElement.style.flexDirection = FlexDirection.Row; rootVisualElement.Add(searchBarAndGeneratedTypeListView); rootVisualElement.Add(canvasForOtherContents); bool IsFilteredType(TypeDefinition typeDefinition, string userSpecifiedTypeName) { return(CultureInfo.InvariantCulture.CompareInfo.IndexOf( typeDefinition.GetUserFriendlyName(), userSpecifiedTypeName, CompareOptions.IgnoreCase) >= 0); } }
public PromotionsBuilder(ICollection <Promotion> promotions, DisplayLanguage language) { this.promotions = promotions; this.lang = language; }
public EventsBuilder(IEnumerable <Event> events, DisplayLanguage language) { this.events = events; this.lang = language; }
void ChangeLanguage(DisplayLanguage newLanguage) { _currentLanguage = newLanguage; VersionList = NotifyTaskCompletionCollection <GameVersion> .Create(LoadVersionsAsync, _cachedVersionId); }
private static void SetLanguage(DisplayLanguage language) { VRCQuestToolsSettings.DisplayLanguage = language; UpdateLanguageChecks(language); }
/// <summary> /// Event method sets frame content version and parameters /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); string input_term; string term; string id; string mediaHtml = ""; string audioMediaHTML = String.Empty; PDQVersion version; string pronunciation; string termDefinition; DisplayLanguage dl = new DisplayLanguage(); if (Request.QueryString["language"] == "English") { dl = DisplayLanguage.English; } else if (Request.QueryString["language"] == "Spanish") { dl = DisplayLanguage.Spanish; } else { dl = DisplayLanguage.English; } ValidateParams(); //include page title this.pageHtmlHead.Title = "Definition - National Cancer Institute"; input_term = Strings.Clean(Request.Params["term"]); id = Strings.IfNull(Strings.Clean(Request.Params["id"]), Strings.Clean(Request.Params["cdrid"])); version = PDQVersionResolver.GetPDQVersion(Strings.Clean(Request.Params["version"])); //version = PDQVersion.version; ArrayList result = null; if (input_term == null && id == null) { term = "Error"; pronunciation = "invalid input"; termDefinition = "You have not specified either a CDRID nor a term name."; } else { if (input_term != null && input_term.Length > 0) { result = get_definition("term", input_term, version, dl); if (result == null && input_term.EndsWith("s")) { result = get_definition("term", input_term.Substring(0, input_term.Length - 1), version, dl); if (result == null && input_term.EndsWith("es")) { result = get_definition("term", input_term.Substring(0, input_term.Length - 2), version, dl); if (result == null && input_term.EndsWith("ies")) { result = get_definition("term", input_term.Substring(0, input_term.Length - 3) + "y", version, dl); if (result == null && input_term.EndsWith("um")) { result = get_definition("term", input_term.Substring(0, input_term.Length - 2) + "a", version, dl); if (result == null && input_term.EndsWith("ly")) { result = get_definition("term", input_term.Substring(0, input_term.Length - 2), version, dl); if (result == null && input_term.EndsWith("ii")) { result = get_definition("term", input_term.Substring(0, input_term.Length - 2) + "us", version, dl); } } } } } } } else { id = Regex.Replace(id, "^CDR0+", "", RegexOptions.Compiled); result = get_definition("id", id, version, dl); } if (result == null) { term = "term not found"; pronunciation = ""; termDefinition = "The term you are looking for does not exist in the glossary."; } else { term = result[0].ToString(); pronunciation = result[1].ToString(); termDefinition = result[2].ToString(); mediaHtml = result[3].ToString(); mediaHtml = mediaHtml.Replace("[__imagelocation]", ConfigurationManager.AppSettings["CDRImageLocation"]); if (result[4] != null) { audioMediaHTML = result[4].ToString(); audioMediaHTML = audioMediaHTML.Replace("[_audioMediaLocation]", ConfigurationManager.AppSettings["CDRAudioMediaLocation"]); } } } if (dl == DisplayLanguage.Spanish) { strSendPrinter = "Imprima esta página"; pronunciation = String.Empty; //strHeading = "<h3 class='popup-definition'>Definición del Diccionario de cáncer del NCI</h3>"; strHeading = "<div class=\"heading\">Definición:</div>"; } content = new HtmlSegment("<div class=\"audioPronounceLink\">" + String.Format("<span class=\"term\">{0}</span>", term) + String.Format("<span class=\"pronunciation\">{0}</span>", ((Strings.Clean(pronunciation) != null) ? " " + pronunciation : "")) + audioMediaHTML + "</div>" + String.Format("<div class=\"definition\">{0}</div>", termDefinition) + String.Format("<div class=\"definitionImage\">{0}</div>", mediaHtml) ); // Web Analytics ************************************************* WebAnalyticsPageLoad webAnalyticsPageLoad = new WebAnalyticsPageLoad(); if (dl == DisplayLanguage.Spanish) { webAnalyticsPageLoad.SetChannel("Diccionario de cancer (Dictionary of Cancer Terms)"); webAnalyticsPageLoad.SetLanguage("es"); } else { webAnalyticsPageLoad.SetChannel("Dictionary of Cancer Terms"); webAnalyticsPageLoad.SetLanguage("en"); } webAnalyticsPageLoad.AddEvent(WebAnalyticsOptions.Events.event11); // Dictionary Term view (event11) litOmniturePageLoad.Text = webAnalyticsPageLoad.Tag(); // Load page load script // End Web Analytics ********************************************* }
void ChangeLanguage(DisplayLanguage newLanguage) { _currentLanguage = newLanguage; VersionList = NotifyTaskCompletionCollection<GameVersion>.Create(LoadVersionsAsync, _cachedVersionId); }