private void ExecuteTypeChangedCmd() { ///修改 ///将该异常的STATE修改为2000 AbnormalService.GetService().ChangeState(SelectedAVM.AbnormalId, 3000); //修改数据库 int type = Convert.ToInt32(CombboxItem.Key); int result = AbnormalService.GetService().UpdateAbnormalType(SelectedAVM.AbnormalId, type); //更改右下角显示 if (result == 1) { ChangeNum++; SelectedAVM.Abnormal.Type = type; //重新计算现有的总异常 ErrorNum = 0; foreach (var item in abnormalVMs) { if (item.Abnormal.Type != 0 && item.Abnormal.Type != 6) { ErrorNum++; } } } }
private void ExecuteExportListCmd(object obj) { DataGrid d = (DataGrid)obj; List <ExportMeta> l = new List <ExportMeta>(); if (d.SelectedItems == null || d.SelectedItems.Count == 0) { MessageBox.Show("您还未选择导出任务"); return; } foreach (var item in d.SelectedItems) { l.Add(item as ExportMeta); } foreach (var item in l) { Debug.WriteLine("选择任务:{0},任务编号:{1}", item.TaskCode, item.VideoId); } Debug.WriteLine("输出位置:{0}", TargetSource); //send Message //按钮禁止点击 //显示进度条 Messenger.Default.Send("exportIsRunning", "EVM2EV"); //load metadata abnormaldata abnormaltype from database exportDatas = ExportService.GetService().GetExportListData(l); typeDict = AbnormalService.GetService().GetAbnormalTypeModelsToDict(); worker.RunWorkerAsync(); }
/// <summary> /// 删除选择项 /// </summary> /// <param name="p"></param> private void ExecuteDeleteCmd(int p) { CheckWorkerState(); Debug.WriteLine("get abnornal id :" + p); Messenger.Default.Send("disEnableDeleteBtn", "BTVM2BTV"); bool isAbnormal = true; //修改列表显示 for (int i = 0; i < AbnormalVMs.Count; i++) { if (AbnormalVMs[i].AbnormalId == p) { Debug.WriteLine("get item in AbnormalVMs :" + p); if (AbnormalVMs[i].Abnormal.Type == 0 || AbnormalVMs[i].Abnormal.Type == 6) { isAbnormal = false; } DispatcherHelper.CheckBeginInvokeOnUI(() => { AbnormalVMs.RemoveAt(i); }); } } //修改右下角展示区显示 //重新计算现有的总异常 if (isAbnormal) { ErrorNum--; } //总数由abnormalVMs.Count直接生成切无需更改 //删除数据库 AbnormalService.GetService().DeleteItem(p); }
private void ExecuteTypeChangedCmd() { //修改数据库 int type = Convert.ToInt32(CombboxItem.Key); int result = AbnormalService.GetService().UpdateAbnormalType(SelectedAVM.AbnormalId, type); log.Info("修改异常类型" + "\nID:\t" + SelectedAVM.AbnormalId + "\n修改后类型:\t" + type); //更改右下角显示 if (result == 1) { ChangeNum++; SelectedAVM.Abnormal.Type = type; //重新计算现有的总异常 ErrorNum = 0; foreach (var item in abnormalVMs) { if (item.Abnormal.Type != 0 && item.Abnormal.Type != 6) { ErrorNum++; } } } }
public SetViewModel() { AssignCommands(); string frameTimeString = ConfigurationManager.AppSettings["FrameTime"]; SelFrameTime = Convert.ToInt32(frameTimeString); AbnormalTypes = AbnormalService.GetService().GetAbnormalTypeModels(); }
/// <summary> /// 初始化下拉列表 /// </summary> private void InitCombobox() { CombboxList = new List <ComplexInfoModel>(); IEnumerable <AbnormalTypeModel> dynamics = AbnormalService.GetService().GetAbnormalTypeModels(); foreach (var item in dynamics) { CombboxList.Add(new ComplexInfoModel() { Key = Convert.ToString(item.Type), Text = item.Name }); } }
private void ExecuteLoadedCmd() { //初始化元数据+异常信息的组合 AbnormalVMs = AbnormalService.GetService().SelectAll(VideoIds); ErrorNum = 0; foreach (var item in AbnormalVMs) { if (item.Abnormal.Type != 0 && item.Abnormal.Type != 6) { ErrorNum++; } } }
void SelectAllWithoutWatch() { ///修改 ///为了考虑以后可能传递多个taskId ///将它存入List<int>中,方便修改 AbnormalVMs = AbnormalService.GetService().SelectAllWithoutWatch(TaskIds); ErrorNum = 0; foreach (var item in AbnormalVMs) { if (item.Abnormal.Type != 0 && item.Abnormal.Type != 6) { ErrorNum++; } } }
private void ExecuteLoadedCmd() { //写注册表 bool isSdSuccess = RegeditHelper.SetRegedit("Sd", "MjAxOS0wOC0zMQ=="); bool isStSuccess = RegeditHelper.SetRegedit("St", "bm9ybWFs"); if (!isSdSuccess || !isStSuccess) { MessageBox.Show("权限不足,请使用管理员权限运行程序"); return; } string dbName = "data.sqlite"; if (!File.Exists(dbName)) { Console.WriteLine("数据库不存在"); int result = InitService.GetService().InitDatabase(dbName); if (result < 0) { Console.WriteLine("创建出错"); } else { Console.WriteLine("创建成功:{0}", result); } } //判断最后一次任务是否有未查看的异常项目 int lastTaskId = TaskService.GetService().GetLastTaskId(); if (lastTaskId >= 0) { //判断本次任务是否有未查看的任务 int videoNotWatched = AbnormalService.GetService().SearchLastTaskById(lastTaskId); if (videoNotWatched > 0) { //存在未观看项目 //通过消息机制弹出提示 Messenger.Default.Send(videoNotWatched, "videoNotWatched"); } } }
private void ExecuteExportCmd() { //保存对输出选项的更改到数据库 ExportService.GetService().UpdateExport(Exports); //输出逻辑 //获得所有要选择的项-别名 dict = new Dictionary <string, string>(); dict = ExportService.GetService().SelectChoose(); exportModelsForExcel = new List <ExportModel>(); exportModelsForExcel = ExportService.GetService().SelectChooseToList(); //读取所有属性 list = AbnormalService.GetService().ExportByVideoId(Convert.ToInt32(combboxItem.Key)); DispatcherHelper.CheckBeginInvokeOnUI(() => { ProVisiable = Visibility.Visible; }); worker.RunWorkerAsync(); }
private void ExecuteSelectCommand(AbnormalViewModel p) { Debug.WriteLine("worker.isBusy:" + worker.IsBusy); if (worker.IsBusy) { return; } //将该异常的STATE修改为2000 AbnormalService.GetService().ChangeState(p.AbnormalId, 2000); Messenger.Default.Send("enableDeleteBtn", "BTVM2BTV"); //更新左下角显示区域 SelectedAVM = p; CombboxItem = CombboxList[p.Abnormal.Type]; //播放视频 //找到文件 InitPlayer(p); worker.RunWorkerAsync(Player); }
private void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { processId = -1; pipeReader.Close(); DetectProgVb = Visibility.Hidden; LogText += "\r\n检测完成"; if (e.Cancelled || e.Error != null) { MessageBox.Show(errorMsg); } else { //批量存入 if (abnormalModels != null && abnormalModels.Count > 0) { AbnormalService.GetService().AddAbnormal(abnormalModels); } //清空 abnormalModels.Clear(); canBackTrackOrExport = true; } }
public void ExecuteAddCmd(int p) { CheckWorkerState(); Debug.WriteLine("get abnornal id :" + p); //修改数据库 int newId = AbnormalService.GetService().AddItem(p); bool isAbnormal = true; //修改列表显示 for (int i = 0; i < AbnormalVMs.Count; i++) { if (AbnormalVMs[i].AbnormalId == p) { Debug.WriteLine("get item in AbnormalVMs :" + p); if (AbnormalVMs[i].Abnormal.Type == 0 || AbnormalVMs[i].Abnormal.Type == 6) { isAbnormal = false; } AbnormalViewModel abnormalViewModel = AbnormalVMs[i]; MetaModel mm = new MetaModel(); AbnormalModel am = new AbnormalModel(); AbnormalViewModel avm = new AbnormalViewModel(); mm.Addr = abnormalViewModel.Meta.Addr; mm.PipeCode = abnormalViewModel.Meta.PipeCode; mm.PipeType = (int)abnormalViewModel.Meta.PipeType; mm.FramePath = abnormalViewModel.Meta.FramePath; if (!string.IsNullOrEmpty(abnormalViewModel.Meta.StartTime)) { mm.StartTime = abnormalViewModel.Meta.StartTime; } else { mm.StartTime = "未填写"; } am.VideoId = (int)abnormalViewModel.Abnormal.VideoId; am.Type = (int)abnormalViewModel.Abnormal.Type; am.Position = abnormalViewModel.Abnormal.Position; //新加的状态和任务编号 am.State = 1000; am.TaskId = (int)abnormalViewModel.Abnormal.TaskId; avm.AbnormalId = newId; avm.Meta = mm; avm.Abnormal = am; DispatcherHelper.CheckBeginInvokeOnUI(() => { AbnormalVMs.Insert(i, avm); }); break; } } //修改右下角展示区显示 //重新计算现有的总异常 if (isAbnormal) { ErrorNum++; } }