private void TranslateData() { gpvList = new List <GuaranteeProcessView>(); foreach (GuaranteeProcess gp in gpList) { GuaranteeProcessView gpv = new GuaranteeProcessView(); gpv.GUID = gp.GUID; gpv.NAME = gp.NAME; gpv.TASK = gp.TASK; gpv.ACTIVITY_GUID = gp.ACTIVITY_GUID; gpv.PHOTO = gp.PHOTO; gpv.TYPE = gp.TYPE; if (this.isModify) { gpv.IsVisible = Visibility.Visible; } else { gpv.IsVisible = Visibility.Hidden; } if (gp.PHOTO != null) { MemoryStream stream = new MemoryStream(gp.PHOTO); BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); //初始化 bmp.StreamSource = stream; //设置源 bmp.EndInit(); //初始化结束 gpv.ImageSource = bmp; //设置图像Source } gpvList.Add(gpv); } if (this.isModify) { GuaranteeProcessView gpvAdd = new GuaranteeProcessView(); gpvAdd.GUID = "add"; gpvAdd.NAME = "添加"; gpvAdd.TASK = "添加保障过程"; gpvAdd.ACTIVITY_GUID = ""; gpvAdd.IsVisible = Visibility.Hidden; BitmapImage bmpAdd = new BitmapImage(new Uri("../Images/add.png", UriKind.Relative)); gpvAdd.ImageSource = bmpAdd;//设置图像Source gpvList.Add(gpvAdd); GuaranteeProcessView gpvImport = new GuaranteeProcessView(); gpvImport.GUID = "import"; gpvImport.NAME = "导入"; gpvImport.TASK = "导入保障过程"; gpvImport.ACTIVITY_GUID = ""; gpvImport.IsVisible = Visibility.Hidden; BitmapImage bmpImport = new BitmapImage(new Uri("../Images/Import.png", UriKind.Relative)); gpvImport.ImageSource = bmpImport;//设置图像Source gpvList.Add(gpvImport); } }
private void btn_DelClick(object sender, RoutedEventArgs e) { flg = false; Image btn = sender as Image; GuaranteeProcessView gpv = btn.DataContext as GuaranteeProcessView; PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.ActivitySummarize.I_CO_IA_ActivitySummarize>( channel => { channel.DeleteGuaranteeProcess(gpv.GUID); MessageBox.Show("删除成功", "提示", MessageBoxButton.OK); getGuaranteeProcessList(type); }); }
private void btn_ModifyClick(object sender, RoutedEventArgs e) { flg = false; Image btn = sender as Image; GuaranteeProcessView gpv = btn.DataContext as GuaranteeProcessView; GuaranteeProcess gp = new GuaranteeProcess(); gp.GUID = gpv.GUID; gp.ACTIVITY_GUID = gpv.ACTIVITY_GUID; gp.NAME = gpv.NAME; gp.TASK = gpv.TASK; gp.PHOTO = gpv.PHOTO; gp.TYPE = gpv.TYPE; MonitorEquipInput dlg = new MonitorEquipInput(gp); dlg.RefreshListEvent += () => { getGuaranteeProcessList(type); }; dlg.ShowDialog(this); }
//public MonitorEquip(int p) //{ // InitializeComponent(); // GuaranteeProcess gp = new GuaranteeProcess(); // gp.NAME = "111"; // gp.TASK = "222"; // gpList.Add(gp); // GuaranteeProcess gp1 = new GuaranteeProcess(); // gp1.NAME = "333"; // gp1.TASK = "444"; // gpList.Add(gp1); // this.flc_ImgList.ItemsSource = gpList; //} // public MonitorEquip(int mode) //{ // InitializeComponent(); // tb_Modify.Visibility = System.Windows.Visibility.Visible; //} private void GroupBox_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (!flg) { flg = true; return; } var groupBox = (DevExpress.Xpf.LayoutControl.GroupBox)sender; GuaranteeProcessView gpv = groupBox.DataContext as GuaranteeProcessView; if (gpv.GUID == "add") { GuaranteeProcess gp = new GuaranteeProcess(); gp.GUID = Utility.NewGuid(); gp.ACTIVITY_GUID = this.activityGuid; gp.TYPE = type; MonitorEquipInput dlg = new MonitorEquipInput(gp); dlg.RefreshListEvent += () => { getGuaranteeProcessList(type); }; dlg.ShowDialog(this); } else if (gpv.GUID == "import") { GuaranteeProcess gp = new GuaranteeProcess(); gp.ACTIVITY_GUID = this.activityGuid; gp.TYPE = type; ImportTask it = new ImportTask(gp); it.RefreshListEvent += () => { getGuaranteeProcessList(type); }; it.ShowDialog(this); } else { if (IsVoide(gpv.NAME)) { string path = System.Windows.Forms.Application.StartupPath + "\\tempVideo\\"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string filePath = path + gpv.NAME; if (File.Exists(filePath)) { if (MessageBox.Show("当前视频文件已存在,是否重新下载?", "消息提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { if (DownLoadVideo(gpv.GUID)) { Video video = new Video(filePath); video.ShowDialog(); } else { MessageBox.Show("视频下载失败", "消息提示"); } } else { Video video = new Video(filePath); video.ShowDialog(); } } else { if (DownLoadVideo(gpv.GUID)) { Video video = new Video(filePath); video.ShowDialog(); } else { MessageBox.Show("视频下载失败", "消息提示"); } } } else { groupBox.State = groupBox.State == GroupBoxState.Normal ? GroupBoxState.Maximized : GroupBoxState.Normal; } } }