public void AddPaperquestionType() { if (TestPaper == null) { PUMessageBox.ShowDialog("请选择试卷"); return; } if (QuestionTypesValue == 0) { PUMessageBox.ShowDialog("请选择题型"); return; } if (TestPaper != null && TestPaper.Id == 0) { int testPaperid = _examinationPaperBusiness.AddTestPaper(TestPaper); TestPaper.Id = testPaperid; } int id = _examinationPaperBusiness.AddPaperquestionType(new PaperQuestionType() { PaperQuestionTitle = PaperQuestionTitle, TestPaperId = TestPaper.Id, QuestionTypeId = QuestionTypesValue }); ChangeTestPaper(); // PaperquestionTypeTabItems.Add(new PUTabItemModel() { Header = PaperQuestionTitle, Value = id, CanDelete = false, Content = null }); }
public void ShowCancelableAwait() { PUMessageBox.ShowAwait("正在执行......", delegate { PUMessageBox.CloseAwait(); }); }
private void CheckPath() { if (TbtargetPath.Text.Trim().Contains(TbOriginalPath.Text.Trim())) { PUMessageBox.ShowConfirm("路径存在包含关系,无法复制", "温馨提示", buttons: Buttons.OK); } }
public void AddUser() { if (User.Password != VerifyPassword) { PUMessageBox.ShowDialog("两次密码不一致"); return; } if (string.IsNullOrEmpty(User.Account) || string.IsNullOrEmpty(User.UserName) || string.IsNullOrEmpty(User.Password) || string.IsNullOrEmpty(User.MobilePhone)) { PUMessageBox.ShowDialog("内容不能为空"); return; } UserBusiness userBusiness = new UserBusiness(); if (userBusiness.VerifyAccountExists(User.Account)) { PUMessageBox.ShowDialog("账号已存在"); } if (userBusiness.AddUser(User)) { PUMessageBox.ShowDialog("添加用户成功"); User = new User(); } else { PUMessageBox.ShowDialog("添加用户失败"); } }
public void Delete(ItemCollection sender, RoutedPropertyChangedEventArgs <PUComboBoxItem> e) { var item = e.NewValue as PUComboBoxItem; PUMessageBox.ShowDialog($"你点击了“{item.Content}”的删除按钮,但该项目不会立即删除。\n你可以在验证是否允许删除后再手动移除。在此弹窗关闭后,你点击的行项目将会被移除。"); sender.Remove(item); }
public void Login() { UserBusiness userBusiness = new UserBusiness(); //ShellWindowViewModel shellWindowViewModel = GetView(); //_windowManager.ShowWindow(shellWindowViewModel); if (_userName == null || _password == null) { PUMessageBox.ShowDialog("请输入正确的账号密码"); } User = userBusiness.login(_userName, _password.ToString()); if (User == null) { PUMessageBox.ShowDialog("密码或账号错误"); } else { IsLogin = true; var parent = Parent as ShellWindowViewModel; parent.CurrentUser = User; parent.ChoosedValue = "LoginSucceed"; } }
public void UpdateUser() { if (User.Password != VerifyPassword) { PUMessageBox.ShowDialog("两次密码不一致"); return; } if (string.IsNullOrEmpty(User.UserName) || string.IsNullOrEmpty(User.Password) || string.IsNullOrEmpty(User.MobilePhone)) { PUMessageBox.ShowDialog("内容不能为空"); return; } UserBusiness userBusiness = new UserBusiness(); if (userBusiness.UpdateUser(User)) { PUMessageBox.ShowDialog("修改成功"); VerifyPassword = ""; User = new User(); } else { PUMessageBox.ShowDialog("修改失败"); } }
public void AddKnowledgePoint() { _quetionBankBusiness.AddKnowledgePoint(KnowledgePointName); KnowledgePointName = ""; PUMessageBox.ShowDialog("添加成功"); Init(); }
public void AddSubject() { _quetionBankBusiness.AddSubject(SubjectName); SubjectName = ""; PUMessageBox.ShowDialog("添加成功"); Init(); }
/// <summary> /// 查询数据,将查询到的结果放到新建的 temp 类中 /// </summary> /// <param name="className">要查询的类的名字</param> /// <param name="search">查询语句</param> /// <param name="tempClass">要创建的临时类</param> /// <returns></returns> public static bool SearchData(string className, string search, string tempClass) { //定义变量 IVectorCls VectorCls = new SFeatureCls(); //打开简单要素类 bool rtn = VectorCls.Open("GDBP://MapGisLocal/Templates/sfcls/" + className); if (!rtn) { PUMessageBox.ShowDialog("简单要素类 " + className + " 打开失败", "失败"); return(false); } QueryDef def = new QueryDef(); //设置属性查询条件 def.Filter = search; //查询要素 RecordSet recordSet = VectorCls.Select(def); if (recordSet != null) { int num = recordSet.Count; } else { return(false); } Server svr = new Server(); //连接数据源 svr.Connect("MapGISLocal", "", ""); DataBase GDB = svr.OpenGDB("templates"); SFeatureCls tmpSFCls = new SFeatureCls(GDB); int id = tmpSFCls.Create(tempClass, GeomType.Pnt, 0, 0, null); if (id == 0) { bool temp = SFeatureCls.Remove(GDB, tempClass); id = tmpSFCls.Create(tempClass, GeomType.Pnt, 0, 0, null); if (id == 0) { PUMessageBox.ShowDialog("无法操作简单要素类,请检查是否有其他进程正在使用 " + tempClass, "失败"); return(false); } } rtn = tmpSFCls.CopySet(recordSet); if (rtn == false) { tmpSFCls.Close(); SFeatureCls.Remove(GDB, id); } //关闭类 VectorCls.Close(); return(true); }
public void Detail(string category) { switch (category) { case "Button": PUMessageBox.ShowDialog("123"); break; } }
public void Delete(ItemCollection sender, RoutedPropertyChangedEventArgs <PUComboBoxItem> e) { var item = e.NewValue as PUComboBoxItem; if (PUMessageBox.ShowConfirm("确定要删除该选项吗?") == true) { sender.Remove(item); } }
public void BtnCut() { if (_cuter.CutImageSource == null) { PUMessageBox.ShowDialog("没有图片源。"); return; } _image.Source = _cuter.CutImageSource; }
public void BtnCut() { if (_cuter.GetCutedImage() == null) { PUMessageBox.ShowDialog("没有图片源。"); return; } _image.Source = _cuter.GetCutedImage(); }
public void AddExaminationQuestion() { if (Content == null) { PUMessageBox.ShowDialog("内容不能为空"); return; } OptionItem[] optionItems = null; if (HasOption) { optionItems = new OptionItem[] { new OptionItem() { OptionContent = Option1 }, new OptionItem() { OptionContent = Option2 }, new OptionItem() { OptionContent = Option3 }, new OptionItem() { OptionContent = Option4 } }; } if (_quetionBankBusiness.AddExaminationQuestion( new ExaminationQuestion { DifficultyGrade = GradeDifficulty, Content = Content, KnowledgePointId = KnowledgePointValue, QuestionTypeId = QuestionTypesValue, SubjectId = SubjectValue, Score = Score, OptionItems = optionItems, })) { Content = null; KnowledgePointValue = 1; QuestionTypesValue = 1; SubjectValue = 1; Score = 0; Option1 = null; Option2 = null; Option3 = null; Option4 = null; PUMessageBox.ShowDialog("添加成功"); } else { PUMessageBox.ShowDialog("添加失败"); } }
public void SaveQuestionType() { _quetionBankBusiness.SaveQuestionType(new QuestionType() { Id = SelectedValue, QuestionTypeName = QuestionTypeName }); QuestionTypeName = ""; PUMessageBox.ShowDialog("保存成功"); Init(); }
public void SaveKnowledgePoint() { _quetionBankBusiness.SaveKnowledgePoint(new KnowledgePoint() { Id = SelectedValue, KnowledgePointName = KnowledgePointName }); KnowledgePointName = ""; PUMessageBox.ShowDialog("保存成功"); Init(); }
public void SaveSubject() { _quetionBankBusiness.SaveSubject(new Subject() { Id = SelectedValue, SubjectName = SubjectName }); SubjectName = ""; PUMessageBox.ShowDialog("保存成功"); Init(); }
public void ShowCancelableAwait() { PUMessageBox.ShowAwait("正在执行......", delegate { PUMessageBox.CloseAwait(delegate { PUMessageBox.ShowDialog("任务已取消。"); }); }); }
/// <summary> /// 使用数字作为参数不是一个好方法,这里为了方便 /// </summary> /// <param name="category"></param> public void Display(int category) { switch (category) { case 1: var window1 = new Views.Control.Examples.MultiNavWindow(); window1.ShowDialog(); if (!window1.Result.Equals(0)) { PUMessageBox.ShowDialog("最后点击的按钮(缩放和关闭按钮不算)是第" + window1.Result + "个"); } break; case 2: var window2 = new Views.Control.Examples.LoginWindow(); window2.Owner = (Parent as ShellWindowViewModel).GetCurrentWindow(); window2.ShowDialog(); break; case 3: var window4 = new Views.Control.Examples.ChatWindow(); window4.ShowDialog(); break; case 4: SetAwait(true); Task.Run(() => { Thread.Sleep(2000); App.Current.Dispatcher.Invoke(() => { SetAwait(false); }); }); break; case 5: PUMessageBox.ShowDialog("Hello World"); break; case 6: PUMessageBox.ShowConfirm("Hello World"); break; case 7: PUMessageBox.ShowAwait("正在执行......", delegate { PUMessageBox.CloseAwait(delegate { PUMessageBox.ShowDialog("已取消。"); }); }); break; } }
public void DeleteSubject() { if (PUMessageBox.ShowConfirm("此操作会将所关联的题目删除,是否确定执行", "提示", Buttons.OKOrCancel, true, AnimationStyles.Gradual) != true) { return; } _quetionBankBusiness.DeleteSubject(SelectedValue); SubjectName = ""; PUMessageBox.ShowDialog("删除成功"); Init(); }
public void DeleteTestPaper() { if (TestPaper == null) { PUMessageBox.ShowDialog("请选择试卷"); return; } _examinationPaperBusiness.DeleteTestPaper(TestPaper.Id); TestPaper = new TestPaper(); Init(); }
public void AutoAddTemplateTestPaper() { if (string.IsNullOrEmpty(TestPaper.Subtitle) || string.IsNullOrEmpty(TestPaper.Title)) { PUMessageBox.ShowDialog("内容不能为空"); return; } PUMessageBox.ShowDialog(_examinationPaperBusiness.AutoAddTemplateTestPaper(TestPaper, ProgressPercent)); TestPaper = new TestPaper(); }
public void SaveExaminationQuestion() { if (_quetionBankBusiness.SaveExaminationQuestion(ExaminationQuestion)) { PUMessageBox.ShowDialog("保存成功"); ExaminationQuestion = new ExaminationQuestion(); } else { PUMessageBox.ShowDialog("保存失败"); } Init(); }
/// <summary> /// 导入数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click(object sender, RoutedEventArgs e) { string[] paths = null; var openFileDialog = new Microsoft.Win32.OpenFileDialog() { Filter = "Excel Files (*.csv)|*.csv", Multiselect = true }; var result = openFileDialog.ShowDialog(); if (result == true) { paths = openFileDialog.FileNames; } else { return; } for (int i = 0; i < paths.Length; i++) { DataTable csv = FileHelper.OpenCSV(paths[i], new string[] { "时间", "车牌", "x 坐标", "y 坐标" }, 0); if (csv == null) { return; } //DataHelper.CreateXClass("BikePoint", GeomType.Pnt, "Templates", new string[] { "FieldID", "BikeID", "time" }); bool done = DataHelper.ImportSFCLSData(csv, "BikePnts"); csv.Dispose(); csv = null; if (done) { PUMessageBox.ShowDialog("导入文件 " + paths[i] + " 完成", "我好了"); } else { if (PUMessageBox.ShowConfirm("导入文件 " + paths[i] + " 失败,要继续吗?") == true) { continue; } else { return; } } } WuhanMapControl.Dock = DockStyle.Fill; WuhanMapControl.BackColor = System.Drawing.Color.White; //ShowMaps(); }
public void AddExaminationQuesionPaperTypes() { if (PaperquestionTypeSelectValue == 0) { PUMessageBox.ShowDialog("请选择大题"); return; } _examinationPaperBusiness.AddExaminationQuesionPaperTypes(new ExaminationQuestionPaperType() { ExaminationQuestionId = SelectedItem.ExaminationQuestionId, PaperQuestionTypeId = PaperquestionTypeSelectValue }); UpdateQuestionTableList(); }
public void DeleteExaminationQuestion() { if (_quetionBankBusiness.DeleteExaminationQuestion(ExaminationQuestion.Id)) { PUMessageBox.ShowDialog("保存成功"); ExaminationQuestion = new ExaminationQuestion(); } else { PUMessageBox.ShowDialog("保存失败"); } ExaminationQuestion = new ExaminationQuestion(); Init(); }
public void AddTestPaper() { if (_examinationPaperBusiness.AddTestPaper(TestPaper) != 1) { PUMessageBox.ShowDialog("添加成功"); TestPaper = new TestPaper(); QuestionTableList = new BindableCollection <ExaminationQuestionModel>(); } else { PUMessageBox.ShowDialog("添加失败"); } ; }
public void DeleteUser() { int userId = Convert.ToInt32(SelectedValue); if (_userBusiness.DeleteUser(userId)) { PUMessageBox.ShowDialog("删除成功"); User = new User(); } else { PUMessageBox.ShowDialog("删除失败"); } Init(); }
/// <summary> /// 复制目录文件的核心方法 /// </summary> /// <param name="sourcePath">源路径</param> /// <param name="targetPath">目标路径</param> /// <param name="overWrite">是否重写</param> /// <returns></returns> private bool CopyDirectoty(string sourcePath, string targetPath, bool overWrite) { bool result; try { sourcePath = sourcePath.EndsWith(@"\") ? sourcePath : sourcePath + @"\"; targetPath = targetPath.EndsWith(@"\") ? targetPath : targetPath + @"\"; if (!Directory.Exists(targetPath)) { Directory.CreateDirectory(targetPath); } var orginalDirectories = Directory.GetDirectories(sourcePath); foreach (var directory in orginalDirectories) { var driInfo = new DirectoryInfo(directory); if (!CopyDirectoty(directory, targetPath + driInfo.Name, overWrite)) { return(false); } } var originalFiles = Directory.GetFiles(sourcePath); //ProgressBar.IsPercentShow = true; //ProgressBar. ProgressBar.Maximum = originalFiles.Length; ShowProgressBar(true); UpdateProgressBarDelegate updateProgressBaDelegate = ProgressBar.SetValue; var count = 0.0; foreach (var file in originalFiles) { var flinfo = new FileInfo(file); flinfo.CopyTo(targetPath + flinfo.Name, overWrite); count++; Dispatcher.Invoke(updateProgressBaDelegate, DispatcherPriority.Background, RangeBase.ValueProperty, count); LbPercent.Content = $"{Math.Round(count * 100 / originalFiles.Length, 2)}%"; } ShowProgressBar(false); result = true; } catch (Exception e) { PUMessageBox.ShowConfirm(e.Message, buttons: Buttons.OK, animateStyle: AnimationStyles.Fade); ShowProgressBar(false); result = false; } return(result); }