private void tsbViewObject_Click(object sender, EventArgs e) { ObjectViewer ov = new ObjectViewer(); string ObjectText = string.Empty; string ObjectDescription = string.Empty; try { using (DataStuff sn = new DataStuff()) { DataTable dt = sn.GetDatabaseObjectText(ConnectionString, DatabaseName, ObjectName); if (dt.Rows.Count > 1) { foreach (DataRow row in dt.Rows) { ObjectText = row["FullDefinition"].ToString(); ObjectDescription = row["ROUTINE_NAME"].ToString() + ": " + row["ROUTINE_TYPE"].ToString(); } } else { ObjectText = LoadHelpText(ConnectionString, DatabaseName, ObjectName); ObjectDescription = ObjectName; if (ObjectText.Trim() == "") { dt = sn.GetTableHelpText(ConnectionString, DatabaseName, ObjectName); foreach (DataRow row in dt.Rows) { ObjectText = row[0].ToString(); } ObjectText = ObjectText.Replace("~", Environment.NewLine); } } } ov.ObjectDescription = ObjectDescription; ov.ObjectText = ObjectText; ov.ConnectionString = ConnectionString; ov.DatabaseName = DatabaseName; ov.ObjectName = ObjectName; ov.AliasName = ServerAlias; ov.Show(); } catch { } }
internal void BuildEntityModel(ErdCanvasModel[] canvases, Dispatcher dispatcher) { if (EntityModelScript.Setup == null) { this.tempSetup = new EntityFrameworkSetup(); ObjectViewer viewer = new ObjectViewer("EF Setup", this.tempSetup); viewer.ModelViewItemBrowse += this.SetupModel_Browse; bool?result = viewer.ShowDialog(); if (!result.HasValue || !result.Value) { return; } EntityModelScript.Setup = viewer.ModelObject.To <EntityFrameworkSetup>(); } this.RunScriptBuilderAsync(canvases, dispatcher); }
public void ObjectSelectedByObject() { Vector3 offset = SurfaceNormal * Utilities.Scaled(15); Focussed = !Focussed; Specs.MouseControlsCamera = !Focussed; if (Focussed) { ParentGO.AddComponent <ObjectViewer>(); IndicatorGO.SetActive(false); ParentGO.transform.position = ParentGO.transform.position + offset; ParentGO.transform.localScale = ParentGO.transform.localScale * 2F; } else { IndicatorGO.SetActive(true); ObjectViewer viewer = ParentGO.GetComponent <ObjectViewer>(); ParentGO.transform.position = viewer.InitialPos; ParentGO.transform.rotation = viewer.InitialRot; ParentGO.transform.localScale = viewer.InitialScl; //Specs.MouseControlsCamera = true; Destroy(viewer); } }
protected virtual void OnKeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.Handled) { return; } if (IsMoveUpDown(e)) { e.Handled = true; return; } RaiseKeyDown(e); if (e.Handled) { return; } switch (e.KeyCode) { case System.Windows.Forms.Keys.F11: ObjectViewer.Show(this); break; case System.Windows.Forms.Keys.Delete: if (e.Shift) { Cut(); } else { OnKeyDownDelete(e); } break; case System.Windows.Forms.Keys.PageDown: OnKeyDownPageDown(e); break; case System.Windows.Forms.Keys.PageUp: OnKeyDownPageUp(e); break; case System.Windows.Forms.Keys.C: if (e.Control) { Copy(); } break; case System.Windows.Forms.Keys.X: if (e.Control) { Cut(); } break; case System.Windows.Forms.Keys.V: if (e.Control) { Paste(); } break; case System.Windows.Forms.Keys.Insert: if (e.Control) { Copy(); } else if (e.Shift) { Paste(); } break; default: break; } }
public void ShowObjectInObjectViewer(FrameWrapper frame, BaseValueRefresher valueRefresher, string initialExpression) { if (objectViewer == null) { objectViewer = new ObjectViewer(); } objectViewer.Initialize(); objectViewer.ShowValue(valueRefresher, frame, initialExpression); }
public void ObjectViewer_ViewObjectPropertyValue_TwoLevel() { var ccy = ObjectViewer.ViewObjectPropertyValue(_swap, "ccy", "code"); Assert.AreEqual("ZAR", (string)ccy[0, 0]); }
public void ObjectViewer_ViewObjectPropertyValue_OneLevel() { var notionals = ObjectViewer.ViewObjectPropertyValue(_swap, "notionals", null); Assert.AreEqual(8, notionals.GetLength(0)); }
public void ObjectViewer_ViewObjectPropertyNames_GetAllNonIgnore() { var fields = ObjectViewer.ViewObjectPropertyNames(_swap); Assert.AreEqual(9, fields.Length); }
public VisualStructureViewerWindow () { Title = "Visual structure viewer"; if (File.Exists (xaml_file_name)) xaml_text_box.Text = new StreamReader (xaml_file_name).ReadToEnd (); else xaml_text_box.Text = @"<theme:ScrollChrome xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" xmlns:theme=""clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna"" theme:ScrollGlyph=""DownArrow"" Width=""100"" Height=""100""/>"; xaml_text_box.TextWrapping = TextWrapping.Wrap; Label xaml_label = new Label ("_XAML", xaml_text_box); DockPanel xaml_panel = new DockPanel (); DockPanel.SetDock (xaml_label, Dock.Top); xaml_panel.Children.Add (xaml_label); xaml_panel.Children.Add (xaml_text_box); #if PropertyGrid System.Windows.Forms.PropertyGrid structure_viewer_property_grid = new System.Windows.Forms.PropertyGrid(); structure_viewer_property_grid.Dock = System.Windows.Forms.DockStyle.Fill; System.Windows.Forms.Integration.WindowsFormsHost structure_viewer_host = new System.Windows.Forms.Integration.WindowsFormsHost(); structure_viewer_host.Child = structure_viewer_property_grid; Label structure_viewer_label = new Label("_Structure", structure_viewer_host); StackPanel structure_viewer_panel = new StackPanel(); structure_viewer_panel.Children.Add(structure_viewer_label); structure_viewer_panel.Children.Add(structure_viewer_host); #else ObjectViewer structure_viewer = new ObjectViewer (); Label structure_viewer_label = new Label ("_Structure", structure_viewer); DockPanel structure_viewer_panel = new DockPanel (); DockPanel.SetDock (structure_viewer_label, Dock.Top); structure_viewer_panel.Children.Add (structure_viewer_label); structure_viewer_panel.Children.Add (structure_viewer); #endif Button view_button = new Button (); view_button.Content = "_View"; view_button.Click += delegate (object sender, RoutedEventArgs e) { try { Visual content = (Visual)XamlReader.Load (new MemoryStream (Encoding.UTF8.GetBytes (xaml_text_box.Text))); Window window = new Window (); window.Content = content; window.Title = "Content"; window.Show (); #if PropertyGrid structure_viewer_property_grid.SelectedObject = VisualTreeHelper.GetDrawing(content); #else structure_viewer.Object = VisualTreeHelper.GetDrawing (content); #endif } catch (Exception ex) { MessageBox.Show (ex.Message + Environment.NewLine + ex.StackTrace, "Exception", MessageBoxButton.OK, MessageBoxImage.Error); } }; Grid contents = new Grid (); contents.RowDefinitions.Add (new RowDefinition ()); RowDefinition view_row = new RowDefinition (); view_row.Height = GridLength.Auto; contents.RowDefinitions.Add (view_row); contents.ColumnDefinitions.Add (new ColumnDefinition ()); contents.ColumnDefinitions.Add (new ColumnDefinition ()); contents.Children.Add (xaml_panel); Grid.SetColumn (structure_viewer_panel, 1); Grid.SetRowSpan (structure_viewer_panel, 2); contents.Children.Add (structure_viewer_panel); Grid.SetRow (view_button, 1); contents.Children.Add (view_button); GridSplitter splitter = new GridSplitter (); splitter.HorizontalAlignment = HorizontalAlignment.Right; splitter.VerticalAlignment = VerticalAlignment.Stretch; splitter.Width = 10; contents.Children.Add (splitter); Content = contents; }
public VisualStructureViewerWindow() { Title = "Visual structure viewer"; if (File.Exists(xaml_file_name)) { xaml_text_box.Text = new StreamReader(xaml_file_name).ReadToEnd(); } else { xaml_text_box.Text = @"<theme:ScrollChrome xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" xmlns:theme=""clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Luna"" theme:ScrollGlyph=""DownArrow"" Width=""100"" Height=""100""/>"; } xaml_text_box.TextWrapping = TextWrapping.Wrap; Label xaml_label = new Label("_XAML", xaml_text_box); DockPanel xaml_panel = new DockPanel(); DockPanel.SetDock(xaml_label, Dock.Top); xaml_panel.Children.Add(xaml_label); xaml_panel.Children.Add(xaml_text_box); #if PropertyGrid System.Windows.Forms.PropertyGrid structure_viewer_property_grid = new System.Windows.Forms.PropertyGrid(); structure_viewer_property_grid.Dock = System.Windows.Forms.DockStyle.Fill; System.Windows.Forms.Integration.WindowsFormsHost structure_viewer_host = new System.Windows.Forms.Integration.WindowsFormsHost(); structure_viewer_host.Child = structure_viewer_property_grid; Label structure_viewer_label = new Label("_Structure", structure_viewer_host); StackPanel structure_viewer_panel = new StackPanel(); structure_viewer_panel.Children.Add(structure_viewer_label); structure_viewer_panel.Children.Add(structure_viewer_host); #else ObjectViewer structure_viewer = new ObjectViewer(); Label structure_viewer_label = new Label("_Structure", structure_viewer); DockPanel structure_viewer_panel = new DockPanel(); DockPanel.SetDock(structure_viewer_label, Dock.Top); structure_viewer_panel.Children.Add(structure_viewer_label); structure_viewer_panel.Children.Add(structure_viewer); #endif Button view_button = new Button(); view_button.Content = "_View"; view_button.Click += delegate(object sender, RoutedEventArgs e) { try { Visual content = (Visual)XamlReader.Load(new MemoryStream(Encoding.UTF8.GetBytes(xaml_text_box.Text))); Window window = new Window(); window.Content = content; window.Title = "Content"; window.Show(); #if PropertyGrid structure_viewer_property_grid.SelectedObject = VisualTreeHelper.GetDrawing(content); #else structure_viewer.Object = VisualTreeHelper.GetDrawing(content); #endif } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace, "Exception", MessageBoxButton.OK, MessageBoxImage.Error); } }; Grid contents = new Grid(); contents.RowDefinitions.Add(new RowDefinition()); RowDefinition view_row = new RowDefinition(); view_row.Height = GridLength.Auto; contents.RowDefinitions.Add(view_row); contents.ColumnDefinitions.Add(new ColumnDefinition()); contents.ColumnDefinitions.Add(new ColumnDefinition()); contents.Children.Add(xaml_panel); Grid.SetColumn(structure_viewer_panel, 1); Grid.SetRowSpan(structure_viewer_panel, 2); contents.Children.Add(structure_viewer_panel); Grid.SetRow(view_button, 1); contents.Children.Add(view_button); GridSplitter splitter = new GridSplitter(); splitter.HorizontalAlignment = HorizontalAlignment.Right; splitter.VerticalAlignment = VerticalAlignment.Stretch; splitter.Width = 10; contents.Children.Add(splitter); Content = contents; }