/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { // Dispose managed resources here. if (m_draftForm != null) { m_draftForm.Dispose(); } if (m_IgnorePropChanged != null) { m_IgnorePropChanged.Dispose(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_draftForm = null; m_draftView = null; // Comes from m_draftForm, which is to dispose it. m_group = null; m_IgnorePropChanged = null; base.Dispose(disposing); }
public void TestCastAsIVwRootSiteWhenGroupIsEmpty() { using (RootSiteGroup group = new RootSiteGroup()) { Assert.IsNull(group.CastAsIVwRootSite()); } }
public override void Exit() { CheckDisposed(); m_draftView = null; m_draftForm.Close(); m_draftForm = null; m_group = null; m_IgnorePropChanged.Dispose(); m_IgnorePropChanged = null; // Restore prompt setting m_IgnorePropChanged.Dispose(); base.Exit(); }
public override void Initialize() { CheckDisposed(); base.Initialize(); m_draftForm = new DummyDraftViewForm(); m_draftForm.DeleteRegistryKey(); m_group = m_draftForm.CreateSyncDraftView(Cache); m_IgnorePropChanged = new IgnorePropChanged(Cache, PropChangedHandling.SuppressChangeWatcher); m_draftView = m_draftForm.DraftView; m_draftView.RootBox.MakeSimpleSel(true, true, false, true); Application.DoEvents(); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Creates 2 sync'd draftviews in a form. Loads scripture from the DB. /// </summary> /// <param name="cache">The cache, believe it or not</param> /// ----------------------------------------------------------------------------------- public RootSiteGroup CreateSyncDraftView(FdoCache cache) { CheckDisposed(); Cache = cache; RootSiteGroup group = new RootSiteGroup(cache, (int)TeViewGroup.Scripture); DummyDraftView draft1 = CreateDummyDraftView(false, false); m_draftView = CreateDummyDraftView(false, false); group.AddToSyncGroup(draft1); group.AddToSyncGroup(m_draftView); group.ScrollingController = m_draftView; draft1.MakeRoot(); draft1.Visible = true; m_draftView.MakeRoot(); m_draftView.Visible = true; Controls.Add(group); group.Show(); return(group); }
/// <summary/> public override void TestTearDown() { m_group.Dispose(); m_group = null; base.TestTearDown(); }
public override void TestSetup() { base.TestSetup(); m_group = m_draftForm.CreateSyncDraftView(Cache); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:SplitGrid"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="columns">The number of columns.</param> /// <param name="rows">The number of rows.</param> /// ------------------------------------------------------------------------------------ public SplitGrid(FdoCache cache, IVwStylesheet styleSheet, int rows, int columns) { m_cache = cache; m_StyleSheet = styleSheet; m_grid = CreateDataGridView(); m_defaultGroup = new RootSiteGroup(this); m_groups.Add(m_defaultGroup); m_activeViewHelper = new ActiveViewHelper(this); BorderStyle = BorderStyle.None; SuspendLayout(); m_grid.Dock = DockStyle.Fill; m_grid.BackgroundColor = SystemColors.Control; m_grid.BorderStyle = BorderStyle.None; m_grid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; m_grid.SelectionMode = DataGridViewSelectionMode.CellSelect; m_grid.RowHeadersVisible = false; m_grid.ColumnHeadersVisible = false; m_grid.AllowUserToAddRows = false; m_grid.AllowUserToDeleteRows = false; m_grid.AllowUserToOrderColumns = false; m_grid.AdvancedCellBorderStyle.All = DataGridViewAdvancedCellBorderStyle.Outset; m_grid.AdvancedCellBorderStyle.Top = DataGridViewAdvancedCellBorderStyle.None; m_grid.ScrollBars = ScrollBars.None; m_grid.RowStateChanged += new DataGridViewRowStateChangedEventHandler(OnRowStateChanged); m_grid.ColumnStateChanged += new DataGridViewColumnStateChangedEventHandler(OnColumnStateChanged); m_grid.MouseDown += new MouseEventHandler(OnGridMouseDown); m_grid.MouseUp += new MouseEventHandler(OnGridMouseUp); m_grid.RowTemplate = new DataGridViewControlRow(); for (int i = 0; i < columns; i++) { DataGridViewControlColumn column = new DataGridViewControlColumn(i == columns - 1); m_grid.Columns.Add(column); } m_MaxRows = rows; Controls.Add(m_grid); ResumeLayout(true); m_grid.BringToFront(); Visible = false; }
public void AdjustScrollRange() { DynamicMock rootBox = new DynamicMock(typeof(IVwRootBox)); // This was taken out because it doesn't seem like the views code does this // anymore. It just calls AdjustScrollRange for the original view that changed. // Done as a part of TE-3576 //// result for style pane //rootBox.ExpectAndReturn("Height", 900); //rootBox.ExpectAndReturn("Width", 100); //rootBox.ExpectAndReturn("Height", 1000); //rootBox.ExpectAndReturn("Width", 100); //rootBox.ExpectAndReturn("Height", 1000); //rootBox.ExpectAndReturn("Width", 100); //// result for draft pane //rootBox.ExpectAndReturn("Height", 950); //rootBox.ExpectAndReturn("Width", 100); //rootBox.ExpectAndReturn("Height", 900); //rootBox.ExpectAndReturn("Width", 100); //rootBox.ExpectAndReturn("Height", 1000); //rootBox.ExpectAndReturn("Width", 100); // result for bt pane rootBox.ExpectAndReturn("Height", 1100); rootBox.ExpectAndReturn("Width", 100); rootBox.ExpectAndReturn("Height", 900); rootBox.ExpectAndReturn("Width", 100); rootBox.ExpectAndReturn("Height", 950); rootBox.ExpectAndReturn("Width", 100); using (DummyBasicView stylePane = new DummyBasicView(), draftPane = new DummyBasicView(), btPane = new DummyBasicView()) { using (RootSiteGroup group = new RootSiteGroup()) { PrepareView(stylePane, 50, 300, (IVwRootBox)rootBox.MockInstance); PrepareView(draftPane, 150, 300, (IVwRootBox)rootBox.MockInstance); PrepareView(btPane, 150, 300, (IVwRootBox)rootBox.MockInstance); group.AddToSyncGroup(stylePane); group.AddToSyncGroup(draftPane); group.AddToSyncGroup(btPane); group.ScrollingController = btPane; group.Controls.AddRange(new Control[] { stylePane, draftPane, btPane }); btPane.ScrollMinSize = new Size(100, 1000); btPane.ScrollPosition = new Point(0, 700); // now call AdjustScrollRange on each of the panes. // This simulates what the views code does. // This was taken out because it doesn't seem like the views code does this // anymore. It just calls AdjustScrollRange for the original view that changed. // Done as a part of TE-3576 //stylePane.AdjustScrollRange(null, 0, 0, -100, 500); //draftPane.AdjustScrollRange(null, 0, 0, -50, 500); btPane.AdjustScrollRange(null, 0, 0, 100, 500); Assert.AreEqual(1108, btPane.ScrollMinSize.Height, "Wrong ScrollMinSize"); Assert.AreEqual(800, -btPane.ScrollPosition.Y, "Wrong scroll position"); } } }