private void threadSearch_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { this.Cursor = null; btnSearch.IsEnabled = true; if (e.Error != null) { MessageBox.Show(e.Error.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } ProductionMemoModel productionMemo = e.Result as ProductionMemoModel; if (productionMemo != null) { lblMemoId.Text = productionMemo.MemoId; SectionModel section = sectionList.Where(s => s.SectionId == productionMemo.SectionId).FirstOrDefault(); if (section != null) { cboSection.SelectedItem = section; } string[] productNumberArray = productionMemo.ProductionNumbers.Split(';'); foreach (string productNumber in productNumberArray) { if (string.IsNullOrEmpty(productNumber) == false) { productionNumbers.Add(new ProductionNumberModel() { Value = productNumber }); } } if (productionMemo.Picture != null) { imgPicture.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture); } if (productionMemo.Picture1 != null) { imgPicture1.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture1); } if (productionMemo.Picture2 != null) { imgPicture2.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture2); } if (productionMemo.Picture3 != null) { imgPicture3.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture3); } if (productionMemo.Picture4 != null) { imgPicture4.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture4); } } else { MessageBox.Show("Not Found!", "Search", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void dgProductionMemo_MouseDoubleClick(object sender, MouseButtonEventArgs e) { ProductionMemoModel productionMemoView = dgProductionMemo.CurrentItem as ProductionMemoModel; if (productionMemoView == null) { return; } lblMemoId.Text = null; cboSection.SelectedItem = null; productionNumbers.Clear(); imgPicture.Source = null; imgPicture1.Source = null; imgPicture2.Source = null; imgPicture3.Source = null; imgPicture4.Source = null; ProductionMemoModel productionMemo = productionMemoList.Where(p => p.MemoId == productionMemoView.MemoId).FirstOrDefault(); if (productionMemo != null) { lblMemoId.Text = productionMemo.MemoId; SectionModel section = sectionList.Where(s => s.SectionId == productionMemo.SectionId).FirstOrDefault(); if (section != null) { cboSection.SelectedItem = section; } string[] productNumberArray = productionMemo.ProductionNumbers.Split(';'); foreach (string productNumber in productNumberArray) { if (string.IsNullOrEmpty(productNumber) == false) { productionNumbers.Add(new ProductionNumberModel() { Value = productNumber }); } } if (productionMemo.Picture != null) { imgPicture.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture); } if (productionMemo.Picture1 != null) { imgPicture1.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture1); } if (productionMemo.Picture2 != null) { imgPicture2.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture2); } if (productionMemo.Picture3 != null) { imgPicture3.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture3); } if (productionMemo.Picture4 != null) { imgPicture4.Source = ConvertJPGHelper.GetBitmapImageFromJPG(productionMemo.Picture4); } } else { MessageBox.Show("Not Found!", "Search", MessageBoxButton.OK, MessageBoxImage.Error); } }