public SrcCodeViewModel(ControlViewModel evm) { _evm = evm; _evm.SrcCodeVM = this; FileSrcCode = new FileSrc(); FileSrcCodeJS = new FileSrc(); }
private void ViewLoded(object sender, RoutedEventArgs e) { if (Application.Current.MainWindow != null) { Window window = Application.Current.MainWindow; ctrVM = window.DataContext as ControlViewModel; } }
private void ViewLoaded(object sender, RoutedEventArgs e) { controlVM = new ControlViewModel(); controlVM.fileTabV = _fileTabView; controlVM.tabControlsV = tabV; controlVM._intro = _intro; controlVM.writeFileStory(); this.DataContext = controlVM; AddHotKeys(); }
private void ViewLoaded(object sender, RoutedEventArgs r) { if (Application.Current.MainWindow != null) { Window window = Application.Current.MainWindow; myViewModel = window.DataContext as ControlViewModel; (DirectoryTree.Items[0] as DirInfo).IsSelected = true; AddHotKeys(); } }
private void ViewLoded(object sender, RoutedEventArgs e) { if (Application.Current.MainWindow != null) { Window window = Application.Current.MainWindow; window.Topmost = true; ctrVM = window.DataContext as ControlViewModel; ctrVM.extendUIV = this; FontSelector.ItemsSource = Fonts.SystemFontFamilies; ctrVM.fontSizeCollection(); } }
private void ViewLoded(object sender, RoutedEventArgs e) { if (Application.Current.MainWindow != null) { Window window = Application.Current.MainWindow; ctrVM = window.DataContext as ControlViewModel; ctrVM.functionMV = this; } //doc = (mshtml.HTMLDocument)_webBrowser.Document; }
/// <summary> /// ctor /// </summary> /// <param name="evm"></param> public FileExplorerViewModel(ControlViewModel evm) { _evm = evm; //create a node for "my computer" // this will be the root for the file system tree DirInfo rootNode = new DirInfo(Resources.My_WorkSpace); rootNode.Path = Environment.GetEnvironmentVariable("USERPROFILE") + "\\" + Miseng.Properties.Resources.My_WorkSpace_Name; _evm.CurrentDirectory = rootNode; //make root node as the current directory _evm.UpdateDirectory = new DirInfo(); SystemDirectorySource = new List<DirInfo> { rootNode }; }
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(); } }
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; _tabControls = ctrVM.tabControlsV; _webBrowser.LoadCompleted += webBrowser_LoadCompleted; } //doc = (mshtml.HTMLDocument)_webBrowser.Document; }
public void UpdateSrcCodeText(object sender, RoutedEventArgs r) { if (Application.Current.MainWindow != null) { Window window = Application.Current.MainWindow; myViewModel = window.DataContext as ControlViewModel; myViewModel.fileSourceCode = this; if (myViewModel.SrcCodeVM != null) myViewModel.SrcCodeVM.avalonEdit = textEditor; if (myViewModel.SrcCodeVM != null) myViewModel.SrcCodeVM.avalonEditJS = textEditorJS; } /* if (this.DataContext != null) { myViewModel = this.DataContext as ControlViewModel; if(myViewModel.SrcCodeVM!=null) myViewModel.SrcCodeVM.avalonEdit = textEditor; } */ }
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; } } }
private void ViewLoaded(object sender, RoutedEventArgs r) { myViewModel = this.DataContext as ControlViewModel; }