public void PreviewClickControl(string controlType, string controlName) { string childString; string temp2 = "test"; foreach (UIElementInfo temp in ucaVM.UI_Element_List) { if (temp.UIELEMENT_ID.Equals(controlName)) { if (controlName == "MyCanvas") { temp2 = "MyCanvas"; } if (temp2.Equals(controlName)) { temp3 = MyCanvas; } else { foreach (UIElement child in MyCanvas.Children) { childString = child.ToString(); if (childString.Contains("RadioButton")) { temp2 = (child as RadioButton).Name; } else if (childString.Contains("TextBox")) { temp2 = (child as TextBox).Name; } else if (childString.Contains("PasswordBox")) { temp2 = (child as PasswordBox).Name; } else if (childString.Contains("ListBox")) { temp2 = (child as ListBox).Name; } else if (childString.Contains("ComboBox")) { temp2 = (child as ComboBox).Name; } else if (childString.Contains("Menu")) { temp2 = (child as Menu).Name; } else if (childString.Contains("Button")) { temp2 = (child as Button).Name; } else if (childString.Contains("Slider")) { temp2 = (child as Slider).Name; } if (temp2.Equals(controlName)) { temp3 = child; } } } } } if (selectedElement != null) { aLayer = AdornerLayer.GetAdornerLayer(selectedElement); bLayer = AdornerLayer.GetAdornerLayer(selectedElement); aLayer.Remove(preResizeAorner); bLayer.Remove(_rotateAdorner); } selectedElement = temp3; aLayer = AdornerLayer.GetAdornerLayer(selectedElement); preResizeAorner = new ResizingAdorner(selectedElement, this); aLayer.Add(preResizeAorner); bLayer = AdornerLayer.GetAdornerLayer(selectedElement); _rotateAdorner = new RotateAdorner(selectedElement, this); bLayer.Add(_rotateAdorner); string tempString = temp3.ToString(); ctrVM.LeftButtonMakeTempListItem(temp3, tempString); }
public void _PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { string _typeName = null; if (agoSelectedElement != null) { _draggedElementToString = agoSelectedElement.ToString(); _typeName = ctrVM.UIelementCheckTypeName(agoSelectedElement, _draggedElementToString); string xmlTag = ctrVM.fileTabV.scriptV.getBlocks(); ctrVM.hiddenfileSave(_typeName, xmlTag); string jsCode = ctrVM.fileTabV.scriptV.getJSCode(); ctrVM.JSFileSave(jsCode); ctrVM._ucaVM.DomtreeVM.importScriptSrc_To_HTMLDocument(ctrVM.current_Scene + "_" + ctrVM.current_typeName + ".js"); } _draggedElementToString = (e.Source as UIElement).ToString(); _tabControls.TabContols.SelectedIndex = 0; if (e.Source == MyCanvas || _draggedElementToString == "System.Windows.Controls.Grid") { if (selectedElement != null) { aLayer = AdornerLayer.GetAdornerLayer(selectedElement); bLayer = AdornerLayer.GetAdornerLayer(selectedElement); if (aLayer != null && bLayer != null) { aLayer.Remove(preResizeAorner); bLayer.Remove(_rotateAdorner); } } _draggedElementToString = MyCanvas.ToString(); selectedElement = MyCanvas; object canvasObject = MyCanvas; aLayer = AdornerLayer.GetAdornerLayer(selectedElement); preResizeAorner = new ResizingAdorner(selectedElement, this); aLayer.Add(preResizeAorner); bLayer = AdornerLayer.GetAdornerLayer(selectedElement); _rotateAdorner = new RotateAdorner(selectedElement, this); bLayer.Add(_rotateAdorner); //여기오류 ctrVM._ucaVM.currentUIInfo = ctrVM._ucaVM.UI_Element_List[0]; ctrVM._ucaVM.preview.clickedControl("MyCanvas"); ctrVM.LeftButtonMakeTempListItem(canvasObject, _draggedElementToString); string pathJS = Environment.GetEnvironmentVariable("USERPROFILE") + "\\MisengWorkSpace\\" + ctrVM.current_projectName + "\\Tizen\\" + ctrVM.current_projectName + "\\js\\" + ctrVM.current_Scene + "_" + ctrVM.current_typeName + ".js"; ctrVM.SrcCodeVM.GetSrcOfPathJS(pathJS); ctrVM.CURRENT_JS = ctrVM.current_Scene + "_" + ctrVM.current_typeName + ".js"; } else { _isPreMouseDown = true; _dragStartPoint = e.GetPosition(MyCanvas); _draggedElement = e.Source as UIElement; MyCanvas.CaptureMouse(); e.Handled = true; if (selectedElement != null) { aLayer = AdornerLayer.GetAdornerLayer(selectedElement); bLayer = AdornerLayer.GetAdornerLayer(selectedElement); aLayer.Remove(preResizeAorner); bLayer.Remove(_rotateAdorner); } ctrVM._ucaVM.currentUIInfo = search_UIinfo(e.Source.ToString().Split(new char[] { ':', ' ' }).Last()); selectedElement = e.Source as UIElement; aLayer = AdornerLayer.GetAdornerLayer(selectedElement); preResizeAorner = new ResizingAdorner(selectedElement, this); aLayer.Add(preResizeAorner); bLayer = AdornerLayer.GetAdornerLayer(selectedElement); _rotateAdorner = new RotateAdorner(selectedElement, this); bLayer.Add(_rotateAdorner); //ctrVM._ucaVM.preview 자꾸 널.. 버튼 눌렀다가 캔버스 눌렀다가 버튼누르면 널 .. 널죽이겠다.. ctrVM._ucaVM.preview.clickedControl(e.Source); ctrVM.LeftButtonMakeTempListItem(e.Source, _draggedElementToString); string pathJS = Environment.GetEnvironmentVariable("USERPROFILE") + "\\MisengWorkSpace\\" + ctrVM.current_projectName + "\\Tizen\\" + ctrVM.current_projectName + "\\js\\" + ctrVM.current_Scene + "_" + ctrVM.current_typeName + ".js"; ctrVM.SrcCodeVM.GetSrcOfPathJS(pathJS); ctrVM.CURRENT_JS = ctrVM.current_Scene + "_" + ctrVM.current_typeName + ".js"; } agoSelectedElement = selectedElement; }