protected override void Dispose(bool disposing) { if (disposing) { try { base.SuspendLayout(); Application.RemoveMessageFilter(this); if (this.layoutEventHandler != null) { this.Idle -= this.layoutEventHandler; this.layoutEventHandler = null; } if (this.ensureVisibleEventHandler != null) { this.Idle -= this.ensureVisibleEventHandler; this.ensureVisibleEventHandler = null; } if (this.idleEventHandler != null) { this.idleEventListeners = null; Form topLevelControl = base.TopLevelControl as Form; if (!Application.MessageLoop || ((topLevelControl != null) && topLevelControl.Modal)) { WorkflowTimer.Default.Unsubscribe(this.idleEventHandler); } else { Application.Idle -= this.idleEventHandler; } this.idleEventHandler = null; } ISelectionService service = this.GetService(typeof(ISelectionService)) as ISelectionService; if (service != null) { service.SelectionChanged -= new EventHandler(this.OnSelectionChanged); } WorkflowTheme.ThemeChanged -= new EventHandler(this.OnThemeChange); if (this.fitAllAction != null) { this.fitAllAction.Dispose(); this.fitAllAction = null; } if (this.workflowToolTip != null) { ((IDisposable) this.workflowToolTip).Dispose(); this.workflowToolTip = null; } this.DisposeMessageFilters(false); this.DisposeMessageFilters(true); this.activeLayout = null; if (this.defaultLayout != null) { this.defaultLayout.Dispose(); this.defaultLayout = null; } if (this.viewPortBitmap != null) { this.viewPortBitmap.Dispose(); this.viewPortBitmap = null; } if (this.commandSet != null) { this.commandSet.Dispose(); this.commandSet = null; } this.HScrollBar.ValueChanged -= new EventHandler(this.OnScroll); this.VScrollBar.ValueChanged -= new EventHandler(this.OnScroll); if (this.toolContainer != null) { base.Controls.Remove(this.toolContainer); this.toolContainer.TabStrip.Tabs.Clear(); this.toolContainer.Dispose(); this.toolContainer = null; } IServiceContainer container = this.GetService(typeof(IServiceContainer)) as IServiceContainer; if (container != null) { container.RemoveService(typeof(WorkflowView)); } } finally { base.ResumeLayout(false); } } base.Dispose(disposing); }
public override void Update(Graphics graphics, WorkflowLayout.LayoutUpdateReason reason) { }
protected override void Dispose(bool disposing) { //Remove the proffered services if (disposing) { try { SuspendLayout(); Application.RemoveMessageFilter(this); if (this.layoutEventHandler != null) { Idle -= this.layoutEventHandler; this.layoutEventHandler = null; } if (this.ensureVisibleEventHandler != null) { Idle -= this.ensureVisibleEventHandler; this.ensureVisibleEventHandler = null; } if (this.idleEventHandler != null) { this.idleEventListeners = null; Form host = TopLevelControl as Form; if (!Application.MessageLoop || (host != null && host.Modal)) WorkflowTimer.Default.Unsubscribe(this.idleEventHandler); else Application.Idle -= this.idleEventHandler; this.idleEventHandler = null; } ISelectionService selectionService = GetService(typeof(ISelectionService)) as ISelectionService; if (selectionService != null) selectionService.SelectionChanged -= new EventHandler(OnSelectionChanged); //Unsubscribe the theme change WorkflowTheme.ThemeChanged -= new EventHandler(OnThemeChange); //Remove the dynamic action if (this.fitAllAction != null) { this.fitAllAction.Dispose(); this.fitAllAction = null; } if (this.workflowToolTip != null) { ((IDisposable)this.workflowToolTip).Dispose(); this.workflowToolTip = null; } DisposeMessageFilters(false); DisposeMessageFilters(true); //Dispose the layouts this.activeLayout = null; if (this.defaultLayout != null) { this.defaultLayout.Dispose(); this.defaultLayout = null; } //Destroy other resources if (this.viewPortBitmap != null) { this.viewPortBitmap.Dispose(); this.viewPortBitmap = null; } if (this.commandSet != null) { this.commandSet.Dispose(); this.commandSet = null; } HScrollBar.ValueChanged -= new EventHandler(OnScroll); VScrollBar.ValueChanged -= new EventHandler(OnScroll); if (this.toolContainer != null) { Controls.Remove(this.toolContainer); this.toolContainer.TabStrip.Tabs.Clear(); this.toolContainer.Dispose(); this.toolContainer = null; } IServiceContainer serviceContainer = GetService(typeof(IServiceContainer)) as IServiceContainer; if (serviceContainer != null) { serviceContainer.RemoveService(typeof(WorkflowView)); } } finally { ResumeLayout(false); } } base.Dispose(disposing); }
public override void Update(Graphics graphics, WorkflowLayout.LayoutUpdateReason reason) { if (reason != WorkflowLayout.LayoutUpdateReason.ZoomChanged) { Size size5; if (graphics == null) { throw new ArgumentException("graphics"); } Size margin = WorkflowTheme.CurrentTheme.AmbientTheme.Margin; Size paperSize = this.GetPaperSize(graphics); Margins adjustedMargins = this.GetAdjustedMargins(graphics); Size size2 = (base.parentView.RootDesigner != null) ? base.parentView.RootDesigner.Size : Size.Empty; if (!size2.IsEmpty) { Size selectionSize = WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize; size2.Width += 3 * selectionSize.Width; size2.Height += 3 * selectionSize.Height; } if (this.printDocument.PageSetupData.AdjustToScaleFactor) { this.scaling = ((float) this.printDocument.PageSetupData.ScaleFactor) / 100f; } else { Size size4; size4 = new Size(paperSize.Width - (adjustedMargins.Left + adjustedMargins.Right), paperSize.Height - (adjustedMargins.Top + adjustedMargins.Bottom)) { Width = Math.Max(size4.Width, 1), Height = Math.Max(size4.Height, 1) }; PointF tf = new PointF((this.printDocument.PageSetupData.PagesWide * size4.Width) / ((float) size2.Width), (this.printDocument.PageSetupData.PagesTall * size4.Height) / ((float) size2.Height)); this.scaling = Math.Min(tf.X, tf.Y); this.scaling = (float) (Math.Floor((double) (this.scaling * 1000.0)) / 1000.0); } this.pageSize = paperSize; this.pageSize.Width = Convert.ToInt32(Math.Ceiling((double) (((float) this.pageSize.Width) / this.scaling))); this.pageSize.Height = Convert.ToInt32(Math.Ceiling((double) (((float) this.pageSize.Height) / this.scaling))); IDesignerOptionService service = base.serviceProvider.GetService(typeof(IDesignerOptionService)) as IDesignerOptionService; if (service != null) { object optionValue = service.GetOptionValue("WinOEDesigner", "PageSeparator"); this.PageSeparator = (optionValue != null) ? ((Size) optionValue) : DefaultPageSeparator; } this.PageSeparator = new Size(Convert.ToInt32(Math.Ceiling((double) (((float) this.PageSeparator.Width) / this.scaling))), Convert.ToInt32(Math.Ceiling((double) (((float) this.PageSeparator.Height) / this.scaling)))); this.PageMargins = adjustedMargins; this.PageMargins.Left = Convert.ToInt32((float) (((float) this.PageMargins.Left) / this.scaling)); this.PageMargins.Right = Convert.ToInt32((float) (((float) this.PageMargins.Right) / this.scaling)); this.PageMargins.Top = Convert.ToInt32((float) (((float) this.PageMargins.Top) / this.scaling)); this.PageMargins.Bottom = Convert.ToInt32((float) (((float) this.PageMargins.Bottom) / this.scaling)); this.headerFooterMargins.Top = Convert.ToInt32((float) (((float) this.printDocument.PageSetupData.HeaderMargin) / this.scaling)); this.headerFooterMargins.Bottom = Convert.ToInt32((float) (((float) this.printDocument.PageSetupData.FooterMargin) / this.scaling)); this.previewTime = DateTime.Now; size5 = new Size(this.pageSize.Width - (this.PageMargins.Left + this.PageMargins.Right), this.pageSize.Height - (this.PageMargins.Top + this.PageMargins.Bottom)) { Width = Math.Max(size5.Width, 1), Height = Math.Max(size5.Height, 1) }; this.rowColumns.Width = size2.Width / size5.Width; this.rowColumns.Width += ((size2.Width % size5.Width) > 1) ? 1 : 0; this.rowColumns.Width = Math.Max(1, this.rowColumns.Width); this.rowColumns.Height = size2.Height / size5.Height; this.rowColumns.Height += ((size2.Height % size5.Height) > 1) ? 1 : 0; this.rowColumns.Height = Math.Max(1, this.rowColumns.Height); this.pageLayoutInfo.Clear(); for (int i = 0; i < this.rowColumns.Height; i++) { for (int j = 0; j < this.rowColumns.Width; j++) { Point empty = Point.Empty; empty.X = (j * this.pageSize.Width) + ((j + 1) * this.PageSeparator.Width); empty.Y = (i * this.pageSize.Height) + ((i + 1) * this.PageSeparator.Height); Point location = Point.Empty; location.X = empty.X + this.PageMargins.Left; location.Y = empty.Y + this.PageMargins.Top; Rectangle logicalPageBounds = new Rectangle(j * size5.Width, i * size5.Height, size5.Width, size5.Height); Rectangle pageBounds = new Rectangle(empty, this.pageSize); Rectangle viewablePageBounds = new Rectangle(location, size5); this.pageLayoutInfo.Add(new PageLayoutData(logicalPageBounds, pageBounds, viewablePageBounds, new Point(j, i))); } } } }