/// <summary> /// Gets a list of all registered themes. /// </summary> /// <returns></returns> public static ThemeList GetAvailableThemes() { ThemeList res = new ThemeList(); foreach (DictionaryEntry entry in ThemeResolutionService.registeredThemes) { Theme theme = (Theme)entry.Value; if (theme.ThemeName != asteriskThemeName) { res.Add((Theme)entry.Value); } } return(res); }
public MainViewModel() { // テストデータ var thm = "ガソリン急落 半年ぶり143円台"; ThemeList.Add(new ThemeModel(thm, "経済", _rdm.Next(1, 3), _rdm.Next(0, 3))); ThemeList[ThemeList.Count - 1].ContentList.Add(new ContentModel("レギュラーガソリン急落、前週比2.9円安の143.5円 半年ぶりの安値", "記事", $"{_rdm.Next(15, 45)}行", thm)); ThemeList[ThemeList.Count - 1].ContentList.Add(new ContentModel("[ハイオクガソリン実売価格(「e燃費」調べ)]", "画像", "1920x1080", thm)); thm = "新型コロナの影響拡大を受けて"; ThemeList.Add(new ThemeModel("新型コロナの影響拡大を受けて", "政治", _rdm.Next(1, 3), _rdm.Next(0, 3))); ThemeList[ThemeList.Count - 1].ContentList.Add(new ContentModel("公共料金の支払いを猶予 欧州から入国、待機要請 新型コロナ", "記事", $"{_rdm.Next(15, 45)}行", thm)); ThemeList[ThemeList.Count - 1].ContentList.Add(new ContentModel("電気など公共料金支払い猶予要請へ 欧州など38カ国に入国制限", "記事", $"{_rdm.Next(15, 45)}行", thm)); ThemeList[ThemeList.Count - 1].ContentList.Add(new ContentModel("新型コロナウイルス感染症対策本部", "画像", "355x466", thm)); thm = "新型iPad、25日に発売"; ThemeList.Add(new ThemeModel("新型iPad、25日に発売", "社会", _rdm.Next(1, 3), _rdm.Next(0, 3))); ThemeList[ThemeList.Count - 1].ContentList.Add(new ContentModel("アップル、LiDARセンサー/2カメラの新iPad Pro。トラックパッドにも初対応", "記事", $"{_rdm.Next(15, 45)}行", thm)); ThemeList[ThemeList.Count - 1].ContentList.Add(new ContentModel("新型iPad、25日に発売 米アップル、超広角カメラ搭載", "記事", $"{_rdm.Next(15, 45)}行", thm)); ThemeList[ThemeList.Count - 1].ContentList.Add(new ContentModel("iPad(アイパッド)プロ", "画像", "400x448", thm)); thm = "将棋の清水市代女流六段が史上初の女流七段に"; ThemeList.Add(new ThemeModel("将棋の清水市代女流六段が史上初の女流七段に", "社会", _rdm.Next(1, 3), _rdm.Next(0, 3))); ThemeList[ThemeList.Count - 1].ContentList.Add(new ContentModel("清水が史上初の女流七段に 里見は女流六段昇段", "記事", $"{_rdm.Next(15, 45)}行", thm)); ThemeList[ThemeList.Count - 1].ContentList.Add(new ContentModel("女流七段への昇段は史上初", "記事", $"{_rdm.Next(15, 45)}行", thm)); ThemeList[ThemeList.Count - 1].ContentList.Add(new ContentModel("日本将棋連盟", "画像", "1280x720", thm)); thm = "【第1部】日経平均株価"; ThemeList.Add(new ThemeModel("【第1部】日経平均株価", "経済", _rdm.Next(1, 3), _rdm.Next(0, 3))); ThemeList[ThemeList.Count - 1].ContentList.Add(new ContentModel("乱高下後に小幅続落=不安定な値動き続く", "記事", $"{_rdm.Next(15, 45)}行", thm)); ThemeList[ThemeList.Count - 1].ContentList.Add(new ContentModel("日経平均は急速に切り返し底入れを期待", "記事", $"{_rdm.Next(15, 45)}行", thm)); ThemeList[ThemeList.Count - 1].ContentList.Add(new ContentModel("ダウ工業株30種平均が過去最大の下げ幅", "画像", "1920x1080", thm)); ContentList = new ObservableCollection <ContentModel>(ThemeList.SelectMany(theme => theme.ContentList).ToList()); thm = ""; ContentFreeList.Add(new ContentModel("【コロナショックで資産が半分に!?】「iDeCo・つみたてNISA」利用者が今とるべき対処法とは", "記事", $"{_rdm.Next(15, 45)}行", thm)); ContentFreeList.Add(new ContentModel("東電、全社員に一時金9万円 初任給は3千円上げ", "画像", $"{_rdm.Next(600, 1980)}x{_rdm.Next(400, 1080)}", thm)); ContentFreeList.Add(new ContentModel("死者64万人想定のコロナ緊急宣言は妥当なのか", "記事", $"{_rdm.Next(15, 45)}行", thm)); ContentFreeList.Add(new ContentModel("自然災害リスクへの警戒高まる 川沿いの住宅地、公示地価で下落顕著", "記事", $"{_rdm.Next(15, 45)}行", thm)); ContentFreeList.Add(new ContentModel("直ちに消費税率ゼロにする発想ない", "記事", $"{_rdm.Next(15, 45)}行", thm)); ContentFreeList.Add(new ContentModel("NY株1700ドル超下げ 2万ドル割り込む 取引一時停止", "記事", $"{_rdm.Next(15, 45)}行", thm)); ContentFreeList.Add(new ContentModel("18日東京株式市場終値 284円98銭安の1万6726円55銭", "画像", $"{_rdm.Next(600, 1980)}x{_rdm.Next(400, 1080)}", thm)); ContentFreeList.Add(new ContentModel("USJが子ども達に『サプライズプレゼント』学童保育に通う3千人超に1300万円分", "記事", $"{_rdm.Next(15, 45)}行", thm)); ContentFreeList.Add(new ContentModel("GPIF22兆円の大損失 株価暴落&運用失敗", "記事", $"{_rdm.Next(15, 45)}行", thm)); // Drag&Drop this.Description = new DropAcceptDescription(); this.Description.DragOver += Description_DragOver; this.Description.DragDrop += Description_DragDrop; }
private void Init(string file) { XmlDocument xmlDocument = new XmlDocument(); if (File.Exists(file)) { xmlDocument.Load(file); XmlNodeList languageList = xmlDocument.SelectNodes("/Configuration/Languages/Language"); if (languageList.Count > 0) { foreach (XmlNode item in languageList) { LanguageList.Add(item.Attributes["Name"].Value); FilenameExtensionDic.Add(item.Attributes["Name"].Value, item.Attributes["Extension"].Value); } } XmlNodeList themeList = xmlDocument.SelectNodes("/Configuration/Themes/Theme"); if (themeList.Count > 0) { foreach (XmlNode item in themeList) { ThemeList.Add(item.InnerText); } } XmlNodeList fontSizeList = xmlDocument.SelectNodes("/Configuration/FontSizes/FontSize"); if (fontSizeList.Count > 0) { foreach (XmlNode item in fontSizeList) { FontSizeList.Add(int.Parse(item.InnerText)); } } XmlNodeList fontList = xmlDocument.SelectNodes("/Configuration/Fonts/Font"); if (fontList.Count > 0) { foreach (XmlNode item in fontList) { FontList.Add(item.InnerText); } } } }
/// <summary> /// Gets any themes registered for a specific control by control type name or control name. /// </summary> /// <param name="control"></param> /// <returns></returns> public static ThemeList GetAvailableThemes(IComponentTreeHandler control) { ThemeList res = new ThemeList(); if (control == null) { return(res); } foreach (DictionaryEntry entry in ThemeResolutionService.registeredThemes) { Theme theme = (Theme)entry.Value; if (theme.ThemeName == asteriskThemeName) { continue; } bool found = false; foreach (StyleBuilderRegistration builder in theme.GetRegisteredStyleBuilders()) { foreach (RadStylesheetRelation relation in builder.StylesheetRelations) { if ((relation.ControlType == control.ThemeClassName /*&& relation.ElementType == typeof(RootRadElement).FullName*/) || (!string.IsNullOrEmpty(relation.ControlName) && relation.ControlName == control.Name)) { found = true; break; } } } if (found) { res.Add(theme); } } return(res); }
private static void ProcessRuleset(string content, ContextDictionary context, ThemeList styles, ThemeStyle parent) { StringDictionary variables = new StringDictionary(); content.Tokenize('{', '}', (name, rules) => { if (name[0] == '@') { ProcessInstruction(name, rules, styles, variables, context); } else { // nested rules? int brace = rules.IndexOf('{'); int lastSemiColon = rules.Length; if (brace >= 0) { lastSemiColon = rules.LastIndexOf(';', brace, brace - 1); if (lastSemiColon >= 0) { lastSemiColon++; } } ThemeStyle style = ProcessStyle(name, rules.Substring(0, lastSemiColon), variables, context); if (style != null) { style.Parent = parent != null ? parent.Target : null; style.Variables = variables; styles.Add(style); } if (brace >= 0) { ProcessRuleset(rules.Substring(lastSemiColon, rules.Length - lastSemiColon), context, styles, style); } } }); }
/// <summary> /// テーマ追加 /// </summary> private void AddTheme() { ThemeList.Add(new ThemeModel("追加テーマ_" + DateTime.Now.ToString(@"mmss_fff"), ThemeList.Count % 2 == 0 ? "社会" : "政治", 1, 2)); }