using Common.system; using System; using System.Collections.ObjectModel; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.IO; using System.Threading; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using XHZB.Desktop.Utils; using XHZB.Model; namespace XHZB.Desktop { /// /// 个人空间 LessonPreparationWindow.xaml 的交互逻辑 /// public partial class UserCenterWindow : Window, DownloadUtil.DownloadCallback { private int serverReturnCode = 0; private readonly RegisterController registerController = new RegisterController(); internal UserCenterPageData pageData = new UserCenterPageData(); private bool isInitial = false; private Thread thread; private bool initialization = true; /// /// 下拉框数据源 /// public DataTable data = new DataTable(); /// /// 是否是下载状态 默认false 不是 /// private bool isDownloadStatus = false; /// /// 教材关系表id /// private int Lsbid = 0; /// /// 章节id /// private int Directorid = 0; /// /// 资源分类1音频2视频3图片4文档 /// private int Resourceclass = 0; /// /// 个人空间 /// public UserCenterWindow() { InitializeComponent(); DataContext = pageData; //初始化配置文件 //ZJConfigUtil.init(); isInitial = true; Resourceclass = 0; Lsbid = APP.REQStartClass.lsbid; Directorid = APP.REQStartClass.directorid; borAll.Background = new SolidColorBrush(Colors.DodgerBlue); borAudio.Background = new SolidColorBrush(Colors.Transparent); borVideo.Background = new SolidColorBrush(Colors.Transparent); borImage.Background = new SolidColorBrush(Colors.Transparent); borDoc.Background = new SolidColorBrush(Colors.Transparent); btnAll.Foreground = new SolidColorBrush(Colors.White); btnAudio.Foreground = new SolidColorBrush(Colors.Black); btnVideo.Foreground = new SolidColorBrush(Colors.Black); btnImage.Foreground = new SolidColorBrush(Colors.Black); btnDoc.Foreground = new SolidColorBrush(Colors.Black); initJiaocai(); } private void initJiaocai() { System.Collections.Generic.List list = APP.TsubjectbookList; int selectIndex = 0; for (int i = 0; i < list.Count; i++) { TsubjectbookListModel book = list[i]; if (book.lsbid == APP.lsbid) { selectIndex = i; } pageData.bookList.Add(new ComboBoxBeanModel() { Key = book.lsbid, Value = $"{book.subjectname} {book.bookname}" }); } cmbClass.SelectedIndex = selectIndex; } /// /// 章节列表服务-调用 /// /// private object InvokeDirectorListServering() { APP.DirectorList = null; serverReturnCode = registerController.DirectorList(Lsbid,2,APP.LoginUser.userid); return APP.ErrorMessage; } /// /// 章节列表服务-返回结果 /// /// public void InvokeServerDirectorListCompate(object obj) { if (serverReturnCode == APP.ServerScuessCode) { if (!isInitial) { Directorid = 0; isInitial = false; } pageData.zhangjieList.Clear(); pageData.zhangjieList.Add(new ChapterModel() { directorid = 0, directorname = "全部", level = 1, selected = 0 }); System.Collections.Generic.List list = APP.DirectorList; for (int i = 0; i < list.Count; i++) { DirectorListModel item = APP.DirectorList[i]; pageData.zhangjieList.Add(new ChapterModel() { directorid = item.directorid, directorname = item.directorname, level = item.directorlevel, selected = 0 }); addChild(item); } foreach (ChapterModel zhangjie in pageData.zhangjieList) { if (Directorid == zhangjie.directorid) { zhangjie.selected = 1; } else { zhangjie.selected = 0; } } APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeResourceMyListServering, InvokeServerResourceMyListCompate); } else { MessageWindow.Show(APP.ErrorMessage); } } private void addChild(DirectorListModel directorList) { if (directorList.children != null && directorList.children.Count > 0) { foreach (DirectorListModel child in directorList.children) { pageData.zhangjieList.Add(new ChapterModel() { directorid = child.directorid, directorname = getSpace(child.directorlevel) + child.directorname }); if (child.children != null && child.children.Count > 0) { addChild(child); } } } } private string getSpace(int num) { string str = ""; for (int i = 0; i < num; i++) { str += " "; } return str; } private void zhangjieClick(object sender, RoutedEventArgs e) { ChapterModel item = ((Button)sender).Tag as ChapterModel; foreach (ChapterModel zhangjie in pageData.zhangjieList) { if (item.directorid == zhangjie.directorid) { zhangjie.selected = 1; } else { zhangjie.selected = 0; } } Directorid = item.directorid; APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeResourceMyListServering, InvokeServerResourceMyListCompate); } /// /// 我的备课列表服务-调用 /// /// private object InvokeResourceMyListServering() { Dispatcher.Invoke(new Action(() => { APP.myloading.Show(); })); APP.ResourceMyList = null; serverReturnCode = registerController.ResourceMyList(Lsbid, Directorid, Resourceclass); return APP.ErrorMessage; } /// /// 我的备课列表服务-返回结果 /// /// public void InvokeServerResourceMyListCompate(object obj) { Dispatcher.Invoke(new Action(() => { APP.myloading.Hide(); })); if (serverReturnCode == APP.ServerScuessCode) { if (pageData.menuList.Count > 0) { pageData.menuList.Clear(); DataContext = pageData; } if (APP.ResourceMyList.obj != null) { System.Collections.Generic.List resource = new System.Collections.Generic.List(); for (int i = 0; i < APP.ResourceMyList.obj.Count; i++) { string imgSuffix = string.Empty; string visDuration = "Collapsed"; string visButton = "Collapsed"; string visDownload = "Visible"; System.DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); dateTime = dateTime.AddSeconds(APP.ResourceMyList.obj[i].createtime).ToLocalTime(); if ("doc".Equals(APP.ResourceMyList.obj[i].suffix) || "docx".Equals(APP.ResourceMyList.obj[i].suffix)) { imgSuffix = "../Images/Resource/DOC.png"; } else if ("ppt".Equals(APP.ResourceMyList.obj[i].suffix) || "pptx".Equals(APP.ResourceMyList.obj[i].suffix)) { imgSuffix = "../Images/Resource/PPT.png"; } else if ("pdf".Equals(APP.ResourceMyList.obj[i].suffix)) { imgSuffix = "../Images/Resource/PDF.png"; } else if ("excel".Equals(APP.ResourceMyList.obj[i].suffix) || "xls".Equals(APP.ResourceMyList.obj[i].suffix) || "xlsx".Equals(APP.ResourceMyList.obj[i].suffix)) { imgSuffix = "../Images/Resource/EXCEL.png"; } else if ("class".Equals(APP.ResourceMyList.obj[i].suffix)) { imgSuffix = "../Images/Resource/CLASS.png"; } else if ("dsc".Equals(APP.ResourceMyList.obj[i].suffix)) { imgSuffix = "../Images/Resource/DSC.png"; } else if ("mp3".Equals(APP.ResourceMyList.obj[i].suffix)) { visDuration = "Visible"; imgSuffix = "../Images/Resource/MP3.png"; } else if ("mp4".Equals(APP.ResourceMyList.obj[i].suffix) || "flv".Equals(APP.ResourceMyList.obj[i].suffix)) { visDuration = "Visible"; if (APP.ResourceMyList.obj[i].resourcecover != null) { imgSuffix = APP.showImageUrl + APP.ResourceMyList.obj[i].resourcecover.ToString(); } else { imgSuffix = "../Images/Resource/MP4.png"; } } else if ("png".Equals(APP.ResourceMyList.obj[i].suffix) || "jpg".Equals(APP.ResourceMyList.obj[i].suffix) || "jpeg".Equals(APP.ResourceMyList.obj[i].suffix)) { imgSuffix = "../Images/Resource/PNG.png"; } else if ("txt".Equals(APP.ResourceMyList.obj[i].suffix)) { imgSuffix = "../Images/Resource/TXT.png"; } else if ("txt".Equals(APP.ResourceMyList.obj[i].suffix)) { imgSuffix = "../Images/Resource/FLV.png"; } else if ("wav".Equals(APP.ResourceMyList.obj[i].suffix)) { imgSuffix = "../Images/Resource/WAV.png"; } string resourcesSuffix = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\" + APP.LoginUser.username + "\\" + APP.ResourceMyList.obj[i].resourcename + "." + APP.ResourceMyList.obj[i].suffix; if (!string.IsNullOrWhiteSpace(APP.fileStorageAddress)) { resourcesSuffix = APP.fileStorageAddress + "\\" + APP.ResourceMyList.obj[i].resourcename + "." + APP.ResourceMyList.obj[i].suffix; } if (File.Exists(resourcesSuffix))//检查资源是否已经存在 { visButton = "Visible"; visDownload = "Collapsed"; } string resourcesize; if (APP.ResourceMyList.obj[i].resourcesize > 1024) { if (APP.ResourceMyList.obj[i].resourcesize / 1024 > 1024) { resourcesize = (APP.ResourceMyList.obj[i].resourcesize / 1024 / 1024).ToString() + "MB"; } else { resourcesize = (APP.ResourceMyList.obj[i].resourcesize / 1024).ToString() + "KB"; } } else { resourcesize = (APP.ResourceMyList.obj[i].resourcesize).ToString() + "B"; } string duration = string.Empty; if (APP.ResourceMyList.obj[i].duration > 59) { if (APP.ResourceMyList.obj[i].duration > 3599) { if (APP.ResourceMyList.obj[i].duration % 3600 == 0) { duration = (APP.ResourceMyList.obj[i].duration / 3600).ToString() + "时"; } else { duration = (APP.ResourceMyList.obj[i].duration / 3600).ToString() + "时" + (APP.ResourceMyList.obj[i].duration % 3600).ToString() + "分"; } } else { if (APP.ResourceMyList.obj[i].duration % 60 == 0) { duration = (APP.ResourceMyList.obj[i].duration / 60).ToString() + "分"; } else { duration = (APP.ResourceMyList.obj[i].duration / 60).ToString() + "分" + (APP.ResourceMyList.obj[i].duration % 60).ToString() + "秒"; } } } else { duration = APP.ResourceMyList.obj[i].duration.ToString() + "秒"; } pageData.menuList.Add(new ToolbarMenuTwo() { Resourcesize = resourcesize, ResourceName = APP.ResourceMyList.obj[i].resourcename, Times = dateTime.ToString("yyy-MM-dd HH:mm:ss"), Pic = imgSuffix, VisDuration = visDuration, Duration = duration, VisButton = visButton, VisDownload = visDownload, Resourceid = APP.ResourceMyList.obj[i].resourceid }); } } DataContext = pageData; } else { MessageWindow.Show(APP.ErrorMessage); } } private void DownLoadTwo(string httpurls, int position, string savepath) { thread = DownloadUtil.downloadFileWithCallback( httpurls, position, savepath, Dispatcher, this ); } /// /// 下载 /// /// /// private void btnDownload_Click(object sender, RoutedEventArgs e) { if (!isDownloadStatus) { int clickindex = 0; Button btn = (Button)sender; for (int i = 0; i < APP.ResourceMyList.obj.Count; i++) { if (APP.ResourceMyList.obj[i].resourceid == Convert.ToInt32(btn.Tag)) { clickindex = i; break; } } string fileAddress = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\" + APP.LoginUser.username + "\\" + APP.ResourceMyList.obj[clickindex].resourcename + "." + APP.ResourceMyList.obj[clickindex].suffix; if (!string.IsNullOrWhiteSpace(APP.fileStorageAddress)) { fileAddress = APP.fileStorageAddress + "\\" + APP.ResourceMyList.obj[clickindex].resourcename + "." + APP.ResourceMyList.obj[clickindex].suffix; } //if (APP.outputInforLog) //{ // LogHelper.WriteInfoLog("UserCenterWindow(btnDownload_Click 下载)" + fileAddress); //} if (Directory.Exists(fileAddress))//存在就打开 不存在就下载 { ProcessStartInfo psi = new ProcessStartInfo(fileAddress); Process pro = new Process { StartInfo = psi }; pro.Start(); } else { if (!string.IsNullOrWhiteSpace(APP.fileStorageAddress)) { fileAddress = APP.fileStorageAddress; } if (!Directory.Exists(fileAddress)) { Directory.CreateDirectory(fileAddress); } string userHeadPic = APP.showImageUrl + APP.ResourceMyList.obj[clickindex].resourceurl.ToString(); DownLoadTwo(userHeadPic, 9999 + clickindex, fileAddress + "\\"); } } } /// /// 打开 /// /// /// private void btnTurnOn_Click(object sender, RoutedEventArgs e) { if (!isDownloadStatus) { int clickindex = 0; Button btn = (Button)sender; for (int i = 0; i < APP.ResourceMyList.obj.Count; i++) { if (APP.ResourceMyList.obj[i].resourceid == Convert.ToInt32(btn.Tag)) { clickindex = i; break; } } string fileAddress = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\" + APP.LoginUser.username + "\\" + APP.ResourceMyList.obj[clickindex].resourcename + "." + APP.ResourceMyList.obj[clickindex].suffix; if (!string.IsNullOrWhiteSpace(APP.fileStorageAddress)) { fileAddress = APP.fileStorageAddress + "\\" + APP.ResourceMyList.obj[clickindex].resourcename + "." + APP.ResourceMyList.obj[clickindex].suffix; } //if (APP.outputInforLog) //{ // LogHelper.WriteInfoLog("UserCenterWindow(btnTurnOn_Click 打开)" + fileAddress); //} if (Directory.Exists(fileAddress))//存在就打开 不存在就下载 { try { ProcessStartInfo psi = new ProcessStartInfo(fileAddress); Process pro = new Process { StartInfo = psi }; pro.Start(); } catch (Exception ex) { LogHelper.WriteErrLog("UserCenterWindow【btnTurnOn_Click】" + ex.Message, ex); MessageWindow.Show(ex.Message); return; } } else { if (!string.IsNullOrWhiteSpace(APP.fileStorageAddress)) { fileAddress = APP.fileStorageAddress; } if (!Directory.Exists(fileAddress)) { Directory.CreateDirectory(fileAddress); } string userHeadPic = APP.showImageUrl + APP.ResourceMyList.obj[clickindex].resourceurl.ToString(); DownLoadTwo(userHeadPic, 9999 + clickindex, fileAddress + "\\"); } } } /// /// 全部 /// /// /// private void btnAll_Click(object sender, RoutedEventArgs e) { pageData.menuList.Clear(); DataContext = pageData; Resourceclass = 0; borAll.Background = new SolidColorBrush(Colors.DodgerBlue); borAudio.Background = new SolidColorBrush(Colors.Transparent); borVideo.Background = new SolidColorBrush(Colors.Transparent); borImage.Background = new SolidColorBrush(Colors.Transparent); borDoc.Background = new SolidColorBrush(Colors.Transparent); btnAll.Foreground = new SolidColorBrush(Colors.White); btnAudio.Foreground = new SolidColorBrush(Colors.Black); btnVideo.Foreground = new SolidColorBrush(Colors.Black); btnImage.Foreground = new SolidColorBrush(Colors.Black); btnDoc.Foreground = new SolidColorBrush(Colors.Black); APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeResourceMyListServering, InvokeServerResourceMyListCompate); } private void Window_Closing(object sender, CancelEventArgs e) { if (pageData.menuList.Count > 0) { pageData.menuList.Clear(); DataContext = null; } } /// /// 音频 /// /// /// private void btnAudio_Click(object sender, RoutedEventArgs e) { pageData.menuList.Clear(); DataContext = pageData; Resourceclass = 1; borAll.Background = new SolidColorBrush(Colors.Transparent); borAudio.Background = new SolidColorBrush(Colors.DodgerBlue); borVideo.Background = new SolidColorBrush(Colors.Transparent); borImage.Background = new SolidColorBrush(Colors.Transparent); borDoc.Background = new SolidColorBrush(Colors.Transparent); btnAll.Foreground = new SolidColorBrush(Colors.Black); btnAudio.Foreground = new SolidColorBrush(Colors.White); btnVideo.Foreground = new SolidColorBrush(Colors.Black); btnImage.Foreground = new SolidColorBrush(Colors.Black); btnDoc.Foreground = new SolidColorBrush(Colors.Black); APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeResourceMyListServering, InvokeServerResourceMyListCompate); } /// /// 视频 /// /// /// private void btnVideo_Click(object sender, RoutedEventArgs e) { pageData.menuList.Clear(); DataContext = pageData; Resourceclass = 2; borAll.Background = new SolidColorBrush(Colors.Transparent); borAudio.Background = new SolidColorBrush(Colors.Transparent); borVideo.Background = new SolidColorBrush(Colors.DodgerBlue); borImage.Background = new SolidColorBrush(Colors.Transparent); borDoc.Background = new SolidColorBrush(Colors.Transparent); btnAll.Foreground = new SolidColorBrush(Colors.Black); btnAudio.Foreground = new SolidColorBrush(Colors.Black); btnVideo.Foreground = new SolidColorBrush(Colors.White); btnImage.Foreground = new SolidColorBrush(Colors.Black); btnDoc.Foreground = new SolidColorBrush(Colors.Black); APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeResourceMyListServering, InvokeServerResourceMyListCompate); } /// /// 图片 /// /// /// private void btnImage_Click(object sender, RoutedEventArgs e) { pageData.menuList.Clear(); DataContext = pageData; Resourceclass = 3; borAll.Background = new SolidColorBrush(Colors.Transparent); borAudio.Background = new SolidColorBrush(Colors.Transparent); borVideo.Background = new SolidColorBrush(Colors.Transparent); borImage.Background = new SolidColorBrush(Colors.DodgerBlue); borDoc.Background = new SolidColorBrush(Colors.Transparent); btnAll.Foreground = new SolidColorBrush(Colors.Black); btnAudio.Foreground = new SolidColorBrush(Colors.Black); btnVideo.Foreground = new SolidColorBrush(Colors.Black); btnImage.Foreground = new SolidColorBrush(Colors.White); btnDoc.Foreground = new SolidColorBrush(Colors.Black); APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeResourceMyListServering, InvokeServerResourceMyListCompate); } /// /// 文档 /// /// /// private void btnDoc_Click(object sender, RoutedEventArgs e) { pageData.menuList.Clear(); DataContext = pageData; Resourceclass = 4; borAll.Background = new SolidColorBrush(Colors.Transparent); borAudio.Background = new SolidColorBrush(Colors.Transparent); borVideo.Background = new SolidColorBrush(Colors.Transparent); borImage.Background = new SolidColorBrush(Colors.Transparent); borDoc.Background = new SolidColorBrush(Colors.DodgerBlue); btnAll.Foreground = new SolidColorBrush(Colors.Black); btnAudio.Foreground = new SolidColorBrush(Colors.Black); btnVideo.Foreground = new SolidColorBrush(Colors.Black); btnImage.Foreground = new SolidColorBrush(Colors.Black); btnDoc.Foreground = new SolidColorBrush(Colors.White); APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeResourceMyListServering, InvokeServerResourceMyListCompate); } private void Refresh() { pageData.menuList.Clear(); } /// /// 科目教材选择改变事件 /// /// /// private void cmbClass_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (initialization) { initialization = false; } else { Directorid = 0; borAll.Background = new SolidColorBrush(Colors.DodgerBlue); borAudio.Background = new SolidColorBrush(Colors.Transparent); borVideo.Background = new SolidColorBrush(Colors.Transparent); borImage.Background = new SolidColorBrush(Colors.Transparent); borDoc.Background = new SolidColorBrush(Colors.Transparent); btnAll.Foreground = new SolidColorBrush(Colors.White); btnAudio.Foreground = new SolidColorBrush(Colors.Black); btnVideo.Foreground = new SolidColorBrush(Colors.Black); btnImage.Foreground = new SolidColorBrush(Colors.Black); btnDoc.Foreground = new SolidColorBrush(Colors.Black); } if (cmbClass.SelectedValue != null) { Lsbid = Convert.ToInt32(cmbClass.SelectedValue.ToString()); Refresh(); APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeDirectorListServering, InvokeServerDirectorListCompate); } else { Refresh(); } } private void Window_MouseMove(object sender, MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { //执行移动方法 DragMove(); } } private void btnDown_Click(object sender, RoutedEventArgs e) { if (thread != null) { thread.Abort(); } APP.myloading.Hide(); Close(); //ToolbarWindow.IsOpenUserCenterWindow = false; } public void downloadBegin(int position) { isDownloadStatus = true; if (position >= 9999) { tip_outer.Visibility = Visibility.Visible; } } public void downloadProgress(int position, int progress) { if (position >= 9999) { pgbProcess.Value = progress * 100 / 100; lbProcess.Content = string.Format("{0}% / {1}%", progress, 100); } } public void downloadEnd(int position, string filepath) { isDownloadStatus = false; thread = null; if (pageData.menuList.Count > 0) { //if (APP.outputInforLog) //{ // LogHelper.WriteInfoLog("UserCenterWindow(downloadEnd 下载完成)" + filepath); //} if (position < 9999) { if (pageData.menuList.Count < position) { pageData.menuList[position].Pic = filepath; } } else if (filepath.Contains(pageData.menuList[position - 9999].ResourceName)) { pageData.menuList[position - 9999].VisDownload = "Collapsed"; pageData.menuList[position - 9999].VisButton = "Visible"; tip_outer.Visibility = Visibility.Hidden; try { ProcessStartInfo psi = new ProcessStartInfo(filepath); Process pro = new Process { StartInfo = psi }; pro.Start(); } catch (Exception ex) { LogHelper.WriteErrLog("UserCenterWindow【downloadEnd】" + ex.Message, ex); MessageWindow.Show(ex.Message); return; } } else { tip_outer.Visibility = Visibility.Hidden; try { ProcessStartInfo psi = new ProcessStartInfo(filepath); Process pro = new Process { StartInfo = psi }; pro.Start(); } catch (Exception ex) { LogHelper.WriteErrLog("UserCenterWindow【downloadEnd】" + ex.Message, ex); MessageWindow.Show(ex.Message); return; } } } else { tip_outer.Visibility = Visibility.Hidden; try { ProcessStartInfo psi = new ProcessStartInfo(filepath); Process pro = new Process { StartInfo = psi }; pro.Start(); } catch (Exception ex) { LogHelper.WriteErrLog("UserCenterWindow【downloadEnd】" + ex.Message, ex); MessageWindow.Show(ex.Message); return; } } } public void downloadError(int position, string msg) { Dispatcher.Invoke(new Action(() => { tip_outer.Visibility = Visibility.Collapsed; })); isDownloadStatus = false; if (!msg.Equals("远程服务器返回错误: (404) 未找到。") && !msg.Equals("正在中止线程。")) { MessageWindow.Show(msg); } } public class ButtonBrush { public static readonly DependencyProperty ButtonPressBackgroundProperty = DependencyProperty.RegisterAttached( "ButtonPressBackground", typeof(Brush), typeof(ButtonBrush), new PropertyMetadata(default(Brush))); public static void SetButtonPressBackground(DependencyObject element, Brush value) { element.SetValue(ButtonPressBackgroundProperty, value); } public static Brush GetButtonPressBackground(DependencyObject element) { return (Brush)element.GetValue(ButtonPressBackgroundProperty); } } } public class ToolbarMenuTwo : NotifyModel { internal string _resourceName; public string ResourceName { get => _resourceName; set { _resourceName = value; OnPropertyChanged("ResourceName"); } } internal string _times; public string Times { get => _times; set { _times = value; OnPropertyChanged("Times"); } } internal string _Pic; public string Pic { get => _Pic; set { _Pic = value; OnPropertyChanged("Pic"); } } /// /// 视频时长秒 /// public string Duration { get; set; } /// /// 视频时长是否显示 /// public string VisDuration { get; set; } /// /// 文件大小 /// public string Resourcesize { get; set; } internal string _VisButton; /// /// 打开按钮是否显示 /// public string VisButton { get => _VisButton; set { _VisButton = value; OnPropertyChanged("VisButton"); } } internal string _VisDownload; /// /// 下载按钮是否显示 /// public string VisDownload { get => _VisDownload; set { _VisDownload = value; OnPropertyChanged("VisDownload"); } } internal int _Resourceid; /// /// 资源id /// public int Resourceid { get => _Resourceid; set { _Resourceid = value; OnPropertyChanged("Resourceid"); } } } public class UserCenterPageData : NotifyModel { public ObservableCollection bookList { get; set; } public ObservableCollection zhangjieList { get; set; } public ObservableCollection menuList { get; set; } public UserCenterPageData() { bookList = new ObservableCollection(); zhangjieList = new ObservableCollection(); menuList = new ObservableCollection(); } } public class ChapterModel : NotifyModel { public int directorid { get; set; } public string directorname { get; set; } public int level { get; set; } private int _selected; public int selected { get => _selected; set { _selected = value; OnPropertyChanged("selected"); } } } }