Ejemplo n.º 1
0
        public static UIElementInfo DefaultElementAttribute(string[] styleArr, string id, string tooltip, string type, string text, string html_path)
        {
            UIElementInfo element = new UIElementInfo();
            double width = 0.0, height = 0.0, angle = 0.0;
            element.UIELEMENT_TYPE = type;
            element.UIELEMENT_ID = id;
            element.UIELEMENT_TOOLTIP = tooltip;
            element.UIELEMENT_TEXT = text;
            int n = styleArr.Count();

            for (int i = 0; i < n; i += 2)
            {
                switch (styleArr[i])
                {
                    case "background": element.UIELEMENT_IMAGEURL = BG_URL(styleArr[i + 1], html_path);
                        break;
                    case "opacity": element.UIELEMENT_OPACITY = Double.Parse(styleArr[i + 1]) * 255;
                        break;
                    case "font-size": element.UIELEMENT_FONTSIZE = Int32.Parse(styleArr[i + 1].Replace(" ", "").Replace("px;", ""));
                        break;
                    case "cursor": element.UIELEMENT_CURSOR = styleArr[i + 1];
                        break;
                    case "border-top-width": element.UIELEMENT_UTHICKNESS = Double.Parse(styleArr[i + 1]);
                        break;
                    case "border-bottom-width": element.UIELEMENT_DTHICKNESS = Double.Parse(styleArr[i + 1]);
                        break;
                    case "border-left-width": element.UIELEMENT_LTHICKNESS = Double.Parse(styleArr[i + 1]);
                        break;
                    case "border-right-width": element.UIELEMENT_RTHICKNESS = Double.Parse(styleArr[i + 1]);
                        break;
                    case "border-color": element.UIELEMENT_BORDERGROUND = Html2CS_Color(styleArr[i + 1]);
                        break;
                    case "visibility": element.UIELEMENT_VISIBLE = styleArr[i + 1];
                        break;
                    case "horizontal-align": element.UIELEMENT_HORIZON = styleArr[i + 1];
                        break;
                    case "vertical-align": element.UIELEMENT_VERTICAL = getVerticalAlign(styleArr[i + 1]);
                        break;
                    case "left": element.UIELEMENT_XPOSITION = getXposition(styleArr[i + 1], width, height, angle);
                        break;
                    case "top": element.UIELEMENT_YPOSITION = getYposition(styleArr[i + 1], width, height, angle);
                        break;
                    case "transform": element.UIELEMENT_ANGLE = Double.Parse(styleArr[i + 1].Replace("deg)", "").Replace("rotate(", "")); angle = Double.Parse(styleArr[i + 1].Replace("deg)", "").Replace("rotate(", ""));
                        break;
                    case "background-color": element.UIELEMENT_BACKGROUND = Html2CS_Color(styleArr[i + 1]);
                        break;
                    case "color": element.UIELEMENT_FOREGROUND = Html2CS_Color(styleArr[i + 1]);
                        break;
                    case "height": element.UIELEMENT_HEIGHT = Double.Parse(styleArr[i + 1]); height = Double.Parse(styleArr[i + 1]);
                        break;
                    case "width": element.UIELEMENT_WIDTH = Double.Parse(styleArr[i + 1]); width = Double.Parse(styleArr[i + 1]);
                        break;
                    case "z-index": element.UIELEMENT_ZINDEX = Int32.Parse(styleArr[i + 1]);
                        break;
                    default: break;
                }
            }
            return element;
        }
Ejemplo n.º 2
0
 public UICanvasViewModel()
 {
     ui_Element_List = new List<UIElementInfo>();           
     currentUIInfo = new UIElementInfo();
     items = new ObservableCollection<UIElementInfo>();
     ImageCollection = new ObservableCollection<ImageInfo>();
     //transform = new RotateTransform();
 }
Ejemplo n.º 3
0
 private static string getBorderThickness(UIElementInfo element)
 {
     string style = "";
     style += "border-top-width : " + element.UIELEMENT_UTHICKNESS + "px; ";
     style += "border-bottom-width : " + element.UIELEMENT_DTHICKNESS + "px; ";
     style += "border-left-width : " + element.UIELEMENT_LTHICKNESS + "px; ";
     style += "border-right-width : " + element.UIELEMENT_RTHICKNESS + "px; ";
     return style;
 }
Ejemplo n.º 4
0
 private void ViewLoded(object sender, RoutedEventArgs e)
 {
     if (Application.Current.MainWindow != null)
     {
         Window window = Application.Current.MainWindow;
         ctrVM = window.DataContext as ControlViewModel;
         ucaVM = ctrVM._ucaVM;
         ctrVM._ucaVM.uicanV = this;
         _tabControls = ctrVM.tabControlsV;
         ctrVM.currentCanvas = MyCanvas;
         _cutItem = new UIElement();
         _cutInfo = new UIElementInfo();
     }
 }
Ejemplo n.º 5
0
        public static string DefaultElementAttribute(UIElementInfo element)
        {
            string style = "";

            style += zeroToMarginPadding();
            style += positionFixed();
            style += getCursor(element.UIELEMENT_CURSOR);
            style += getBackground_img(element.UIELEMENT_IMAGEURL, element.UIELEMENT_HEIGHT, element.UIELEMENT_WIDTH, element.UIELEMENT_OPACITY);
            style += getBorderThickness(element);
            style += getVisibility(element.UIELEMENT_VISIBLE);
            style += getVerticalAlignment(element.UIELEMENT_VERTICAL);
            style += getHorizonAlignment(element.UIELEMENT_HORIZON);
            style += getStyleBackGroundColor(element.UIELEMENT_BACKGROUND);
            style += getStyleForeGround(element.UIELEMENT_FOREGROUND);
            style += getStyleHeight(element.UIELEMENT_HEIGHT);
            style += getStyleWidth(element.UIELEMENT_WIDTH);
            style += getStyleAngle(element.UIELEMENT_ANGLE);
            style += getStylePosition(element.UIELEMENT_XPOSITION, element.UIELEMENT_YPOSITION, element.UIELEMENT_WIDTH, element.UIELEMENT_HEIGHT, element.UIELEMENT_ANGLE);
            style += getStyleZIndex(element.UIELEMENT_ZINDEX);
            style += getStyleFontSize(element.UIELEMENT_FONTSIZE);

            return style;
        }
Ejemplo n.º 6
0
        public void MakeTempListItem(object eSource, string _draggedElementToString, double angle)
        {
            string typeName = null;
            if (_draggedElementToString.Contains("RadioButton"))
            {
                typeName = (eSource as RadioButton).Name;
            }            
            else if (_draggedElementToString.Contains("TextBox"))
            {
                typeName = (eSource as TextBox).Name;
            }
            else if (_draggedElementToString.Contains("Image"))
            {
                typeName = (eSource as Image).Name;
            }
            else if (_draggedElementToString.Contains("PasswordBox"))
            {
                typeName = (eSource as PasswordBox).Name;
            }
            else if (_draggedElementToString.Contains("Canvas"))
            {
                typeName = (eSource as Canvas).Name;
            }
            else if (_draggedElementToString.Contains("ListBoxItem"))
            {
                typeName = (eSource as ListBoxItem).Name;
            }
            else if (_draggedElementToString.Contains("ListBox"))
            {
                typeName = (eSource as ListBox).Name;
            }
            else if (_draggedElementToString.Contains("ComboBox"))
            {
                typeName = (eSource as ComboBox).Name;
            }
            else if (_draggedElementToString.Contains("Menu"))
            {
                typeName = (eSource as Menu).Name;
            }
            else if (_draggedElementToString.Contains("Button"))
            {
                typeName = (eSource as Button).Name;
            }
            else if (_draggedElementToString.Contains("Slider"))
            {
                typeName = (eSource as Slider).Name;
            }

            _uiEleInfo.UIELEMENT_ANGLE = angle;
            SelectedTypeId = typeName;
            SelectedCanvasText = _draggedElementToString;
            _uiEleInfo = SearchList(typeName);

            if (_draggedElementToString.Contains("RadioButton"))
            {
                RadioButton radiobutton = eSource as RadioButton;
                _uiEleInfo.UIELEMENT_HEIGHT = radiobutton.Height;
                _uiEleInfo.UIELEMENT_WIDTH = radiobutton.Width;
                _uiEleInfo.UIELEMENT_ANGLE = angle;
            }
            
            else if (_draggedElementToString.Contains("TextBox"))
            {
                TextBox txtBox = eSource as TextBox;
                _uiEleInfo.UIELEMENT_HEIGHT = txtBox.Height;
                _uiEleInfo.UIELEMENT_WIDTH = txtBox.Width;
                _uiEleInfo.UIELEMENT_ANGLE = angle;
            }
            else if (_draggedElementToString.Contains("Image"))
            {
                Image image = eSource as Image;
                _uiEleInfo.UIELEMENT_HEIGHT = image.Height;
                _uiEleInfo.UIELEMENT_WIDTH = image.Width;
                _uiEleInfo.UIELEMENT_ANGLE = angle;
            }
            else if (_draggedElementToString.Contains("PasswordBox"))
            {
                PasswordBox passwordBox = eSource as PasswordBox;
                _uiEleInfo.UIELEMENT_HEIGHT = passwordBox.Height;
                _uiEleInfo.UIELEMENT_WIDTH = passwordBox.Width;
                _uiEleInfo.UIELEMENT_ANGLE = angle;
            }
            else if (_draggedElementToString.Contains("Canvas"))
            {
                Canvas canvas = eSource as Canvas;
                _uiEleInfo.UIELEMENT_HEIGHT = canvas.Height;
                _uiEleInfo.UIELEMENT_WIDTH = canvas.Width;
                _uiEleInfo.UIELEMENT_ANGLE = angle;
            }
            else if (_draggedElementToString.Contains("ListBoxItem"))
            {
            }
            else if (_draggedElementToString.Contains("ListBox"))
            {
                ListBox listBox = eSource as ListBox;
                _uiEleInfo.UIELEMENT_HEIGHT = listBox.Height;
                _uiEleInfo.UIELEMENT_WIDTH = listBox.Width;
                _uiEleInfo.UIELEMENT_ANGLE = angle;
            }
            else if (_draggedElementToString.Contains("ComboBox"))
            {
                ComboBox combobox = eSource as ComboBox;
                _uiEleInfo.UIELEMENT_HEIGHT = combobox.Height;
                _uiEleInfo.UIELEMENT_WIDTH = combobox.Width;
                _uiEleInfo.UIELEMENT_ANGLE = angle;
            }
            else if (_draggedElementToString.Contains("Menu"))
            {
                Menu menu = eSource as Menu;
                _uiEleInfo.UIELEMENT_HEIGHT = menu.Height;
                _uiEleInfo.UIELEMENT_WIDTH = menu.Width;
                _uiEleInfo.UIELEMENT_ANGLE = angle;
            }
            else if (_draggedElementToString.Contains("Button"))
            {
                Button btn = eSource as Button;
                _uiEleInfo.UIELEMENT_HEIGHT = btn.Height;
                _uiEleInfo.UIELEMENT_WIDTH = btn.Width;
                _uiEleInfo.UIELEMENT_ANGLE = angle;
            }
            else if (_draggedElementToString.Contains("Slider"))
            {
                Slider slider = eSource as Slider;
                _uiEleInfo.UIELEMENT_HEIGHT = slider.Height;
                _uiEleInfo.UIELEMENT_WIDTH = slider.Width;
                _uiEleInfo.UIELEMENT_ANGLE = angle;
            }

        }
Ejemplo n.º 7
0
        public void LeftButtonMakeTempListItem(object eSource, string _draggedElementToString)
        {
            string typeName = null;
            typeName = CheckTypeName(eSource, _draggedElementToString);
            current_typeName = typeName;
            SelectedTypeId = typeName;
            SelectedCanvasText = _draggedElementToString;
            _uiEleInfo = SearchList(typeName);
            fileTabV.scriptV._webBrowser.InvokeScript("setStartXML", new object[] {_uiEleInfo.UIELEMENT_ID,_uiEleInfo.UIELEMENT_TYPE,current_Scene, hiddenfileLoad(typeName)});
            fileTabV.scriptV.AddMouseMoveEvnet();

            if (_draggedElementToString.Contains("RadioButton"))
            {
                RadioButton radiobutton = eSource as RadioButton;
                _uiEleInfo.UIELEMENT_HEIGHT = radiobutton.Height;
                _uiEleInfo.UIELEMENT_WIDTH = radiobutton.Width;
            }           
            else if (_draggedElementToString.Contains("TextBox"))
            {
                TextBox txtBox = eSource as TextBox;
                _uiEleInfo.UIELEMENT_HEIGHT = txtBox.Height;
                _uiEleInfo.UIELEMENT_WIDTH = txtBox.Width;
            }
            else if (_draggedElementToString.Contains("Image"))
            {
                Image image = eSource as Image;
                _uiEleInfo.UIELEMENT_HEIGHT = image.Height;
                _uiEleInfo.UIELEMENT_WIDTH = image.Width;
            }
            else if (_draggedElementToString.Contains("PasswordBox"))
            {
                PasswordBox passwordBox = eSource as PasswordBox;
                _uiEleInfo.UIELEMENT_HEIGHT = passwordBox.Height;
                _uiEleInfo.UIELEMENT_WIDTH = passwordBox.Width;
            }
            else if (_draggedElementToString.Contains("Canvas"))
            {
            }
            else if (_draggedElementToString.Contains("ListBoxItem"))
            {
            }
            else if (_draggedElementToString.Contains("ListBox"))
            {
                ListBox listBox = eSource as ListBox;
                _uiEleInfo.UIELEMENT_HEIGHT = listBox.Height;
                _uiEleInfo.UIELEMENT_WIDTH = listBox.Width;
            }
            else if (_draggedElementToString.Contains("ComboBox"))
            {
                ComboBox combobox = eSource as ComboBox;
                _uiEleInfo.UIELEMENT_HEIGHT = combobox.Height;
                _uiEleInfo.UIELEMENT_WIDTH = combobox.Width;
            }
            else if (_draggedElementToString.Contains("Menu"))
            {
                Menu menu = eSource as Menu;
                _uiEleInfo.UIELEMENT_HEIGHT = menu.Height;
                _uiEleInfo.UIELEMENT_WIDTH = menu.Width;
            }
            else if (_draggedElementToString.Contains("Button"))
            {
                Button btn = eSource as Button;
                _uiEleInfo.UIELEMENT_HEIGHT = btn.Height;
                _uiEleInfo.UIELEMENT_WIDTH = btn.Width;
                
            }
            else if (_draggedElementToString.Contains("Slider"))
            {
                Slider slider = eSource as Slider;
                _uiEleInfo.UIELEMENT_HEIGHT = slider.Height;
                _uiEleInfo.UIELEMENT_WIDTH = slider.Width;
            }
        }
Ejemplo n.º 8
0
        private void ViewLoded(object sender, RoutedEventArgs e)
        {
            if (Application.Current.MainWindow != null) 
            {
                Window window = Application.Current.MainWindow;                
                ctrVM = window.DataContext as ControlViewModel;
                exV = ctrVM.extendUIV;
                ctrVM._ucaVM = ucaVM;
                ctrVM.extendUIV = exV;
                ctrVM._ucaVM.preview = this;
                //요기
                _tabControls = ctrVM.tabControlsV; 

                if (!_isInit)//.가 안되어 있다면 수행.
                {
                    ucaVM.DomtreeVM = new domTreeManagementViewModel(_file_path);
                    ctrVM._ucaVM.DomtreeVM.InitList(ctrVM._ucaVM.UI_Element_List);
                    ctrVM._ucaVM.UI_Element_List = ctrVM._ucaVM.DomtreeVM.ReadHtmlToCS();
                    
                    ctrVM.SrcCodeVM.GetSrcOfPath(_file_path);
                    //이부분에 리스트들을 초기화 하는부분이 있으면 됨.

                    foreach (UIElementInfo temp in ctrVM._ucaVM.UI_Element_List)
                    {
                        
                        UIElementInfo currentUIInfo = new UIElementInfo();
                        ctrVM._ucaVM.currentUIInfo.UIELEMENT_TYPE = temp.UIELEMENT_TYPE;
                        currentUIInfo.UIELEMENT_TYPE = temp.UIELEMENT_TYPE;
                        currentUIInfo.UIELEMENT_ID = temp.UIELEMENT_ID;
                        ctrVM._ucaVM.Items.Add(currentUIInfo);
                        lvDataBinding.ItemsSource = ctrVM._ucaVM.Items;

                        ImageBrush brush = new ImageBrush();
                        BitmapImage image;
                        string _imagePath = temp.UIELEMENT_IMAGEURL;

                        if (!string.IsNullOrEmpty(_imagePath))
                        {
                            image = new BitmapImage(new Uri(_imagePath));
                            brush.ImageSource = image;
                        }
                        SolidColorBrush backgroundBrush = new SolidColorBrush(temp.UIELEMENT_BACKGROUND);
                        SolidColorBrush foregroundBrush = new SolidColorBrush(temp.UIELEMENT_FOREGROUND);
                        SolidColorBrush bordergroundBrush = new SolidColorBrush(temp.UIELEMENT_BORDERGROUND);
                        
                        transform = new RotateTransform();
                        transform.Angle = temp.UIELEMENT_ANGLE;
                        Thickness thickness = new Thickness();
                        thickness.Bottom = temp.UIELEMENT_DTHICKNESS;
                        thickness.Top = temp.UIELEMENT_UTHICKNESS;
                        thickness.Right = temp.UIELEMENT_RTHICKNESS;
                        thickness.Left = temp.UIELEMENT_LTHICKNESS;

                        if (temp.UIELEMENT_TYPE.Equals("Canvas"))
                        {
                            __canvas.Background = backgroundBrush;
                            __canvas.Name = temp.UIELEMENT_ID;                         
                            __canvas.RenderTransform = transform;
                            __canvas.Height = temp.UIELEMENT_HEIGHT;
                            __canvas.Width = temp.UIELEMENT_WIDTH;
                            __canvas.ToolTip = temp.UIELEMENT_TOOLTIP;
                            if (string.IsNullOrEmpty(_imagePath))
                                __canvas.Background = backgroundBrush;
                            else
                                __canvas.Background = brush;

                            __canvas.ToolTip = temp.UIELEMENT_TOOLTIP;
                            //   Visibility visibility = Visibility.Visible;
                        }

                        if (temp.UIELEMENT_TYPE.Equals("radiobutton"))
                        {
                            RadioButton radiobutton = new RadioButton();
                            radiobutton.Name = temp.UIELEMENT_ID;
                            radiobutton.Content = temp.UIELEMENT_TEXT;
                            radiobutton.RenderTransform = transform;
                            radiobutton.Height = temp.UIELEMENT_HEIGHT;
                            radiobutton.Width = temp.UIELEMENT_WIDTH;
                            radiobutton.ToolTip = temp.UIELEMENT_TOOLTIP;
                            if (string.IsNullOrEmpty(_imagePath))
                                radiobutton.Background = backgroundBrush;
                            else
                                radiobutton.Background = brush;
                            radiobutton.Foreground = foregroundBrush;
                            radiobutton.BorderBrush = bordergroundBrush;
                            radiobutton.BorderThickness = thickness;
                            radiobutton.ToolTip = temp.UIELEMENT_TOOLTIP;
                            Visibility visibility = Visibility.Visible;
                            if (temp.UIELEMENT_VISIBLE.Equals("Visible"))
                            {
                                visibility = Visibility.Visible;
                            }
                            else
                            {
                                visibility = Visibility.Hidden;
                            }
                            radiobutton.Visibility = visibility;
                            Canvas.SetZIndex(radiobutton, temp.UIELEMENT_ZINDEX);
                            __canvas.Children.Add(radiobutton);
                            Canvas.SetLeft(radiobutton, temp.UIELEMENT_XPOSITION);
                            Canvas.SetTop(radiobutton, temp.UIELEMENT_YPOSITION);
                        }

                        else if (temp.UIELEMENT_TYPE.Equals("button"))
                        {
                            Button btn = new Button();
                            btn.Name = temp.UIELEMENT_ID;
                            btn.Content = temp.UIELEMENT_TEXT;
                            btn.RenderTransform = transform;
                            btn.Height = temp.UIELEMENT_HEIGHT;
                            btn.Width = temp.UIELEMENT_WIDTH;
                            btn.ToolTip = temp.UIELEMENT_TOOLTIP;
                            if (string.IsNullOrEmpty(_imagePath))
                                btn.Background = backgroundBrush;
                            else
                                btn.Background = brush;
                            btn.Foreground = foregroundBrush;
                            btn.BorderBrush = bordergroundBrush;
                            btn.BorderThickness = thickness;
                            btn.ToolTip = temp.UIELEMENT_TOOLTIP;
                            Visibility visibility = Visibility.Visible;
                            if (temp.UIELEMENT_VISIBLE.Equals("Visible"))
                            {
                               visibility = Visibility.Visible;
                            }
                            else
                            {
                                visibility = Visibility.Hidden;
                            }
                            btn.Visibility = visibility;
                            Canvas.SetZIndex(btn, temp.UIELEMENT_ZINDEX);
                            __canvas.Children.Add(btn);
                            Canvas.SetLeft(btn, temp.UIELEMENT_XPOSITION);
                            Canvas.SetTop(btn, temp.UIELEMENT_YPOSITION);
                        }
                        else if (temp.UIELEMENT_TYPE.Equals("image"))
                        {
                            Image imageTagImg = new Image();
                            imageTagImg.Name = temp.UIELEMENT_ID;
                            imageTagImg.Height = temp.UIELEMENT_HEIGHT;
                            imageTagImg.Width = temp.UIELEMENT_WIDTH;
                            imageTagImg.ToolTip = temp.UIELEMENT_TOOLTIP;
                            imageTagImg.RenderTransform = transform;
                            imageTagImg.ToolTip = temp.UIELEMENT_TOOLTIP;
                            Visibility visibility = Visibility.Visible;
                            if (temp.UIELEMENT_VISIBLE.Equals("Visible"))
                            {
                                visibility = Visibility.Visible;
                            }
                            else
                            {
                                visibility = Visibility.Hidden;
                            }
                            imageTagImg.Visibility = visibility;
                            Canvas.SetZIndex(imageTagImg, temp.UIELEMENT_ZINDEX);
                            __canvas.Children.Add(imageTagImg);
                            Canvas.SetLeft(imageTagImg, temp.UIELEMENT_XPOSITION);
                            Canvas.SetTop(imageTagImg, temp.UIELEMENT_YPOSITION);
                        }
                        else if (temp.UIELEMENT_TYPE.Equals("passwordbox"))
                        {
                            PasswordBox passwordBox = new PasswordBox();
                            passwordBox.Name = temp.UIELEMENT_ID;
                            passwordBox.Height = temp.UIELEMENT_HEIGHT;
                            passwordBox.Width = temp.UIELEMENT_WIDTH;
                            passwordBox.ToolTip = temp.UIELEMENT_TOOLTIP;
                            if (string.IsNullOrEmpty(_imagePath))
                                passwordBox.Background = backgroundBrush;
                            else
                                passwordBox.Background = brush;
                            passwordBox.Foreground = foregroundBrush;
                            passwordBox.BorderBrush = bordergroundBrush;
                            passwordBox.BorderThickness = thickness;
                            passwordBox.RenderTransform = transform;
                            passwordBox.ToolTip = temp.UIELEMENT_TOOLTIP;
                            Visibility visibility = Visibility.Visible;
                            if (temp.UIELEMENT_VISIBLE.Equals("Visible"))
                            {
                                visibility = Visibility.Visible;
                            }
                            else
                            {
                                visibility = Visibility.Hidden;
                            }
                            passwordBox.Visibility = visibility;
                            Canvas.SetZIndex(passwordBox, temp.UIELEMENT_ZINDEX);
                            __canvas.Children.Add(passwordBox);
                            Canvas.SetLeft(passwordBox, temp.UIELEMENT_XPOSITION);
                            Canvas.SetTop(passwordBox, temp.UIELEMENT_YPOSITION);
                        }
                        else if (temp.UIELEMENT_TYPE.Equals("textbox"))
                        {
                            TextBox txtbox = new TextBox();
                            txtbox.Name = temp.UIELEMENT_ID;
                            txtbox.Text = temp.UIELEMENT_TEXT;
                            txtbox.Height = temp.UIELEMENT_HEIGHT;
                            txtbox.Width = temp.UIELEMENT_WIDTH;
                            txtbox.ToolTip = temp.UIELEMENT_TOOLTIP;
                            if (string.IsNullOrEmpty(_imagePath))
                                txtbox.Background = backgroundBrush;
                            else
                                txtbox.Background = brush;
                            txtbox.Foreground = foregroundBrush;
                            txtbox.BorderBrush = bordergroundBrush;
                            txtbox.BorderThickness = thickness;
                            txtbox.RenderTransform = transform;
                            txtbox.ToolTip = temp.UIELEMENT_TOOLTIP;
                            Visibility visibility = Visibility.Visible;
                            if (temp.UIELEMENT_VISIBLE.Equals("Visible"))
                            {
                                visibility = Visibility.Visible;
                            }
                            else
                            {
                                visibility = Visibility.Hidden;
                            }
                            txtbox.Visibility = visibility;
                            Canvas.SetZIndex(txtbox, temp.UIELEMENT_ZINDEX);
                            __canvas.Children.Add(txtbox);
                            Canvas.SetLeft(txtbox, temp.UIELEMENT_XPOSITION);
                            Canvas.SetTop(txtbox, temp.UIELEMENT_YPOSITION);
                        }

                        else if (temp.UIELEMENT_TYPE.Equals("listbox"))
                        {
                            ListBox listbox = new ListBox();
                            listbox.Name = temp.UIELEMENT_ID;
                            listbox.RenderTransform = transform;
                            listbox.Height = temp.UIELEMENT_HEIGHT;
                            listbox.Width = temp.UIELEMENT_WIDTH;
                            listbox.ToolTip = temp.UIELEMENT_TOOLTIP;
                            if (string.IsNullOrEmpty(_imagePath))
                                listbox.Background = backgroundBrush;
                            else
                                listbox.Background = brush;
                            listbox.Foreground = foregroundBrush;
                            listbox.BorderBrush = bordergroundBrush;
                            listbox.BorderThickness = thickness;
                            listbox.ToolTip = temp.UIELEMENT_TOOLTIP;
                            Visibility visibility = Visibility.Visible;
                            if (temp.UIELEMENT_VISIBLE.Equals("Visible"))
                            {
                                visibility = Visibility.Visible;
                            }
                            else
                            {
                                visibility = Visibility.Hidden;
                            }
                            listbox.Visibility = visibility;
                            Canvas.SetZIndex(listbox, temp.UIELEMENT_ZINDEX);
                            __canvas.Children.Add(listbox);
                            Canvas.SetLeft(listbox, temp.UIELEMENT_XPOSITION);
                            Canvas.SetTop(listbox, temp.UIELEMENT_YPOSITION);
                        }

                        else if (temp.UIELEMENT_TYPE.Equals("combobox"))
                        {
                            ComboBox combobox = new ComboBox();
                            combobox.Name = temp.UIELEMENT_ID;
                            combobox.Text = temp.UIELEMENT_TEXT;
                            combobox.RenderTransform = transform;
                            combobox.Height = temp.UIELEMENT_HEIGHT;
                            combobox.Width = temp.UIELEMENT_WIDTH;
                            combobox.ToolTip = temp.UIELEMENT_TOOLTIP;
                            if (string.IsNullOrEmpty(_imagePath))
                                combobox.Background = backgroundBrush;
                            else
                                combobox.Background = brush;
                            combobox.Foreground = foregroundBrush;
                            combobox.BorderBrush = bordergroundBrush;
                            combobox.BorderThickness = thickness;
                            combobox.ToolTip = temp.UIELEMENT_TOOLTIP;
                            Visibility visibility = Visibility.Visible;
                            if (temp.UIELEMENT_VISIBLE.Equals("Visible"))
                            {
                                visibility = Visibility.Visible;
                            }
                            else
                            {
                                visibility = Visibility.Hidden;
                            }
                            combobox.Visibility = visibility;
                            Canvas.SetZIndex(combobox, temp.UIELEMENT_ZINDEX);
                            __canvas.Children.Add(combobox);
                            Canvas.SetLeft(combobox, temp.UIELEMENT_XPOSITION);
                            Canvas.SetTop(combobox, temp.UIELEMENT_YPOSITION);
                        }

                        else if (temp.UIELEMENT_TYPE.Equals("menu"))
                        {
                            Menu menu = new Menu();
                            menu.Name = temp.UIELEMENT_ID;
                            menu.RenderTransform = transform;
                            menu.Height = temp.UIELEMENT_HEIGHT;
                            menu.Width = temp.UIELEMENT_WIDTH;
                            menu.ToolTip = temp.UIELEMENT_TOOLTIP;
                            if (string.IsNullOrEmpty(_imagePath))
                                menu.Background = backgroundBrush;
                            else
                                menu.Background = brush;
                            menu.Foreground = foregroundBrush;
                            menu.BorderBrush = bordergroundBrush;
                            menu.BorderThickness = thickness;
                            menu.ToolTip = temp.UIELEMENT_TOOLTIP;
                            Visibility visibility = Visibility.Visible;
                            if (temp.UIELEMENT_VISIBLE.Equals("Visible"))
                            {
                                visibility = Visibility.Visible;
                            }
                            else
                            {
                                visibility = Visibility.Hidden;
                            }
                            menu.Visibility = visibility;
                            Canvas.SetZIndex(menu, temp.UIELEMENT_ZINDEX);
                            __canvas.Children.Add(menu);
                            Canvas.SetLeft(menu, temp.UIELEMENT_XPOSITION);
                            Canvas.SetTop(menu, temp.UIELEMENT_YPOSITION);
                        }

                        else if (temp.UIELEMENT_TYPE.Equals("slider"))
                        {
                            Slider slider = new Slider();
                            slider.Name = temp.UIELEMENT_ID;
                            slider.RenderTransform = transform;
                            slider.Height = temp.UIELEMENT_HEIGHT;
                            slider.Width = temp.UIELEMENT_WIDTH;
                            slider.ToolTip = temp.UIELEMENT_TOOLTIP;
                            if (string.IsNullOrEmpty(_imagePath))
                                slider.Background = backgroundBrush;
                            else
                                slider.Background = brush;
                            slider.Foreground = foregroundBrush;
                            slider.BorderBrush = bordergroundBrush;
                            slider.BorderThickness = thickness;
                            slider.ToolTip = temp.UIELEMENT_TOOLTIP;
                            Visibility visibility = Visibility.Visible;
                            if (temp.UIELEMENT_VISIBLE.Equals("Visible"))
                            {
                                visibility = Visibility.Visible;
                            }
                            else
                            {
                                visibility = Visibility.Hidden;
                            }
                            slider.Visibility = visibility;
                            Canvas.SetZIndex(slider, temp.UIELEMENT_ZINDEX);
                            __canvas.Children.Add(slider);
                            Canvas.SetLeft(slider, temp.UIELEMENT_XPOSITION);
                            Canvas.SetTop(slider, temp.UIELEMENT_YPOSITION);
                        }
                    }

                    _isInit = true;
                }
            }
        }
Ejemplo n.º 9
0
 public void cutEvent()
 {
     string _selctedStr = rightSelectElement.ToString();
     UIElement _selectedEle = new UIElement();
     _selectedEle = rightSelectElement as UIElement;
     foreach (UIElementInfo temp in ctrVM._ucaVM.UI_Element_List)
     {
         if (_selctedStr.Contains("RadioButton"))
         {
             if (temp.UIELEMENT_ID.Equals((rightSelectElement as RadioButton).Name))
             {
                 MyCanvas.Children.Remove(_selectedEle);
                 _cutItem = _selectedEle;
                 _cutInfo = temp;
                 ctrVM._ucaVM.UI_Element_List.Remove(temp);
                 ctrVM._ucaVM.Items.Remove(temp);
                 break;
             }
         }
         else if (_selctedStr.Contains("Button"))
         {
             if (temp.UIELEMENT_ID.Equals((rightSelectElement as Button).Name))
             {
                 MyCanvas.Children.Remove(_selectedEle);
                 _cutItem = _selectedEle;
                 _cutInfo = temp;
                 ctrVM._ucaVM.UI_Element_List.Remove(temp);
                 ctrVM._ucaVM.Items.Remove(temp);
                 break;
             }
         }
         else if (_selctedStr.Contains("TextBox"))
         {
             if (temp.UIELEMENT_ID.Equals((rightSelectElement as TextBox).Name))
             {
                 MyCanvas.Children.Remove(_selectedEle);
                 _cutItem = _selectedEle;
                 _cutInfo = temp;
                 ctrVM._ucaVM.UI_Element_List.Remove(temp);
                 ctrVM._ucaVM.Items.Remove(temp);
                 break;
             }
         }
         else if (_selctedStr.Contains("PasswordBox"))
         {
             if (temp.UIELEMENT_ID.Equals((rightSelectElement as PasswordBox).Name))
             {
                 MyCanvas.Children.Remove(_selectedEle);
                 _cutItem = _selectedEle;
                 _cutInfo = temp;
                 ctrVM._ucaVM.UI_Element_List.Remove(temp);
                 ctrVM._ucaVM.Items.Remove(temp);
                 break;
             }
         }
         else if (_selctedStr.Contains("ListBox"))
         {
             if (temp.UIELEMENT_ID.Equals((rightSelectElement as ListBox).Name))
             {
                 MyCanvas.Children.Remove(_selectedEle);
                 _cutItem = _selectedEle;
                 _cutInfo = temp;
                 ctrVM._ucaVM.UI_Element_List.Remove(temp);
                 ctrVM._ucaVM.Items.Remove(temp);
                 break;
             }
         }
         else if (_selctedStr.Contains("ComboBox"))
         {
             if (temp.UIELEMENT_ID.Equals((rightSelectElement as ComboBox).Name))
             {
                 MyCanvas.Children.Remove(_selectedEle);
                 _cutItem = _selectedEle;
                 _cutInfo = temp;
                 ctrVM._ucaVM.UI_Element_List.Remove(temp);
                 ctrVM._ucaVM.Items.Remove(temp);
                 break;
             }
         }
         else if (_selctedStr.Contains("Menu"))
         {
             if (temp.UIELEMENT_ID.Equals((rightSelectElement as Menu).Name))
             {
                 MyCanvas.Children.Remove(_selectedEle);
                 _cutItem = _selectedEle;
                 _cutInfo = temp;
                 ctrVM._ucaVM.UI_Element_List.Remove(temp);
                 ctrVM._ucaVM.Items.Remove(temp);
                 break;
             }
         }
         else if (_selctedStr.Contains("Slider"))
         {
             if (temp.UIELEMENT_ID.Equals((rightSelectElement as Slider).Name))
             {
                 MyCanvas.Children.Remove(_selectedEle);
                 _cutItem = _selectedEle;
                 _cutInfo = temp;
                 ctrVM._ucaVM.UI_Element_List.Remove(temp);
                 ctrVM._ucaVM.Items.Remove(temp);
                 break;
             }
         }
     }
 }
Ejemplo n.º 10
0
        public void RenderingUICanvas(Canvas canvas, Point dropPoint, string type)
        {
            string uiTextName = numbering(type);
            currentUIInfo = new UIElementInfo();
            
            currentUIInfo.UIELEMENT_TYPE = type;
            currentUIInfo.UIELEMENT_TOOLTIP = "Tooltip Here";
            currentUIInfo.UIELEMENT_ID = uiTextName;
            currentUIInfo.UIELEMENT_TEXT = uiTextName;
            currentUIInfo.UIELEMENT_ZINDEX = currentZIndex;
            currentUIInfo.UIELEMENT_XPOSITION = dropPoint.X;
            currentUIInfo.UIELEMENT_YPOSITION = dropPoint.Y;
            currentZIndex++;
            ui_Element_List.Add(currentUIInfo);
            items.Add(currentUIInfo);
            preview.lvDataBinding.ItemsSource = items;
            transform = new RotateTransform();
            transform.Angle = currentUIInfo.UIELEMENT_ANGLE;
            if (type.Equals("button"))
            {
                Button btn = new Button();
                currentUIInfo.UIELEMENT_BACKGROUND = (Color)ColorConverter.ConvertFromString("#3F3F46");
                currentUIInfo.UIELEMENT_FOREGROUND = (Color)ColorConverter.ConvertFromString("#FFFFFF");
                currentUIInfo.UIELEMENT_BORDERGROUND = (Color)ColorConverter.ConvertFromString("#0054545C");
                btn.Background = new SolidColorBrush(currentUIInfo.UIELEMENT_BACKGROUND);
                btn.Foreground = new SolidColorBrush(currentUIInfo.UIELEMENT_FOREGROUND);
                btn.BorderBrush = new SolidColorBrush(currentUIInfo.UIELEMENT_BORDERGROUND);
                btn.Name = uiTextName;
                btn.Content = uiTextName;
                btn.Height = 40;
                btn.Width = 60;
                btn.ToolTip = "Tooltip Here";
                btn.RenderTransform = transform;
                Canvas.SetZIndex(btn, currentZIndex);
                canvas.Children.Add(btn);
                Canvas.SetLeft(btn, dropPoint.X);
                Canvas.SetTop(btn, dropPoint.Y);
            }
            else if (type.Equals("image"))
            {

                transform.Angle = 0;
                Image image = new Image();
                image.Name = uiTextName;
                image.Height = 40;
                image.Width = 60;
                image.RenderTransform = transform;
                Canvas.SetZIndex(image, currentZIndex);
                canvas.Children.Add(image);
                Canvas.SetLeft(image, dropPoint.X);
                Canvas.SetTop(image, dropPoint.Y);
            }
            else if (type.Equals("passwordBox"))
            {
                transform.Angle = 0;
                PasswordBox passwordBox = new PasswordBox();
                currentUIInfo.UIELEMENT_BACKGROUND = (Color)ColorConverter.ConvertFromString("#3F3F46");
                currentUIInfo.UIELEMENT_FOREGROUND = (Color)ColorConverter.ConvertFromString("#FFFFFF");
                currentUIInfo.UIELEMENT_BORDERGROUND = (Color)ColorConverter.ConvertFromString("#0054545C");
                passwordBox.Background = new SolidColorBrush(currentUIInfo.UIELEMENT_BACKGROUND);
                passwordBox.Foreground = new SolidColorBrush(currentUIInfo.UIELEMENT_FOREGROUND);
                passwordBox.BorderBrush = new SolidColorBrush(currentUIInfo.UIELEMENT_BORDERGROUND);
                passwordBox.Name = uiTextName;
                passwordBox.Height = 40;
                passwordBox.Width = 60;
                passwordBox.ToolTip = "Tooltip Here";
                passwordBox.RenderTransform = transform;
                Canvas.SetZIndex(passwordBox, currentZIndex);
                canvas.Children.Add(passwordBox);
                Canvas.SetLeft(passwordBox, dropPoint.X);
                Canvas.SetTop(passwordBox, dropPoint.Y);
            }
            else if (type.Equals("textbox"))
            {
                transform.Angle = 0;
                TextBox txtBox = new TextBox();
                currentUIInfo.UIELEMENT_BACKGROUND = (Color)ColorConverter.ConvertFromString("#3F3F46");
                currentUIInfo.UIELEMENT_FOREGROUND = (Color)ColorConverter.ConvertFromString("#FFFFFF");
                currentUIInfo.UIELEMENT_BORDERGROUND = (Color)ColorConverter.ConvertFromString("#0054545C");
                txtBox.Background = new SolidColorBrush(currentUIInfo.UIELEMENT_BACKGROUND);
                txtBox.Foreground = new SolidColorBrush(currentUIInfo.UIELEMENT_FOREGROUND);
                txtBox.BorderBrush = new SolidColorBrush(currentUIInfo.UIELEMENT_BORDERGROUND);
                txtBox.Height = 40;
                txtBox.Width = 60;
                txtBox.Text = uiTextName;
                txtBox.Name = uiTextName;
                txtBox.ToolTip = "Tooltip Here";
                txtBox.RenderTransform = transform;
                Canvas.SetZIndex(txtBox, currentZIndex);
                canvas.Children.Add(txtBox);
                Canvas.SetLeft(txtBox, dropPoint.X);
                Canvas.SetTop(txtBox, dropPoint.Y);
            }
            
            else if (type.Equals("listBox"))
            {
                transform.Angle = 0;
                ListBox listbox = new ListBox();
                currentUIInfo.UIELEMENT_BACKGROUND = (Color)ColorConverter.ConvertFromString("#3F3F46");
                currentUIInfo.UIELEMENT_FOREGROUND = (Color)ColorConverter.ConvertFromString("#FFFFFF");
                currentUIInfo.UIELEMENT_BORDERGROUND = (Color)ColorConverter.ConvertFromString("#54545C");
                listbox.Background = new SolidColorBrush(currentUIInfo.UIELEMENT_BACKGROUND);
                listbox.Foreground = new SolidColorBrush(currentUIInfo.UIELEMENT_FOREGROUND);
                listbox.BorderBrush = new SolidColorBrush(currentUIInfo.UIELEMENT_BORDERGROUND);
                listbox.Height = 40;
                listbox.Width = 60;
                listbox.Name = uiTextName;
                listbox.ToolTip = "Tooltip Here";
                listbox.RenderTransform = transform;
                Canvas.SetZIndex(listbox, currentZIndex);
                canvas.Children.Add(listbox);
                Canvas.SetLeft(listbox, dropPoint.X);
                Canvas.SetTop(listbox, dropPoint.Y);

            }
            else if (type.Equals("comboBox"))
            {
                transform.Angle = 0;
                ComboBox combobox = new ComboBox();
                currentUIInfo.UIELEMENT_BACKGROUND = (Color)ColorConverter.ConvertFromString("#3F3F46");
                currentUIInfo.UIELEMENT_FOREGROUND = (Color)ColorConverter.ConvertFromString("#FFFFFF");
                currentUIInfo.UIELEMENT_BORDERGROUND = (Color)ColorConverter.ConvertFromString("#54545C");
                combobox.Background = new SolidColorBrush(currentUIInfo.UIELEMENT_BACKGROUND);
                combobox.Foreground = new SolidColorBrush(currentUIInfo.UIELEMENT_FOREGROUND);
                combobox.BorderBrush = new SolidColorBrush(currentUIInfo.UIELEMENT_BORDERGROUND);
                combobox.Height = 40;
                combobox.Width = 60;
                combobox.Text = uiTextName;
                combobox.Name = uiTextName;
                combobox.ToolTip = "Tooltip Here";
                combobox.RenderTransform = transform;
                Canvas.SetZIndex(combobox, currentZIndex);
                canvas.Children.Add(combobox);
                Canvas.SetLeft(combobox, dropPoint.X);
                Canvas.SetTop(combobox, dropPoint.Y);

            }
            else if (type.Equals("menu"))
            {
                transform.Angle = 0;
                Menu menu = new Menu();
                currentUIInfo.UIELEMENT_BACKGROUND = (Color)ColorConverter.ConvertFromString("#3F3F46");
                currentUIInfo.UIELEMENT_FOREGROUND = (Color)ColorConverter.ConvertFromString("#FFFFFF");
                currentUIInfo.UIELEMENT_BORDERGROUND = (Color)ColorConverter.ConvertFromString("#54545C");
                menu.Background = new SolidColorBrush(currentUIInfo.UIELEMENT_BACKGROUND);
                menu.Foreground = new SolidColorBrush(currentUIInfo.UIELEMENT_FOREGROUND);
                menu.BorderBrush = new SolidColorBrush(currentUIInfo.UIELEMENT_BORDERGROUND);
                menu.Height = 40;
                menu.Width = 60;
                menu.ToolTip = "Tooltip Here";
                menu.Name = uiTextName;
                menu.RenderTransform = transform;
                Canvas.SetZIndex(menu, currentZIndex);
                canvas.Children.Add(menu);
                Canvas.SetLeft(menu, dropPoint.X);
                Canvas.SetTop(menu, dropPoint.Y);

            }
            else if (type.Equals("radioButton"))
            {
                transform.Angle = 0;
                RadioButton radiobutton = new RadioButton();
                currentUIInfo.UIELEMENT_BACKGROUND = (Color)ColorConverter.ConvertFromString("#3F3F46");
                currentUIInfo.UIELEMENT_FOREGROUND = (Color)ColorConverter.ConvertFromString("#FFFFFF");
                currentUIInfo.UIELEMENT_BORDERGROUND = (Color)ColorConverter.ConvertFromString("#54545C");
                radiobutton.Background = new SolidColorBrush(currentUIInfo.UIELEMENT_BACKGROUND);
                radiobutton.Foreground = new SolidColorBrush(currentUIInfo.UIELEMENT_FOREGROUND);
                radiobutton.BorderBrush = new SolidColorBrush(currentUIInfo.UIELEMENT_BORDERGROUND);
                radiobutton.Height = 40;
                radiobutton.Width = 60;
                radiobutton.Name = uiTextName;
                radiobutton.ToolTip = "Tooltip Here";
                radiobutton.RenderTransform = transform;
                Canvas.SetZIndex(radiobutton, currentZIndex);
                canvas.Children.Add(radiobutton);
                Canvas.SetLeft(radiobutton, dropPoint.X);
                Canvas.SetTop(radiobutton, dropPoint.Y);

            }
            else if (type.Equals("slider"))
            {
                transform.Angle = 0;
                Slider slider = new Slider();
                currentUIInfo.UIELEMENT_BACKGROUND = (Color)ColorConverter.ConvertFromString("#3F3F46");
                currentUIInfo.UIELEMENT_FOREGROUND = (Color)ColorConverter.ConvertFromString("#FFFFFF");
                currentUIInfo.UIELEMENT_BORDERGROUND = (Color)ColorConverter.ConvertFromString("#0054545C");
                slider.Background = new SolidColorBrush(currentUIInfo.UIELEMENT_BACKGROUND);
                slider.Foreground = new SolidColorBrush(currentUIInfo.UIELEMENT_FOREGROUND);
                slider.BorderBrush = new SolidColorBrush(currentUIInfo.UIELEMENT_BORDERGROUND);
                slider.Height = 40;
                slider.Width = 60;
                slider.Name = uiTextName;
                slider.ToolTip = "Tooltip Here";
                slider.RenderTransform = transform;
                Canvas.SetZIndex(slider, currentZIndex);
                canvas.Children.Add(slider);
                Canvas.SetLeft(slider, dropPoint.X);
                Canvas.SetTop(slider, dropPoint.Y);

            }

        }