public void RefreshAppInfoItems() { for (int i = 0; i < PanApps.Children.Count; i++) { AppInfoItem aii = (AppInfoItem)PanApps.Children[i]; if (aii != null) { aii.Refresh(); } } }
//载入 private void LoadAppsInfo() { AppInfos.Clear(); AppInfos.Add(AppInfo); AppInfos.Add(new AppInfo("E Writer")); AppInfos.Add(new AppInfo("E Player")); AppInfos.Add(new AppInfo("E Number")); AppInfos.Add(new AppInfo("E Role")); PanApps.Children.Clear(); foreach (AppInfo item in AppInfos) { AppInfoItem aii = new AppInfoItem { AppInfo = item }; PanApps.Children.Add(aii); } //读取一个字符串,并加入播放列表 if (!string.IsNullOrEmpty(Settings.Default.Paths)) { string[] paths = Regex.Split(Settings.Default.Paths, ","); foreach (string item in paths) { if (!File.Exists(item)) { continue; } string name = Path.GetFileNameWithoutExtension(item); AppInfo ai = AppInfos.Find(x => x.Name == name); ai.FilePath = item; } } }
private static void OnAppIconChanged(object sender, DependencyPropertyChangedEventArgs args) { AppInfoItem source = (AppInfoItem)sender; source.ImgIcon.Source = new BitmapImage(new Uri((string)args.NewValue, UriKind.Relative)); }
private static void OnAppStateChanged(object sender, DependencyPropertyChangedEventArgs args) { AppInfoItem source = (AppInfoItem)sender; source.LblState.Content = (string)args.NewValue; }