private void MAINTREE_UI_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { //MAINTREE_UI.SelectedItem if (e.NewValue is TaskClass) { inner_ImageItemsUpdateUI(SetImageListViewUpdate(e.NewValue)); } else if (!(e.NewValue is TaskClass)) { IMG_LSTVIEW_UI.ILV_Clearitem(); EmptyCanvas(); } }
//이벤트 드랍 이벤트 private void OnImageListViewDropEvent(object sender, RoutedEventArgs e) { int index = -1; ImageListView imgListView = (ImageListView)e.Source; List <ImageItem> items = new List <ImageItem>(); try { IMG_LSTVIEW_UI.Focusable = true; IMG_LSTVIEW_UI.Focus(); index = IMG_LSTVIEW_UI.SelectedIndex;//하는게 뭐야? object obj = MAINTREE_UI.SelectedItem; if (obj == null) { MessageBox.Show("Task를 선택하세요"); return; } if (obj.GetType().ToString() == "DeepObjectDector.sub.doc.TaskClass") { inner_CopyImagePathToTaskClass(imgListView.p_DropFiles, obj as TaskClass); //List Update items = SetImageListViewUpdate(obj); inner_ImageItemsUpdateUI(items); //UI 내부에 뭔가 더럽게 있다면 청소 //if (IMG_LSTVIEW_UI.ILV_GetImgItems().Count != 0) //{ // IMG_LSTVIEW_UI.ILV_Clearitem(); //} //foreach (ImageItem item in items) //{ // IMG_LSTVIEW_UI.ILV_insertitem(item); //} } else { MessageBox.Show("Task를 선택해주세요"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void OK_button_Click(object sender, RoutedEventArgs e) { if (IMG_LSTVIEW_UI.SelectedItems == null) { return; } System.Collections.IList list = IMG_LSTVIEW_UI.SelectedItems as System.Collections.IList; if (list.Count != 1) { return; } ImageItem item = (ImageItem)list[0]; string imageFile = item.p_Image_uri; string sets = ""; foreach (StackPanel stack in SetItems_stackPanel.Children) { var txt = stack.Children[0] as TextBlock; sets += "_" + txt.Text; } sets += "_OK"; string dir = Path.GetDirectoryName(imageFile) + "\\OK\\"; Directory.CreateDirectory(dir); string newFileName = dir + Path.GetFileNameWithoutExtension(imageFile) + sets + Path.GetExtension(imageFile); File.Copy(imageFile, newFileName, true); int nextIndex = IMG_LSTVIEW_UI.SelectedIndex + 1; if (IMG_LSTVIEW_UI.ILV_GetImgItems().Count == nextIndex) { MessageBox.Show("마지막 이미지입니다!"); return; } IMG_LSTVIEW_UI.SelectedIndex = nextIndex; if (KeepSets_checkBox.IsChecked == false) { DeleteAllItem(); } }
private void LoadWorkspace() { WorkSpaceClass temp = new WorkSpaceClass(); OpenFileDialog dialog = new OpenFileDialog { InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop), DefaultExt = ".xml", Filter = "xml Files (*.xml)|*.xml" }; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { CreateNewSolution(); StreamReader sr = new StreamReader(dialog.FileName); XmlSerializer x = new XmlSerializer(m_WorkspaceDoc.GetType()); temp = x.Deserialize(sr) as WorkSpaceClass; if (temp == null) { return; } m_WorkspaceDoc = temp; MAINTREE_UI.ItemsSource = null; MAINTREE_UI.ItemsSource = m_WorkspaceDoc.p_Solutions; //LostFocuse때 SaveDoc을 하기위함. IMG_LSTVIEW_UI.Focusable = true; IMG_LSTVIEW_UI.Focus(); inner_BottomSelTreeView(); IMG_LSTVIEW_UI.SelectedIndex = 0; MessageBox.Show("Load Complete"); } }
private void ImageItemsUpdateUI(List <string> files) { if (IMG_LSTVIEW_UI.ILV_GetImgItems().Count != 0) { IMG_LSTVIEW_UI.ILV_Clearitem(); } List <ImageItem> list = new List <ImageItem>(); foreach (string file in files) { list.Add(new ImageItem() { p_Image_uri = file, p_FileName = Path.GetFileName(file) }); } foreach (ImageItem file in list) { IMG_LSTVIEW_UI.ILV_insertitem(file); } }
private void OnImageListViewDropEvent(object sender, RoutedEventArgs e) { ImageListView imgListView = (ImageListView)e.Source; List <string> items = new List <string>(); try { IMG_LSTVIEW_UI.Focusable = true; IMG_LSTVIEW_UI.Focus(); CopyImagePathToTaskClass(imgListView.p_DropFiles); //List Update items = SetImageListViewUpdate(); ImageItemsUpdateUI(items); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void inner_ImageItemsUpdateUI(List <ImageItem> items) { try { if (IMG_LSTVIEW_UI.ILV_GetImgItems().Count != 0) { IMG_LSTVIEW_UI.ILV_Clearitem(); } foreach (ImageItem item in items) { IMG_LSTVIEW_UI.ILV_insertitem(item); } return; } catch (Exception err) { return; } finally { } }