private void InitCategory() { this.CategoryCourses = new ObservableCollection <CategoryItemModel>(); this.CategoryCourses.Add(new CategoryItemModel("全部", true)); this.CategoryCourses.Add(new CategoryItemModel("公开课")); this.CategoryCourses.Add(new CategoryItemModel("VIP课程")); this.CategoryTechnology = new ObservableCollection <CategoryItemModel>(); this.CategoryTechnology.Add(new CategoryItemModel("全部", true)); this.CategoryTechnology.Add(new CategoryItemModel("C#")); this.CategoryTechnology.Add(new CategoryItemModel("ASP.NET")); this.CategoryTechnology.Add(new CategoryItemModel("微服务")); this.CategoryTechnology.Add(new CategoryItemModel("Java")); this.CategoryTechnology.Add(new CategoryItemModel("Vue")); this.CategoryTechnology.Add(new CategoryItemModel("微信小程序")); this.CategoryTechnology.Add(new CategoryItemModel("Winform")); this.CategoryTechnology.Add(new CategoryItemModel("WPF")); this.CategoryTechnology.Add(new CategoryItemModel("上位机")); this.CategoryTeacher = new ObservableCollection <CategoryItemModel>(); this.CategoryTeacher.Add(new CategoryItemModel("全部", true)); foreach (var item in LocalDataAccess.GetInstance().GetTeachers()) { this.CategoryTeacher.Add(new CategoryItemModel(item)); } }
private void InitCourseList() { courseAll = LocalDataAccess.GetInstance().GetCourses(); CourseList = new ObservableCollection <CourseModel>(courseAll); }
private void InitCategory() { this.CategoryCourses = new ObservableCollection <CategoryItemModel>(); this.CategoryCourses.Add(new CategoryItemModel("全部", true)); this.CategoryCourses.Add(new CategoryItemModel("公开课")); this.CategoryCourses.Add(new CategoryItemModel("VIP课程")); this.CategoryTechnology = new ObservableCollection <CategoryItemModel>(); this.CategoryTechnology.Add(new CategoryItemModel("全部", true)); this.CategoryTechnology.Add(new CategoryItemModel("C#")); this.CategoryTechnology.Add(new CategoryItemModel("JAVA")); this.CategoryTechnology.Add(new CategoryItemModel("Winform")); this.CategoryTechnology.Add(new CategoryItemModel("wechat")); this.CategoryTechnology.Add(new CategoryItemModel("eplan")); this.CategoryTechnology.Add(new CategoryItemModel("Tia")); this.CategoryTechnology.Add(new CategoryItemModel("beckhoff")); this.CategoryTechnology.Add(new CategoryItemModel("siemens")); this.CategoryTechnology.Add(new CategoryItemModel("mitsbishi")); this.CategoryTechnology.Add(new CategoryItemModel("omron")); this.CategoryTeacher = new ObservableCollection <CategoryItemModel>(); this.CategoryTeacher.Add(new CategoryItemModel("全部", true)); foreach (var item in LocalDataAccess.GetInstance().GetTeachers()) { this.CategoryTeacher.Add(new CategoryItemModel(item)); } }
private void DoLogin(object o) { this.ShowProgress = Visibility.Visible; this.ErrorMessage = ""; if (string.IsNullOrEmpty(LoginModel.UserName)) { this.ErrorMessage = "请输入用户名!"; this.ShowProgress = Visibility.Collapsed; return; } if (string.IsNullOrEmpty(LoginModel.Password)) { this.ErrorMessage = "请输入密码!"; this.ShowProgress = Visibility.Collapsed; return; } if (string.IsNullOrEmpty(LoginModel.ValidationCode)) { this.ErrorMessage = "请输入验证码!"; this.ShowProgress = Visibility.Collapsed; return; } if (LoginModel.ValidationCode.ToLower() != "etu4") { this.ErrorMessage = "验证码输入不正确!"; this.ShowProgress = Visibility.Collapsed; return; } Task.Run(new Action(() => { try { var user = LocalDataAccess.GetInstance().CheckUserInfo(LoginModel.UserName, LoginModel.Password); if (user == null) { throw new Exception("登录失败!用户名或密码错误!"); } GlobalValues.UserInfo = user; Application.Current.Dispatcher.Invoke(new Action(() => { (o as Window).DialogResult = true; })); } catch (Exception ex) { this.ErrorMessage = ex.Message; } finally { Application.Current.Dispatcher.Invoke(new Action(() => { this.ShowProgress = Visibility.Collapsed; })); } })); }
private void InitCourseSeries() { var cList = LocalDataAccess.GetInstance().GetCoursePlayRecord(); this.ItemCount = cList.Max(c => c.SeriesList.Count); foreach (var item in cList) { this.CourseSeriesList.Add(item); } }
private void initCourseSeriesList() { List <CourseSeriesModel> li = LocalDataAccess.GetInstance().GetCoursePlayRecord(); this.ItemCount = li.Max(l => l.SeriesList.Count); foreach (var item in LocalDataAccess.GetInstance().GetCoursePlayRecord()) { CourseSeriesList.Add(item); } }
private void DoLogin(object o) { //有专门表单验证的库,比较少,所以用这种方式判断。 if (string.IsNullOrEmpty(LoginModel.UserName)) { this.ErroMessage = "请输入用户名!"; return; //如果没有输入用户名的话就不执行下面的判断了。 } if (string.IsNullOrEmpty(LoginModel.Password)) { this.ErroMessage = "请输入密码!"; return; } if (string.IsNullOrEmpty(LoginModel.VerificationCode)) { this.ErroMessage = "请输入验证码!"; return; } if (LoginModel.VerificationCode.ToLower() != "vmo4") { this.ErroMessage = "验证码错误!"; return; } Task.Run(new Action(() => //开一个线程 { try { var user = LocalDataAccess.GetInstance().CheckUserInfo(LoginModel.UserName, LoginModel.Password); if (user == null) { throw new Exception("登录失败,用户名或者密码错误"); } GlobalValues.UserInfo = user; } catch (Exception ee) { this.ErroMessage = ee.Message; } })); }
private void InitCourseCategory() { this.CategoryCourses = new ObservableCollection <CategoryItemModel>(); this.CategoryCourses.Add(new CategoryItemModel("All", true)); this.CategoryCourses.Add(new CategoryItemModel("Open Courses")); this.CategoryCourses.Add(new CategoryItemModel("VIP Courses")); this.CategoryTechniques = new ObservableCollection <CategoryItemModel>(); this.CategoryTechniques.Add(new CategoryItemModel("All", true)); this.CategoryTechniques.Add(new CategoryItemModel(".Net")); this.CategoryTechniques.Add(new CategoryItemModel("Java")); this.CategoryInstructors = new ObservableCollection <CategoryItemModel>(); this.CategoryInstructors.Add(new CategoryItemModel("All", true)); foreach (var item in LocalDataAccess.GetInstance().GetInstructorsInfo()) { this.CategoryInstructors.Add(new CategoryItemModel(item)); } }
public CoursePageViewModel() { this.CategoryCourses = new ObservableCollection <CategoryItemModel>(); this.CategoryCourses.Add(new CategoryItemModel { CategoryName = "全部", IsSelected = true }); this.CategoryCourses.Add(new CategoryItemModel { CategoryName = "公开课" }); this.CategoryCourses.Add(new CategoryItemModel { CategoryName = "VIP课程" }); this.CategoryTechology = new ObservableCollection <CategoryItemModel>(); this.CategoryTechology.Add(new CategoryItemModel { CategoryName = "全部", IsSelected = true }); this.CategoryTechology.Add(new CategoryItemModel { CategoryName = "c#" }); this.CategoryTechology.Add(new CategoryItemModel { CategoryName = "ASP.net" }); this.CategoryTechology.Add(new CategoryItemModel { CategoryName = "微服务" }); this.CategoryTechology.Add(new CategoryItemModel { CategoryName = "JAVA" }); this.CategoryTeacher = new ObservableCollection <CategoryItemModel>(); //List<string> teachers = LocalDataAccess.GetInstance().GetTeachers(); List <string> teachers = LocalDataAccess.GetInstance().GetTeachers(); this.CategoryTeacher.Add(new CategoryItemModel("全部", true)); teachers.ForEach(t => this.CategoryTeacher.Add(new CategoryItemModel(t))); }
private void InitCourseList() { for (int i = 0; i < 10; i++) { CourseList.Add(new CourseModel { IsShowSkeleton = true }); } Task.Run(new Action(async() => { courseAll = LocalDataAccess.GetInstance().GetCourses(); await Task.Delay(4000); Application.Current.Dispatcher.Invoke(new Action(() => { CourseList.Clear(); foreach (var item in courseAll) { CourseList.Add(item); } })); })); }
private void DoLogin(object o) { this.ErrorMessege = ""; if (string.IsNullOrEmpty(LoginModel.UserName)) { this.ErrorMessege = "请输入用户名!!"; return; } if (string.IsNullOrEmpty(LoginModel.Password)) { this.ErrorMessege = "请输入密码!!"; return; } if (string.IsNullOrEmpty(LoginModel.ValidationCode)) { this.ErrorMessege = "请输入验证码!!"; return; } Task.Run(new Action(() => { try { var user = LocalDataAccess.GetInstance().CheckUserInfo(LoginModel.UserName, LoginModel.Password); if (user == null) { throw new Exception("登录失败!用户名或者密码失败!!"); } GlobalValues.UserInfo = user; Application.Current.Dispatcher.Invoke(new Action(() => { (o as Window).DialogResult = true; })); }catch (Exception ex) { this.ErrorMessege = ex.Message; } })); }
//login logic Validation private void DoLogin(object o) { this.ShowProgress = Visibility.Visible; this.ErrorMessage = ""; if (string.IsNullOrEmpty(LoginModel.Username)) { this.ErrorMessage = "Please Enter User Name!"; this.ShowProgress = Visibility.Collapsed; return; } if (string.IsNullOrEmpty(LoginModel.Password)) { this.ErrorMessage = "Please Enter Password!"; this.ShowProgress = Visibility.Collapsed; return; } if (string.IsNullOrEmpty(LoginModel.ValidataionInputCode)) { this.ErrorMessage = "Please Enter Validation Code!"; this.ShowProgress = Visibility.Collapsed; return; } if (LoginModel.ValidataionInputCode.Length < 4 || LoginModel.ValidataionInputCode != LoginModel.ValidationCode.ToLower()) { this.ErrorMessage = "Incorrect Validation Code!"; this.ShowProgress = Visibility.Collapsed; return; } Task.Run(new Action(() => { try { var user = LocalDataAccess.GetInstance().CheckUserInfo(LoginModel.Username, LoginModel.Password); if (user == null) { throw new Exception("Login Failed! User Name or Password is incorrect!"); } ////Store DB info into a global variable GlobalValues.UserInfo = user; ////click login button, then commandparameter will execute and jump to main window ////then, program will execute App.xaml.cs ////因为时从子线程中直接更新UI线程创建的对象,所以要用Dispatcher Application.Current.Dispatcher.Invoke(new Action(() => { (o as Window).DialogResult = true; })); } catch (Exception ex) { this.ErrorMessage = ex.Message; } })); }
private void InitCourseSeries() { //CourseSeriesList.Add(new CourseSeriesModel //{ // CourseName = "C#", // SeriesCollection = new LiveCharts.SeriesCollection { new PieSeries { Title="eeeedddiiisss", // Values=new ChartValues<ObservableValue>{ new ObservableValue(123)},DataLabels=false, // },new PieSeries { Title="eeeedddiiisss", // Values=new ChartValues<ObservableValue>{ new ObservableValue(123)},DataLabels=false, // } }, // SeriesList=new ObservableCollection<SeriesModel> // { // new SeriesModel{ SeriesName = "Cloudd",CurrentValue=161,IsGrowing=false,ChangeRate=75}, // new SeriesModel{ SeriesName = "Cloudd",CurrentValue=161,IsGrowing=false,ChangeRate=75}, // new SeriesModel{ SeriesName = "Cloudd",CurrentValue=161,IsGrowing=false,ChangeRate=75}, // new SeriesModel{ SeriesName = "Cloudd",CurrentValue=161,IsGrowing=false,ChangeRate=75}, // new SeriesModel{ SeriesName = "Cloudd",CurrentValue=161,IsGrowing=false,ChangeRate=75} // } //}) ; //CourseSeriesList.Add(new CourseSeriesModel //{ // CourseName = "C#", // SeriesCollection = new LiveCharts.SeriesCollection { new PieSeries { Title="eeeedddiiisss", // Values=new ChartValues<ObservableValue>{ new ObservableValue(123)},DataLabels=false, // },new PieSeries { Title="eeeedddiiisss", // Values=new ChartValues<ObservableValue>{ new ObservableValue(123)},DataLabels=false, // } }, // SeriesList = new ObservableCollection<SeriesModel> // { // new SeriesModel{ SeriesName = "Cloudd",CurrentValue=161,IsGrowing=false,ChangeRate=75}, // new SeriesModel{ SeriesName = "Cloudd",CurrentValue=161,IsGrowing=false,ChangeRate=75}, // new SeriesModel{ SeriesName = "Cloudd",CurrentValue=161,IsGrowing=false,ChangeRate=75}, // new SeriesModel{ SeriesName = "Cloudd",CurrentValue=161,IsGrowing=false,ChangeRate=75}, // new SeriesModel{ SeriesName = "Cloudd",CurrentValue=161,IsGrowing=false,ChangeRate=75} // } //}); //CourseSeriesList.Add(new CourseSeriesModel //{ // CourseName = "C#", // SeriesCollection = new LiveCharts.SeriesCollection { new PieSeries { Title="eeeedddiiisss", // Values=new ChartValues<ObservableValue>{ new ObservableValue(123)},DataLabels=false, // },new PieSeries { Title="eeeedddiiisss", // Values=new ChartValues<ObservableValue>{ new ObservableValue(123)},DataLabels=false, // } }, // SeriesList = new ObservableCollection<SeriesModel> // { // new SeriesModel{ SeriesName = "Cloudd",CurrentValue=161,IsGrowing=false,ChangeRate=75}, // new SeriesModel{ SeriesName = "Cloudd",CurrentValue=161,IsGrowing=false,ChangeRate=75}, // new SeriesModel{ SeriesName = "Cloudd",CurrentValue=161,IsGrowing=false,ChangeRate=75}, // new SeriesModel{ SeriesName = "Cloudd",CurrentValue=161,IsGrowing=false,ChangeRate=75}, // new SeriesModel{ SeriesName = "Cloudd",CurrentValue=161,IsGrowing=false,ChangeRate=75} // } //}); var cList = LocalDataAccess.GetInstance().GetCoursePlayRecord(); foreach (var item in cList) { this.CourseSeriesList.Add(item); } }
private void InitCourseSeries() { var cList = LocalDataAccess.GetInstance().GetCoursePlayRecord(); this.ItemCount = cList.Max(c => c.SeriesList.Count); foreach (var item in cList) { this.CourseSeriesList.Add(item); } //CourseSeriesList.Add(new CourseSeriesModel // { // CourseName = "Java Advanced Practice VIP", // SeriesCollection = new LiveCharts.SeriesCollection // { // new PieSeries{ // Title="Zhang's", // Values= new ChartValues<ObservableValue>{ new ObservableValue(123)}, // DataLabels=false}, // new PieSeries // { // Title="Zhang's", // Values= new ChartValues<ObservableValue>{ new ObservableValue(123)}, // DataLabels=false // } // }, // SeriesList = new ObservableCollection<SeriesModel> // { // new SeriesModel // { // SeriesName="Class 1", CurrentViewCount=161, IsGrowing=false, GrowingRate=-75 // }, // new SeriesModel // { // SeriesName="Class 2", CurrentViewCount=161, IsGrowing=false, GrowingRate=-75 // }, // new SeriesModel // { // SeriesName="Class 3", CurrentViewCount=161, IsGrowing=true, GrowingRate=-75 // }, // new SeriesModel // { // SeriesName="Class 4", CurrentViewCount=161, IsGrowing=false, GrowingRate=-75 // }, // new SeriesModel // { // SeriesName="Class 5", CurrentViewCount=161, IsGrowing=true, GrowingRate=-75 // } // } // }); //CourseSeriesList.Add(new CourseSeriesModel //{ // CourseName = "Java Advanced Practice VIP 2", // SeriesCollection = new LiveCharts.SeriesCollection // { // new PieSeries{ // Title="Zhang's", // Values= new ChartValues<ObservableValue>{ new ObservableValue(123)}, // DataLabels=false}, // new PieSeries // { // Title="Zhang's", // Values= new ChartValues<ObservableValue>{ new ObservableValue(123)}, // DataLabels=false // } // }, // SeriesList = new ObservableCollection<SeriesModel> // { // new SeriesModel // { // SeriesName="Class 1", CurrentViewCount=161, IsGrowing=false, GrowingRate=-75 // }, // new SeriesModel // { // SeriesName="Class 2", CurrentViewCount=161, IsGrowing=false, GrowingRate=-75 // }, // new SeriesModel // { // SeriesName="Class 3", CurrentViewCount=161, IsGrowing=true, GrowingRate=-75 // }, // new SeriesModel // { // SeriesName="Class 4", CurrentViewCount=161, IsGrowing=false, GrowingRate=-75 // }, // new SeriesModel // { // SeriesName="Class 5", CurrentViewCount=161, IsGrowing=true, GrowingRate=-75 // } // } //}); }