public string GetDemoUrl(DemoInfoModel demoInfo, DemoItemModel demoItem) { var key = demoInfo.Key switch { "Styles" => "native_controls", "Controls" => "extend_controls", "Tools" => "tools", _ => string.Empty }; var domainName = LangProvider.Culture == null || LangProvider.Culture.Name.ToLower() == "zh-cn" ? "handyorg" : "ghost1372"; return($"https://{domainName}.github.io/handycontrol/{key}/{demoItem.Name[0].ToString().ToLower()}{demoItem.Name.Substring(1)}"); } }
private void GroupItems(TabControl tabControl, DemoInfoModel demoInfo) { var listBox = VisualHelper.GetChild <ListBox>(tabControl); if (listBox == null) { return; } listBox.Items.GroupDescriptions?.Clear(); if (demoInfo.IsGroupEnabled) { Dispatcher.BeginInvoke(new Action(() => { listBox.Items.GroupDescriptions?.Add(new PropertyGroupDescription("GroupName")); }), DispatcherPriority.Background); } }
internal List <DemoInfoModel> GetDemoInfo() { var infoList = new List <DemoInfoModel>(); var stream = Application.GetResourceStream(new Uri("Data/DemoInfo.json", UriKind.Relative))?.Stream; if (stream == null) { return(infoList); } string jsonStr; using (var reader = new StreamReader(stream)) { jsonStr = reader.ReadToEnd(); } var jsonObj = JsonConvert.DeserializeObject <dynamic>(jsonStr); foreach (var item in jsonObj) { var titleKey = (string)item.title; var title = titleKey; List <DemoItemModel> list = Convert2DemoItemList(item.demoItemList); var demoInfoModel = new DemoInfoModel { Key = titleKey, Title = title, DemoItemList = list, SelectedIndex = (int)item.selectedIndex, IsGroupEnabled = (bool)item.group }; infoList.Add(demoInfoModel); } return(infoList); }