private bool DownLoadVideo(string guid) { GuaranteeProcess gp = PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.ActivitySummarize.I_CO_IA_ActivitySummarize, CO_IA.Data.GuaranteeProcess>( channel => { return(channel.GetGuaranteeVideo(guid)); }); if (gp != null) { try { System.IO.FileInfo info = new System.IO.FileInfo(gp.NAME); string path = System.Windows.Forms.Application.StartupPath + "\\tempVideo\\" + gp.NAME; //System.IO.Directory.CreateDirectory(info.Directory.FullName + "\\tempVideo\\"); File.WriteAllBytes(path, gp.VIDEO); return(true); } catch { return(false); } } else { return(false); } }
private void Button_Click(object sender, RoutedEventArgs e) { if (TaskStuffItemsSource == null) { MessageBox.Show("请选择需要导入的任务图片", "消息提示", MessageBoxButton.OK); return; } int checkcount = TaskStuffItemsSource.Count(r => r.IsChecked == true); if (checkcount == 0) { MessageBox.Show("请选择需要导入的任务图片", "消息提示", MessageBoxButton.OK); return; } List <GuaranteeProcess> listGp = new List <GuaranteeProcess>(); for (int i = 0; i < TaskStuffItemsSource.Count(); i++) { if (TaskStuffItemsSource[i].IsChecked) { GuaranteeProcess tempGp = new GuaranteeProcess(); //tempGp.GUID = Utility.NewGuid(); var taskStuff = PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.MonitorTask.I_CO_IA_MonitorTask, CO_IA.Data.TaskStuff>(channel => { return(channel.GetTaskStuffContent(TaskStuffItemsSource[i].Key)); }); tempGp.GUID = TaskStuffItemsSource[i].Key; tempGp.PHOTO = taskStuff.Content; tempGp.NAME = TaskStuffItemsSource[i].Name; tempGp.ACTIVITY_GUID = gp.ACTIVITY_GUID; tempGp.TYPE = gp.TYPE; listGp.Add(tempGp); } } PT_BS_Service.Client.Framework.BeOperationInvoker.Invoke <I_CO_IA.ActivitySummarize.I_CO_IA_ActivitySummarize>( channel => { channel.SaveGuaranteeProcessList(listGp); MessageBox.Show("导入成功", "提示", MessageBoxButton.OK); if (RefreshListEvent != null) { RefreshListEvent(); } this.Close(); }); }
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 MonitorEquipInput(GuaranteeProcess _gp) { InitializeComponent(); this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; this.gp = _gp; this.DataContext = this.gp; if (gp.PHOTO != null) { MemoryStream stream = new MemoryStream(gp.PHOTO); BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); //初始化 bmp.StreamSource = stream; //设置源 bmp.EndInit(); //初始化结束 imagePhone.Source = bmp; //设置图像Source } }
public ImportTask(GuaranteeProcess _gp) { InitializeComponent(); gp = _gp; InitPlaceList(); }
//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; } } }