private LibraryItemViewModel(LibraryItem libraryItem, LibraryItemViewModel parent, LibraryView libraryView) { this.libraryView = libraryView; this.libraryItem = libraryItem; this.parent = parent; this.children = new ObservableCollection <LibraryItemViewModel>(); this.isExpanded = false; this.isSelected = false; this.visibility = Visibility.Visible; //this.header = new List<LibraryView.DecoratedString>(); //LibraryView.DecoratedString item = new LibraryView.DecoratedString(); //item.isHilighted = false; //item.text = this.libraryItem.DisplayText; //this.header.Add(item); this.prePiece = this.libraryItem.DisplayText; this.highlightPiece = string.Empty; this.postPiece = string.Empty; if (this.libraryItem.Children != null && this.libraryItem.Children.Count > 0) { foreach (LibraryItem childItem in libraryItem.Children) { this.children.Add(new LibraryItemViewModel(childItem, this, libraryView)); } } }
public LibraryTreeViewModel(LibraryItem libary, LibraryView libraryView) { this.libraryView = libraryView; this.libary = new LibraryItemViewModel(libary, libraryView); rootItems = new ObservableCollection <LibraryItemViewModel>(); foreach (LibraryItem rootItem in libary.Children) { rootItems.Add(new LibraryItemViewModel(rootItem, libraryView)); } if (rootItems[0].DisplayText == Configurations.NoResultMessage) { rootItems[0].Visibility = Visibility.Collapsed; } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.DesignScriptEditor = ((DesignScriptStudio.Graph.Ui.LibraryView)(target)); return; case 2: #line 20 "..\..\..\LibraryView.xaml" ((System.Windows.Controls.Grid)(target)).PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.OnLibraryKeyDown); #line default #line hidden return; case 3: this.topThumb = ((System.Windows.Controls.Primitives.Thumb)(target)); #line 37 "..\..\..\LibraryView.xaml" this.topThumb.DragDelta += new System.Windows.Controls.Primitives.DragDeltaEventHandler(this.OnTopThumbDragDelta); #line default #line hidden #line 38 "..\..\..\LibraryView.xaml" this.topThumb.PreviewMouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.OnTopThumbMouseUp); #line default #line hidden return; case 4: #line 47 "..\..\..\LibraryView.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.OnMaxiMinimizeClick); #line default #line hidden return; case 5: this.MinimizeView = ((System.Windows.Controls.Image)(target)); return; case 6: this.MaximizeView = ((System.Windows.Controls.Image)(target)); return; case 7: this.content = ((System.Windows.Controls.Border)(target)); return; case 11: this.AddNew = ((System.Windows.Controls.Button)(target)); #line 356 "..\..\..\LibraryView.xaml" this.AddNew.Click += new System.Windows.RoutedEventHandler(this.OnAddNewClick); #line default #line hidden return; case 12: this.Expand = ((System.Windows.Controls.Button)(target)); #line 365 "..\..\..\LibraryView.xaml" this.Expand.Click += new System.Windows.RoutedEventHandler(this.OnExpandClick); #line default #line hidden return; case 13: this.Collapse = ((System.Windows.Controls.Button)(target)); #line 374 "..\..\..\LibraryView.xaml" this.Collapse.Click += new System.Windows.RoutedEventHandler(this.OnCollapseClick); #line default #line hidden return; case 14: #line 390 "..\..\..\LibraryView.xaml" ((System.Windows.Controls.Border)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.OnSearchBarClick); #line default #line hidden return; case 16: this.Search = ((System.Windows.Controls.Button)(target)); return; case 17: this.SearchTextBox = ((System.Windows.Controls.TextBox)(target)); #line 477 "..\..\..\LibraryView.xaml" this.SearchTextBox.KeyUp += new System.Windows.Input.KeyEventHandler(this.OnSearchTextBoxKeyUp); #line default #line hidden return; case 18: this.InternalTreeView = ((System.Windows.Controls.TreeView)(target)); #line 495 "..\..\..\LibraryView.xaml" this.InternalTreeView.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.OnLibraryTreeViewClick); #line default #line hidden return; } this._contentLoaded = true; }
private void OnGraphControlLoaded(object sender, RoutedEventArgs e) { // Kick start library loading on a background thread... coreComponent = ClassFactory.CreateCoreComponent(this, geometricPreviewEnabled); coreComponent.InitializeAsync(this.OnCoreComponentInitialized); // Cursor resources. this.cursorSet = new CursorSet(this.MasterGrid); // Kick start a check for update version info, if the update manager is idle. UpdateManager.Instance.UpdateDownloaded += OnUpdatePackageDownloaded; UpdateManager.Instance.CheckForProductUpdate(); UpdateManager.Instance.ShutdownRequested += OnUpdateManagerShutdownRequested; //Library libraryView = new LibraryView(this); libraryView.SetValue(GraphControl.WidthProperty, 250.0); libraryView.SetValue(GraphControl.HeightProperty, 400.0); libraryView.SetValue(GraphControl.VerticalAlignmentProperty, VerticalAlignment.Bottom); libraryView.SetValue(GraphControl.HorizontalAlignmentProperty, HorizontalAlignment.Left); libraryView.SetValue(GraphControl.MarginProperty, new Thickness(5, 0, 0, 0)); libraryView.SetValue(Panel.ZIndexProperty, 60000); MasterGrid.Children.Add(libraryView); //Zoom and Pan Bar zoomAndPanControl = new ZoomAndPanControl(this); zoomAndPanControl.SetValue(GraphControl.VerticalAlignmentProperty, VerticalAlignment.Top); zoomAndPanControl.SetValue(GraphControl.HorizontalAlignmentProperty, HorizontalAlignment.Right); zoomAndPanControl.SetValue(GraphControl.MarginProperty, new Thickness(0, 5, 5, 0)); zoomAndPanControl.SetValue(Panel.ZIndexProperty, 60000); zoomAndPanControl.Focusable = false; MasterGrid.Children.Add(zoomAndPanControl); //TabControl newCanvasCount = 0; tabControl = new GraphTabControl(this); tabControl.SetValue(Panel.ZIndexProperty, 60000); tabControl.SetValue(GraphControl.MarginProperty, new Thickness(0, -1, 0, 0)); TabBorder.Child = tabControl; // for zoom and pan this.canvasScrollViewer.KeyDown += OnScrollViewerKeyDown; this.canvasScrollViewer.ScrollChanged += OnScrollViewerScrollChanged; this.slider.ValueChanged += OnSliderValueChanged; filesToRecover = Utilities.GetFilesToRecover(coreComponent.SessionName); if (null == filesToRecover || (filesToRecover.Count == 0)) CreateBlankOrRecoveredCanvas(false); // Nothing to recover, create default. // Either UI or Core can be completely loaded before another. In the event // that UI completes its loading first, it sets the "initializationState" // to be "InitializationState.UiInitialized". If at this point Core has // already finished loading, then the library data can readily be obtained // and "Library" tree view populated. // if (initializationState == InitializationState.None) initializationState = InitializationState.UiInitialized; else if (initializationState == InitializationState.CoreInitialized) OnLoadingComplete(); if (!coreComponent.StudioSettings.DontShowSplash) { Splash splashMessage = new Splash(this); splashMessage.SetValue(GraphControl.HorizontalAlignmentProperty, HorizontalAlignment.Center); splashMessage.SetValue(GraphControl.VerticalAlignmentProperty, VerticalAlignment.Bottom); splashMessage.MouseLeftButtonDown += OnSplashMouseLeftButtonDown; this.FeedbackMsssagePanel.Children.Add(splashMessage); } }
private void OnGraphControlLoaded(object sender, RoutedEventArgs e) { // Kick start library loading on a background thread... coreComponent = ClassFactory.CreateCoreComponent(this, geometricPreviewEnabled); coreComponent.InitializeAsync(this.OnCoreComponentInitialized); // Cursor resources. this.cursorSet = new CursorSet(this.MasterGrid); // Kick start a check for update version info, if the update manager is idle. UpdateManager.Instance.UpdateDownloaded += OnUpdatePackageDownloaded; UpdateManager.Instance.CheckForProductUpdate(); UpdateManager.Instance.ShutdownRequested += OnUpdateManagerShutdownRequested; //Library libraryView = new LibraryView(this); libraryView.SetValue(GraphControl.WidthProperty, 250.0); libraryView.SetValue(GraphControl.HeightProperty, 400.0); libraryView.SetValue(GraphControl.VerticalAlignmentProperty, VerticalAlignment.Bottom); libraryView.SetValue(GraphControl.HorizontalAlignmentProperty, HorizontalAlignment.Left); libraryView.SetValue(GraphControl.MarginProperty, new Thickness(5, 0, 0, 0)); libraryView.SetValue(Panel.ZIndexProperty, 60000); MasterGrid.Children.Add(libraryView); //Zoom and Pan Bar zoomAndPanControl = new ZoomAndPanControl(this); zoomAndPanControl.SetValue(GraphControl.VerticalAlignmentProperty, VerticalAlignment.Top); zoomAndPanControl.SetValue(GraphControl.HorizontalAlignmentProperty, HorizontalAlignment.Right); zoomAndPanControl.SetValue(GraphControl.MarginProperty, new Thickness(0, 5, 5, 0)); zoomAndPanControl.SetValue(Panel.ZIndexProperty, 60000); zoomAndPanControl.Focusable = false; MasterGrid.Children.Add(zoomAndPanControl); //TabControl newCanvasCount = 0; tabControl = new GraphTabControl(this); tabControl.SetValue(Panel.ZIndexProperty, 60000); tabControl.SetValue(GraphControl.MarginProperty, new Thickness(0, -1, 0, 0)); TabBorder.Child = tabControl; // for zoom and pan this.canvasScrollViewer.KeyDown += OnScrollViewerKeyDown; this.canvasScrollViewer.ScrollChanged += OnScrollViewerScrollChanged; this.slider.ValueChanged += OnSliderValueChanged; filesToRecover = Utilities.GetFilesToRecover(coreComponent.SessionName); if (null == filesToRecover || (filesToRecover.Count == 0)) { CreateBlankOrRecoveredCanvas(false); // Nothing to recover, create default. } // Either UI or Core can be completely loaded before another. In the event // that UI completes its loading first, it sets the "initializationState" // to be "InitializationState.UiInitialized". If at this point Core has // already finished loading, then the library data can readily be obtained // and "Library" tree view populated. // if (initializationState == InitializationState.None) { initializationState = InitializationState.UiInitialized; } else if (initializationState == InitializationState.CoreInitialized) { OnLoadingComplete(); } if (!coreComponent.StudioSettings.DontShowSplash) { Splash splashMessage = new Splash(this); splashMessage.SetValue(GraphControl.HorizontalAlignmentProperty, HorizontalAlignment.Center); splashMessage.SetValue(GraphControl.VerticalAlignmentProperty, VerticalAlignment.Bottom); splashMessage.MouseLeftButtonDown += OnSplashMouseLeftButtonDown; this.FeedbackMsssagePanel.Children.Add(splashMessage); } }
public LibraryItemViewModel(LibraryItem libraryItem, LibraryView libraryView) : this(libraryItem, null, libraryView) { }