public void BtnCut()
 {
     if (_cuter.GetCutedImage() == null)
     {
         PUMessageBox.ShowDialog("没有图片源。");
         return;
     }
     _image.Source = _cuter.GetCutedImage();
 }
 public void BtnCut()
 {
     if (_cuter.CutImageSource == null)
     {
         PUMessageBox.ShowDialog("没有图片源。");
         return;
     }
     _image.Source = _cuter.CutImageSource;
 }
 public void Detail(string category)
 {
     switch (category)
     {
     case "Button":
         PUMessageBox.ShowDialog("123");
         break;
     }
 }
Exemple #4
0
 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("添加失败");
     }
 }
Exemple #5
0
 public void ShowCancelableAwait()
 {
     PUMessageBox.ShowAwait("正在执行......", delegate
     {
         PUMessageBox.CloseAwait(delegate
         {
             PUMessageBox.ShowDialog("任务已取消。");
         });
     });
 }
 public void SaveKnowledgePoint()
 {
     _quetionBankBusiness.SaveKnowledgePoint(new KnowledgePoint()
     {
         Id = SelectedValue, KnowledgePointName = KnowledgePointName
     });
     KnowledgePointName = "";
     PUMessageBox.ShowDialog("保存成功");
     Init();
 }
 public void SaveQuestionType()
 {
     _quetionBankBusiness.SaveQuestionType(new QuestionType()
     {
         Id = SelectedValue, QuestionTypeName = QuestionTypeName
     });
     QuestionTypeName = "";
     PUMessageBox.ShowDialog("保存成功");
     Init();
 }
Exemple #8
0
 public void SaveSubject()
 {
     _quetionBankBusiness.SaveSubject(new Subject()
     {
         Id = SelectedValue, SubjectName = SubjectName
     });
     SubjectName = "";
     PUMessageBox.ShowDialog("保存成功");
     Init();
 }
Exemple #9
0
        /// <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 DeleteTestPaper()
 {
     if (TestPaper == null)
     {
         PUMessageBox.ShowDialog("请选择试卷");
         return;
     }
     _examinationPaperBusiness.DeleteTestPaper(TestPaper.Id);
     TestPaper = new TestPaper();
     Init();
 }
Exemple #11
0
 public void DeleteSubject()
 {
     if (PUMessageBox.ShowConfirm("此操作会将所关联的题目删除,是否确定执行", "提示", Buttons.OKOrCancel, true, AnimationStyles.Gradual) != true)
     {
         return;
     }
     _quetionBankBusiness.DeleteSubject(SelectedValue);
     SubjectName = "";
     PUMessageBox.ShowDialog("删除成功");
     Init();
 }
Exemple #12
0
        public void AutoAddTemplateTestPaper()
        {
            if (string.IsNullOrEmpty(TestPaper.Subtitle) || string.IsNullOrEmpty(TestPaper.Title))
            {
                PUMessageBox.ShowDialog("内容不能为空");
                return;
            }

            PUMessageBox.ShowDialog(_examinationPaperBusiness.AutoAddTemplateTestPaper(TestPaper, ProgressPercent));
            TestPaper = new TestPaper();
        }
Exemple #13
0
 public void SaveExaminationQuestion()
 {
     if (_quetionBankBusiness.SaveExaminationQuestion(ExaminationQuestion))
     {
         PUMessageBox.ShowDialog("保存成功");
         ExaminationQuestion = new ExaminationQuestion();
     }
     else
     {
         PUMessageBox.ShowDialog("保存失败");
     }
     Init();
 }
Exemple #14
0
        /// <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();
        }
Exemple #15
0
 public void AddTestPaper()
 {
     if (_examinationPaperBusiness.AddTestPaper(TestPaper) != 1)
     {
         PUMessageBox.ShowDialog("添加成功");
         TestPaper         = new TestPaper();
         QuestionTableList = new BindableCollection <ExaminationQuestionModel>();
     }
     else
     {
         PUMessageBox.ShowDialog("添加失败");
     }
     ;
 }
Exemple #16
0
 public void DeleteExaminationQuestion()
 {
     if (_quetionBankBusiness.DeleteExaminationQuestion(ExaminationQuestion.Id))
     {
         PUMessageBox.ShowDialog("保存成功");
         ExaminationQuestion = new ExaminationQuestion();
     }
     else
     {
         PUMessageBox.ShowDialog("保存失败");
     }
     ExaminationQuestion = new ExaminationQuestion();
     Init();
 }
        public void AddExaminationQuesionPaperTypes()
        {
            if (PaperquestionTypeSelectValue == 0)
            {
                PUMessageBox.ShowDialog("请选择大题");
                return;
            }

            _examinationPaperBusiness.AddExaminationQuesionPaperTypes(new ExaminationQuestionPaperType()
            {
                ExaminationQuestionId = SelectedItem.ExaminationQuestionId, PaperQuestionTypeId = PaperquestionTypeSelectValue
            });
            UpdateQuestionTableList();
        }
        public void DeleteUser()
        {
            int userId = Convert.ToInt32(SelectedValue);

            if (_userBusiness.DeleteUser(userId))
            {
                PUMessageBox.ShowDialog("删除成功");
                User = new User();
            }
            else
            {
                PUMessageBox.ShowDialog("删除失败");
            }
            Init();
        }
Exemple #19
0
        public void OpenDialog(string type)
        {
            switch (type)
            {
            case "scale":
                PUMessageBox.ShowDialog("这是一个PUMessageBox对话框。");
                return;

            case "gradual":
                PUMessageBox.ShowDialog("这是一个PUMessageBox对话框。", "提示", PUMessageBox.Buttons.Sure, true, UI.PUWindow.AnimationStyles.Gradual);
                return;

            case "fade":
                PUMessageBox.ShowDialog("这是一个PUMessageBox对话框。", "提示", PUMessageBox.Buttons.Sure, true, UI.PUWindow.AnimationStyles.Fade);
                return;
            }
        }
Exemple #20
0
 public void DeleteExaminationQuesionPaperTypes()
 {
     if (PaperquestionTypeSelectValue == 0)
     {
         PUMessageBox.ShowDialog("请选择大题");
         return;
     }
     if (QuestionTableSelected == null)
     {
         return;
     }
     _examinationPaperBusiness.DeleteExaminationQuesionPaperTypes(new ExaminationQuestionPaperType()
     {
         ExaminationQuestionId = QuestionTableSelected.ExaminationQuestionId, PaperQuestionTypeId = PaperquestionTypeSelectValue
     });
     UpdateQuestionTableList();
 }
Exemple #21
0
        /// <summary>
        /// 获取一天的骑行量
        /// </summary>
        /// <returns></returns>
        public static double[] GetOneDayData(string className)
        {
            //0:00 1:00 ... 23:00
            double[] results = new double[24] {
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
            };

            //定义变量
            IVectorCls VectorCls = new SFeatureCls();
            //打开简单要素类
            bool rtn = VectorCls.Open("GDBP://MapGisLocal/Templates/sfcls/" + className);

            if (!rtn)
            {
                PUMessageBox.ShowDialog("简单要素类 " + className + " 打开失败", "失败");
                return(null);
            }

            QueryDef  def       = new QueryDef();
            RecordSet recordSet = null;

            for (int i = 0; i < 23; i++)
            {
                //设置属性查询条件
                def.Filter = "ParkTime > '" + i + ":00:00' AND ParkTime < '" + (i + 1).ToString() + ":00:00'";
                //查询要素
                recordSet = VectorCls.Select(def);
                if (recordSet != null)
                {
                    results[i] = recordSet.Count;
                }
            }

            def.Filter = "ParkTime > '23:00:00'";
            //查询要素
            recordSet = VectorCls.Select(def);
            if (recordSet != null)
            {
                results[23] = recordSet.Count;
            }

            //关闭类
            VectorCls.Close();
            return(results);
        }
 public void SaveUser()
 {
     if (User == null)
     {
         return;
     }
     User.Id = SelectedValue;
     if (_userBusiness.UpdateUser(User))
     {
         PUMessageBox.ShowDialog("保存成功");
         User = new User();
     }
     else
     {
         PUMessageBox.ShowDialog("保存失败");
     }
     Init();
 }
Exemple #23
0
        /// <summary>
        /// 获取热点数据
        /// </summary>
        /// <param name="className"></param>
        /// <returns></returns>
        public static double[] GetGeoHeatMapData(string className)
        {
            double[] results = new double[81];
            for (int i = 0; i < 81; i++)
            {
                results[i] = 0;
            }

            //定义变量
            IVectorCls VectorCls = new SFeatureCls();
            //打开简单要素类
            bool rtn = VectorCls.Open("GDBP://MapGisLocal/Templates/sfcls/" + className);

            if (!rtn)
            {
                PUMessageBox.ShowDialog("简单要素类 " + className + " 打开失败", "失败");
                return(null);
            }

            QueryDef  def       = new QueryDef();
            RecordSet recordSet = null;
            int       index     = 0;
            double    xStart    = 113.750;
            double    yStart    = 31.000;

            for (int y = 0; y < 9; y++)
            {
                for (int x = 0; x < 9; x++)
                {
                    def.Filter = "yAsis > " + (xStart + 0.125 * x).ToString() + " AND yAsis < " + (xStart + 0.125 * x + 0.125).ToString() + " AND xAsis < " + (yStart - 0.125 * y).ToString() + " AND xAsis > " + (yStart - 0.125 * y - 0.125) + "";
                    recordSet  = VectorCls.Select(def);
                    if (recordSet != null)
                    {
                        results[index++] = recordSet.Count;
                    }
                }
            }

            //关闭类
            VectorCls.Close();
            return(results);
        }
        public void LoadNavButtons()
        {
            var lbl1 = new TextBlock()
            {
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                Text       = "",
                FontFamily = FindResource("IconFont") as FontFamily,
            };
            var lbl2 = new TextBlock()
            {
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                Text       = "",
                FontFamily = FindResource("IconFont") as FontFamily,
            };

            AppendNavButton("H", new RoutedEventHandler((s, e) => { PUMessageBox.ShowDialog("你点击了第三个按钮!"); Result = 3; }));
            AppendNavButton(lbl1, new RoutedEventHandler((s, e) => { PUMessageBox.ShowDialog("你点击了第二个按钮!"); Result = 2; }));
            AppendNavButton(lbl2, new RoutedEventHandler((s, e) => { PUMessageBox.ShowDialog("你点击了第一个按钮!"); Result = 1; }));
        }
Exemple #25
0
        /// <summary>
        /// 添加分析的车牌
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PUButton_Click(object sender, RoutedEventArgs e)
        {
            if (!Regex.IsMatch(BikeIDTextBox.Text, "^[\\w]+$"))
            {
                PUMessageBox.ShowDialog("车牌格式错误,只能包含字母和数字", "错误");
                return;
            }
            List <BikeSearchViewModel> bikeSearchViewModels = ChartHelper.GetLengthNTimeData("BikePnts", BikeIDTextBox.Text);

            if (bikeSearchViewModels == null)
            {
                PUMessageBox.ShowDialog("没有找到车牌 " + BikeIDTextBox.Text + " 的记录", "无结果");
                BikeIDTextBox.Text = "";
                return;
            }
            //获得到了一辆车的信息,接下来遍历这个集合,统计使用时间和距离,然后添加到图表的横纵坐标里面
            double length = 0;
            double time   = 0;

            for (int i = 0; i < bikeSearchViewModels.Count - 1; i++)
            {
                double deltaX = bikeSearchViewModels[i + 1].XAsis - bikeSearchViewModels[i].XAsis;
                double deltaY = bikeSearchViewModels[i + 1].YAsis - bikeSearchViewModels[i].YAsis;
                if (deltaX > 0.0001 || deltaX < -0.0001 || deltaY > 0.0001 || deltaY < -0.0001)
                {
                    length += DataHelper.GetDistance(bikeSearchViewModels[i].XAsis, bikeSearchViewModels[i].YAsis, bikeSearchViewModels[i + 1].XAsis, bikeSearchViewModels[i + 1].YAsis);
                    time   += Math.Abs((bikeSearchViewModels[i + 1].Time - bikeSearchViewModels[i].Time).TotalMinutes);
                }
            }

            AnalyzListView.Items.Add(BikeIDTextBox.Text);

            lengthData.Add(length);
            timeData.Add(time);
            List <string> tmpList = RideAxis.Labels.ToList();

            tmpList.Add(BikeIDTextBox.Text);
            RideAxis.Labels    = tmpList;
            BikeIDTextBox.Text = "";
        }
Exemple #26
0
        public void AddPaperquestionType()
        {
            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
            });

            PaperquestionTypeTabItems.Add(new PUTabItemModel()
            {
                Header = PaperQuestionTitle, Value = id, CanDelete = false, Content = null
            });
        }
        public void AddQuestionType()
        {
            if (HasOption)
            {
            }
            bool bl = _quetionBankBusiness.AddQuestionType(new QuestionType()
            {
                HasOption        = HasOption,
                QuestionTypeName = QuestionTypeName,
                IsFixedScore     = false,
                Score            = 0,
            });

            if (bl)
            {
                PUMessageBox.ShowDialog("添加成功");
                QuestionTypeName = "";
            }
            else
            {
                PUMessageBox.ShowDialog("添加失败");
            }
            Init();
        }
Exemple #28
0
 public void GetValue()
 {
     PUMessageBox.ShowDialog($"该选项的Value为“{SelectedValue?.ToString()}”。\n你可以通过修改PUComboBoxItem的Value属性来控制它。");
 }
Exemple #29
0
 protected override void OnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
 {
     base.OnUnhandledException(sender, e);
     PUMessageBox.ShowDialog("异常:" + e.Exception.Message);
     e.Handled = true;
 }
Exemple #30
0
        public void UpdateActivePage()
        {
            if (ChoosedValue != "Login" && !_login_ViewModel.IsLogin)
            {
                return;
            }
            switch (ChoosedValue)
            {
            case "Login":
                ActivateItem(_login_ViewModel);
                break;

            case "LoginSucceed":
                ActivateItem(new LoginSucceedViewModel(CurrentUser));
                break;

            case "AddUser":
                if (_roleRights.FirstOrDefault(c => c.RightName.Equals("UserManager")) == null)
                {
                    PUMessageBox.ShowDialog("你没有访问权限,请联系管理员");
                    return;
                }
                ActivateItem(new AddUserViewModel(_windowManager));
                break;

            case "UserManager":
                if (_roleRights.FirstOrDefault(c => c.RightName.Equals("UserManager")) == null)
                {
                    PUMessageBox.ShowDialog("你没有访问权限,请联系管理员");
                    return;
                }
                ActivateItem(new UserManagerViewModel(_windowManager));
                break;

            case "AddQuestions":
                ActivateItem(new AddQuestionBankViewModel(_windowManager));
                break;

            case "QuestionsManager":
                if (_roleRights.FirstOrDefault(c => c.RightName.Equals("QuestionBankManager")) == null)
                {
                    return;
                }
                ActivateItem(new QuestionBankManagerViewModel(_windowManager));
                break;

            case "ExaminationPaperManager":
                if (_roleRights.FirstOrDefault(c => c.RightName.Equals("ExaminationPaperManager")) == null)
                {
                    PUMessageBox.ShowDialog("你没有访问权限,请联系管理员");
                    return;
                }
                ActivateItem(new ExaminationPaperManagerViewModel(_windowManager));
                break;

            case "KnowledgePoint":
                ActivateItem(new KnowledgePointManagerViewModel(_windowManager));
                break;

            case "QuestionTypes":
                ActivateItem(new QuestionTypeManagerViewModel(_windowManager));
                break;

            case "Subject":
                ActivateItem(new SubjectManagerViewModel(_windowManager));
                break;

            case "AddExaminationPaper":
                ActivateItem(new AddExaminationPaperViewModel(_windowManager));
                break;

            case "AutogenerationExaminationPaper":

                ActivateItem(new AutoAddExaminationPaperViewModel(_windowManager));
                break;

            case "ExportExaminationPaper":

                ActivateItem(new ExaminationPaperGenerateViewModel(_windowManager));
                break;

            case "AuthorityManagement":
                if (_roleRights.FirstOrDefault(c => c.RightName.Equals("UserManager")) == null && CurrentUser.Id != 1)
                {
                    PUMessageBox.ShowDialog("你没有访问权限,请联系管理员");
                    return;
                }
                ActivateItem(new RightManagerViewModel(_windowManager));
                break;

            case "PersonalSettings":
                ActivateItem(new UpdateUserViewModel(_windowManager, CurrentUser));
                break;

            case "Logout":
                if (PUMessageBox.ShowConfirm("是否注销", "提示", Buttons.OKOrCancel, true, AnimationStyles.Gradual) != true)
                {
                    return;
                }
                CurrentUser      = new User();
                _login_ViewModel = new Login_ViewModel(_windowManager);
                ActivateItem(_login_ViewModel);
                break;
            }
        }