Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="group"></param>
        /// <param name="location"></param>
        /// <param name="temporaryColleagueParam"></param>
        /// <param name="sequencer"></param>
        public void ShowContextMenu(ChoiceGroup group, Point location,
                                    TemporaryColleagueParameter temporaryColleagueParam,
                                    MessageSequencer sequencer)
        {
            // Store optional parameter values.
            m_temporaryColleagueParam = temporaryColleagueParam; // Nulls are just fine.
            m_sequencer = sequencer;                             // Nulls are just fine.

            // TODO-Linux FWNX-345: Review - don't use TemporaryColleague's
            // This needs to be done before PopulateNow
            if (m_temporaryColleagueParam != null)
            {
                m_temporaryColleagueParam.Mediator.AddTemporaryColleague(m_temporaryColleagueParam.TemporaryColleague);
            }

            // item is used in calling CreateUIForChoiceGroup to attach the choiceGroup
            // menu items to. It is not added to the shown contextMenu.
            ToolStripMenuItem item = new ToolStripMenuItem();

            item.Tag = group;
            group.ReferenceWidget = item;
            group.PopulateNow();
            CreateUIForChoiceGroup(group);

            var contextMenu = new ContextMenuStrip();

            foreach (ToolStripMenuItem menuItem  in item.DropDown.Items)
            {
                contextMenu.Items.Add(menuItem as ToolStripMenuItem);
            }

            contextMenu.Show(location);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="group"></param>
        /// <param name="location"></param>
        /// <param name="temporaryColleagueParam"></param>
        /// <param name="sequencer"></param>
        public void ShowContextMenu(ChoiceGroup group, Point location,
                                    TemporaryColleagueParameter temporaryColleagueParam,
                                    MessageSequencer sequencer)
        {
            // Store optional parameter values.
            m_TemporaryColleagueParameter = temporaryColleagueParam;             // Nulls are just fine.

            // TODO-Linux FWNX-345: Review - don't use TemporaryColleague's
            // This needs to be done before PopulateNow
            if (m_TemporaryColleagueParameter != null)
            {
                m_TemporaryColleagueParameter.Mediator.AddTemporaryColleague(m_TemporaryColleagueParameter.TemporaryColleague);
            }

            // item is used in calling CreateUIForChoiceGroup to attach the choiceGroup
            // menu items to. It is not added to the shown contextMenu.
            ToolStripMenuItem item = new ToolStripMenuItem();

            item.AccessibilityObject.Name = group.Id;
            //item.GetType().Name;
            item.Tag = group;
            group.ReferenceWidget = item;
            group.PopulateNow();
            CreateUIForChoiceGroup(group);

            // NOTE: we intentionally leave contextMenu undisposed. If we dispose it after
            // contextMenu.Show then the mouse clicks on the menu items don't get handled.
            // We would have to add an Application.DoEvents() after the Show (which might
            // causes other problems), or implement IDisposable.
            var contextMenu = new ContextMenuStrip();

            contextMenu.AccessibilityObject.Name = group.Id;

            // Without building this collection first, somehow we modify the Items collection while
            // iterating.
            var items = new System.Collections.Generic.List <ToolStripItem>();

            foreach (var menuItem in item.DropDown.Items)
            {
                if (menuItem is ToolStripMenuItem)
                {
                    items.Add(menuItem as ToolStripMenuItem);
                }
                else if (menuItem is ToolStripButton)
                {
                    items.Add(menuItem as ToolStripButton);
                }
                else if (menuItem is ToolStripSeparator)
                {
                    items.Add(menuItem as ToolStripSeparator);
                }
            }
            foreach (var menuItem in items)
            {
                contextMenu.Items.Add(menuItem);
            }
            MakeAcceleratorsVisible(contextMenu);
            contextMenu.Show(location);
        }
Ejemplo n.º 3
0
 /// <summary/>
 protected override void Dispose(bool release_all)
 {
     if (release_all)
     {
         m_messageSequencer.Dispose();
     }
     m_messageSequencer = null;
     base.Dispose(release_all);
 }
Ejemplo n.º 4
0
        //from IUIMenuAdapter
//		public ContextMenu MakeContextMenu (ChoiceGroup group)
//		{
//			CommandBarContextMenu menu= new CommandBarContextMenu();
//			menu.Tag = group;
//			group.ReferenceWidget = menu;
//			menu.Popup += new System.EventHandler(group.OnDisplay);
//
//			return (ContextMenu)menu;
//		}

        public void ShowContextMenu(ChoiceGroup group, Point location,
                                    TemporaryColleagueParameter temporaryColleagueParam,
                                    MessageSequencer sequencer)
        {
            using (CommandBarContextMenu menu = new CommandBarContextMenu())
            {
                menu.Tag = group;
                group.ReferenceWidget = menu;
                menu.Popup           += new System.EventHandler(group.OnDisplay);

                // Pre-menu process two optional paremeters.
                if (temporaryColleagueParam != null)
                {
                    temporaryColleagueParam.Mediator.AddColleague(temporaryColleagueParam.TemporaryColleague);
                }
                bool resume = false;
                if (sequencer != null)
                {
                    resume = sequencer.PauseMessageQueueing();
                }

                // NB: This is *always* modal, as it doesn't return until it closes.
                menu.Show(null, location);

                // Post-menu process two optional paremeters.s
                if (temporaryColleagueParam != null)
                {
                    IxCoreColleague colleague = temporaryColleagueParam.TemporaryColleague;
                    temporaryColleagueParam.Mediator.RemoveColleague(colleague);
                    if (temporaryColleagueParam.ShouldDispose && colleague is IDisposable)
                    {
                        (colleague as IDisposable).Dispose();
                    }
                }
                if (sequencer != null && resume)
                {
                    sequencer.ResumeMessageQueueing();
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="group"></param>
        /// <param name="location"></param>
        /// <param name="temporaryColleagueParam"></param>
        /// <param name="sequencer"></param>
        public void ShowContextMenu(ChoiceGroup group, Point location,
                                    TemporaryColleagueParameter temporaryColleagueParam,
                                    MessageSequencer sequencer)
        {
            // Store optional parameter values.
            m_temporaryColleagueParam = temporaryColleagueParam; // Nulls are just fine.
            m_sequencer = sequencer;                             // Nulls are just fine.

            ButtonItem b = new ButtonItem();

            b.PopupType = DevComponents.DotNetBar.ePopupType.Menu;
            //ContextMenu menu = new ContextMenu();

            b.Tag = group;
            group.ReferenceWidget = b;
            b.SubItems.Add(new ButtonItem("just to make popup happen"));

            Manager.RegisterPopup(b);
            // This will be populated when this event fires, just to make it parallel to how menubar menus work.
            b.PopupOpen += new DevComponents.DotNetBar.DotNetBarManager.PopupOpenEventHandler(menu_PopupOpen);
            // It's too early to remove the temporary colleague, even in these event handlers,
            // since the Mediator hasn't invoked anything on it yet.
            // b.PopupClose += new EventHandler(OnContextMenuClose);
            // b.PopupFinalized += new EventHandler(b_PopupFinalized);

            // 'b' is not modal, so if we have either a temporaryColleagueParam,
            // or a sequecner, or both, we need to preprocess them, before showing the menu.
            // We also need to do some post-processing with them, after the menu closes.
            // That is done in the OnContextMenuClose handler.
            if (m_temporaryColleagueParam != null)
            {
                m_temporaryColleagueParam.Mediator.AddTemporaryColleague(m_temporaryColleagueParam.TemporaryColleague);
            }
            m_sequencerIsPaused = false;
            //if (m_sequencer != null)
            //	m_sequencerIsPaused = m_sequencer.PauseMessageQueueing();

            b.Popup(location.X, location.Y);
        }
Ejemplo n.º 6
0
		/// <summary>
		/// Get a context menu for the specified menu id, and in addition.
		/// </summary>
		/// <param name="menuId"></param>
		/// <param name="group"></param>
		/// <param name="actModal">don't return until the popup is closed</param>
		/// <returns></returns>
		public void ShowContextMenu(string menuId, Point location,
			TemporaryColleagueParameter temporaryColleagueParam,
			MessageSequencer sequencer, Action<ContextMenuStrip> adjustMenu)
		{
			CheckDisposed();

			ChoiceGroup group = GetChoiceGroupForMenu(menuId);
			((IUIMenuAdapter)m_menuBarAdapter).ShowContextMenu(group, location, temporaryColleagueParam, sequencer, adjustMenu);
		}
Ejemplo n.º 7
0
		/// <summary>
		/// Get a context menu for the specified menu id, and in addition.
		/// </summary>
		/// <param name="menuId"></param>
		/// <param name="group"></param>
		/// <param name="actModal">don't return until the popup is closed</param>
		/// <returns></returns>
		public void ShowContextMenu(string menuId, Point location,
			TemporaryColleagueParameter temporaryColleagueParam,
			MessageSequencer sequencer)
		{
			ShowContextMenu(menuId, location, temporaryColleagueParam, sequencer, null);
		}
Ejemplo n.º 8
0
		/// <summary>
		///
		/// </summary>
		public TestControl1()
		{
			m_messageSequencer = new MessageSequencer(this);
		}
Ejemplo n.º 9
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:PublicationControl"/> class with
		/// no divisions.
		/// </summary>
		/// <param name="stylesheet">The stylesheet.</param>
		/// <param name="publication">The publication that this PublicationControl gets
		/// it's information from (or null to keep the defaults)</param>
		/// <param name="printDateTime">The print date time.</param>
		/// <param name="fApplyStyleOverrides">if set to <c>true</c>, apply style overrides.</param>
		/// <param name="fUniformLineSpacing">if set to <c>true</c> apply uniform line spacing,
		/// rather than proportional spacing.</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// ------------------------------------------------------------------------------------
		public PublicationControl(FwStyleSheet stylesheet, IPublication publication,
			DateTime printDateTime, bool fApplyStyleOverrides, bool fUniformLineSpacing,
			IHelpTopicProvider helpTopicProvider)
		{
			m_origStylesheet = stylesheet;
			if (publication != null) // Can be null in tests
				m_cache = publication.Cache;
			m_publication = publication;
			m_printDateTime = printDateTime;
			m_fApplyStyleOverrides = fApplyStyleOverrides;
			m_fUniformLineSpacing = fUniformLineSpacing;
			m_helpTopicProvider = helpTopicProvider;

			AutoScroll = true;
			BackColor = SystemColors.Window;
			components = new System.ComponentModel.Container();
			m_Timer = new Timer(this.components);
			m_sequencer = new MessageSequencer(this);

			SetInfoFromDB();

			PrinterUtils.GetDefaultPrinterDPI(out m_printerDpiX, out m_printerDpiY);
			m_screenGraphics = new GraphicsManager(this);
			m_printerGraphics = new GraphicsManager(this);

			// If view overrides the stylesheet
			if (fApplyStyleOverrides)
			{
				m_origStylesheet.InitStylesheet += new EventHandler(OnInitOriginalStylesheet);

				ApplyPubOverrides();
			}
			else
				m_stylesheet = m_origStylesheet;
		}
Ejemplo n.º 10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="group"></param>
        /// <param name="location"></param>
        /// <param name="temporaryColleagueParam"></param>
        /// <param name="sequencer"></param>
        public void ShowContextMenu(ChoiceGroup group, Point location,
			TemporaryColleagueParameter temporaryColleagueParam,
			MessageSequencer sequencer)
        {
            // Store optional parameter values.
            m_TemporaryColleagueParameter = temporaryColleagueParam; // Nulls are just fine.

            // TODO-Linux FWNX-345: Review - don't use TemporaryColleague's
            // This needs to be done before PopulateNow
            if (m_TemporaryColleagueParameter != null)
                m_TemporaryColleagueParameter.Mediator.AddTemporaryColleague(m_TemporaryColleagueParameter.TemporaryColleague);

            // item is used in calling CreateUIForChoiceGroup to attach the choiceGroup
            // menu items to. It is not added to the shown contextMenu.
            ToolStripMenuItem item = new ToolStripMenuItem();
            item.AccessibilityObject.Name = group.Id;
                //item.GetType().Name;
            item.Tag = group;
            group.ReferenceWidget = item;
            group.PopulateNow();
            CreateUIForChoiceGroup(group);

            // NOTE: we intentionally leave contextMenu undisposed. If we dispose it after
            // contextMenu.Show then the mouse clicks on the menu items don't get handled.
            // We would have to add an Application.DoEvents() after the Show (which might
            // causes other problems), or implement IDisposable.
            var contextMenu = new ContextMenuStrip();
            contextMenu.AccessibilityObject.Name = group.Id;

            // Without building this collection first, somehow we modify the Items collection while
            // iterating.
            var items = new System.Collections.Generic.List<ToolStripItem>();
            foreach (var menuItem in item.DropDown.Items)
            {
                if (menuItem is ToolStripMenuItem )
                    items.Add(menuItem as ToolStripMenuItem);
                else if ( menuItem is ToolStripButton)
                    items.Add(menuItem as ToolStripButton);
                else if (menuItem is ToolStripSeparator)
                    items.Add(menuItem as ToolStripSeparator);
            }
            foreach (var menuItem in items)
            {
                contextMenu.Items.Add(menuItem);
            }
            MakeAcceleratorsVisible(contextMenu);
            contextMenu.Show(location);
        }
Ejemplo n.º 11
0
		//from IUIMenuAdapter
//		public ContextMenu MakeContextMenu (ChoiceGroup group)
//		{
//			CommandBarContextMenu menu= new CommandBarContextMenu();
//			menu.Tag = group;
//			group.ReferenceWidget = menu;
//			menu.Popup += new System.EventHandler(group.OnDisplay);
//
//			return (ContextMenu)menu;
//		}

		public void ShowContextMenu(ChoiceGroup group, Point location,
			TemporaryColleagueParameter temporaryColleagueParam,
			MessageSequencer sequencer)
		{
			using (CommandBarContextMenu menu= new CommandBarContextMenu())
			{
				menu.Tag = group;
				group.ReferenceWidget = menu;
				menu.Popup += new System.EventHandler(group.OnDisplay);

				// Pre-menu process two optional paremeters.
				if (temporaryColleagueParam != null)
					temporaryColleagueParam.Mediator.AddColleague(temporaryColleagueParam.TemporaryColleague);
				bool resume = false;
				if (sequencer != null)
					resume = sequencer.PauseMessageQueueing();

				// NB: This is *always* modal, as it doesn't return until it closes.
				menu.Show(null, location);

				// Post-menu process two optional paremeters.s
				if (temporaryColleagueParam != null)
				{
					IxCoreColleague colleague = temporaryColleagueParam.TemporaryColleague;
					temporaryColleagueParam.Mediator.RemoveColleague(colleague);
					if (temporaryColleagueParam.ShouldDispose && colleague is IDisposable)
						(colleague as IDisposable).Dispose();
				}
				if (sequencer != null && resume)
					sequencer.ResumeMessageQueueing();
			}
		}
Ejemplo n.º 12
0
 /// <summary>
 ///
 /// </summary>
 public TestControl1()
 {
     m_messageSequencer = new MessageSequencer(this);
 }
Ejemplo n.º 13
0
				/// <summary>
		///
		/// </summary>
		/// <param name="group"></param>
		/// <param name="location"></param>
		/// <param name="temporaryColleagueParam"></param>
		/// <param name="sequencer"></param>
		public void ShowContextMenu(ChoiceGroup group, Point location,
			TemporaryColleagueParameter temporaryColleagueParam,
			MessageSequencer sequencer)
		{
			ShowContextMenu(group, location, temporaryColleagueParam, sequencer, null);
		}
Ejemplo n.º 14
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		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)
			{
				// Do as early as possible, we don't want to do more spell checking while being disposed.
				Application.Idle -= new EventHandler(Application_Idle);
				// Do this here, before disposing m_messageSequencer,
				// as we still get messages during dispose.
				// Once the the base class has shut down the window handle,
				// we are good to go on.
				// If we find we getting messages during this call,
				// we will be forced to call DestroyHandle() first.
				// That is done part way through the base method code,
				// but it may not be soon enough, for all the re-entrant events
				// that keep showing up.
				DestroyHandle();
			}

			base.Dispose(disposing);

			if (disposing)
			{
				if (m_rootb != null)
					CloseRootBox();

				if (g_focusRootSite == this)
					g_focusRootSite = null;
				if (m_Timer != null)
				{
					m_Timer.Stop();
					m_Timer.Tick -= new EventHandler(OnTimer);
					m_Timer.Dispose();
				}

				// Remove the filter when we are disposed now.
				if (m_messageFilterInstalled)
				{
					Application.RemoveMessageFilter(this);
					m_messageFilterInstalled = false;
				}

				if (m_editingHelper != null)
					m_editingHelper.Dispose();
				if (m_messageSequencer != null)
					m_messageSequencer.Dispose();
				if (m_graphicsManager != null)
				{
					// Uninit() first in case we're in the middle of displaying something.  See LT-7365.
					m_graphicsManager.Uninit();
					m_graphicsManager.Dispose();
				}
				if (components != null)
					components.Dispose();
			}

			if (m_vdrb != null && Marshal.IsComObject(m_vdrb))
				Marshal.ReleaseComObject(m_vdrb);
			m_vdrb = null;
			if (m_styleSheet != null && Marshal.IsComObject(m_styleSheet))
				Marshal.ReleaseComObject(m_styleSheet);
			m_rootb = null;
			m_styleSheet = null;
			m_graphicsManager = null;
			m_editingHelper = null;
			m_Timer = null;
			m_mediator = null;
			m_wsf = null;
			m_styleSheet = null;
			m_savedSelection = null;
			m_messageSequencer = null;

			// Don't do it here.
			//base.Dispose( disposing );

			m_fDisposed = true;
		}
Ejemplo n.º 15
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public SimpleRootSite()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			m_dxdLayoutWidth = kForceLayout; // Unlikely to be real current window width!
			m_wsPending = -1;
			BackColor = SystemColors.Window;
			//AllowScrolling = true;
			m_messageSequencer = new MessageSequencer(this);
			m_graphicsManager = CreateGraphicsManager();
			m_orientationManager = CreateOrientationManager();
		}
Ejemplo n.º 16
0
 public void ShowContextMenu(ChoiceGroup @group, Point location, TemporaryColleagueParameter temporaryColleagueParam, MessageSequencer sequencer, Action <ContextMenuStrip> adjustMenu)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 17
0
		/// <summary>
		///
		/// </summary>
		/// <param name="group"></param>
		/// <param name="location"></param>
		/// <param name="temporaryColleagueParam"></param>
		/// <param name="sequencer"></param>
		public void ShowContextMenu(ChoiceGroup group, Point location,
			TemporaryColleagueParameter temporaryColleagueParam,
			MessageSequencer sequencer)
		{
			// Store optional parameter values.
			m_temporaryColleagueParam = temporaryColleagueParam; // Nulls are just fine.
			m_sequencer = sequencer; // Nulls are just fine.

			ButtonItem b = new ButtonItem();
			b.PopupType = DevComponents.DotNetBar.ePopupType.Menu;
			//ContextMenu menu = new ContextMenu();

			b.Tag = group;
			group.ReferenceWidget = b;
			b.SubItems.Add(new ButtonItem("just to make popup happen"));

			Manager.RegisterPopup(b);
			// This will be populated when this event fires, just to make it parallel to how menubar menus work.
			b.PopupOpen += new DevComponents.DotNetBar.DotNetBarManager.PopupOpenEventHandler(menu_PopupOpen);
			// It's too early to remove the temporary colleague, even in these event handlers,
			// since the Mediator hasn't invoked anything on it yet.
			// b.PopupClose += new EventHandler(OnContextMenuClose);
			// b.PopupFinalized += new EventHandler(b_PopupFinalized);

			// 'b' is not modal, so if we have either a temporaryColleagueParam,
			// or a sequecner, or both, we need to preprocess them, before showing the menu.
			// We also need to do some post-processing with them, after the menu closes.
			// That is done in the OnContextMenuClose handler.
			if (m_temporaryColleagueParam != null)
				m_temporaryColleagueParam.Mediator.AddTemporaryColleague(m_temporaryColleagueParam.TemporaryColleague);
			m_sequencerIsPaused = false;
			//if (m_sequencer != null)
			//	m_sequencerIsPaused = m_sequencer.PauseMessageQueueing();

			b.Popup(location.X, location.Y);
		}
Ejemplo n.º 18
0
		public void ShowContextMenu(ChoiceGroup @group, Point location, TemporaryColleagueParameter temporaryColleagueParam, MessageSequencer sequencer, Action<ContextMenuStrip> adjustMenu)
		{
			throw new NotImplementedException();
		}
Ejemplo n.º 19
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public SimpleRootSite()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			m_dxdLayoutWidth = kForceLayout; // Unlikely to be real current window width!
			m_wsPending = -1;
			BackColor = SystemColors.Window;
			//AllowScrolling = true;
			m_messageSequencer = new MessageSequencer(this);
			m_graphicsManager = CreateGraphicsManager();
			m_orientationManager = CreateOrientationManager();
			if (UIAutomationServerProviderFactory == null)
				UIAutomationServerProviderFactory = () => new SimpleRootSiteDataProvider(this);
			#if __MonoCS__
			KeyboardController.Register(this, new IbusRootSiteEventHandler(this));
			#endif
		}
Ejemplo n.º 20
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="group"></param>
 /// <param name="location"></param>
 /// <param name="temporaryColleagueParam"></param>
 /// <param name="sequencer"></param>
 public void ShowContextMenu(ChoiceGroup group, Point location,
                             TemporaryColleagueParameter temporaryColleagueParam,
                             MessageSequencer sequencer)
 {
     ShowContextMenu(group, location, temporaryColleagueParam, sequencer, null);
 }
Ejemplo n.º 21
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		protected override void Dispose(bool disposing)
		{
			Debug.WriteLineIf(!disposing, "****************** Missing Dispose() call for " + GetType().Name + "******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if (disposing)
			{
				// Do this here, before disposing m_messageSequencer,
				// as we still get messages during dispose.
				// Once the the base class has shut down the window handle,
				// we are good to go on.
				// If we find we getting messages during this call,
				// we will be forced to call DestroyHandle() first.
				// That is done part way through the base method code,
				// but it may not be soon enough, for all the re-entrant events
				// that keep showing up.
				m_fAllowLayout = false;
				DestroyHandle();
			}

			base.Dispose(disposing);

			if (disposing)
			{
				if (m_rootb != null)
					CloseRootBox();

				if (m_Timer != null)
				{
					m_Timer.Stop();
					m_Timer.Tick -= OnTimer;
					m_Timer.Dispose();
				}

				// Remove the filter when we are disposed now.
				if (m_messageFilterInstalled)
				{
					Application.RemoveMessageFilter(this);
					m_messageFilterInstalled = false;
				}

				if (m_editingHelper != null)
					m_editingHelper.Dispose();
				if (m_messageSequencer != null)
					m_messageSequencer.Dispose();
				if (m_graphicsManager != null)
				{
					// Uninit() first in case we're in the middle of displaying something.  See LT-7365.
					m_graphicsManager.Uninit();
					m_graphicsManager.Dispose();
				}
				if (components != null)
					components.Dispose();
				#if __MonoCS__
				KeyboardController.Unregister(this);
				#endif
			}

			if (m_vdrb != null && Marshal.IsComObject(m_vdrb))
				Marshal.ReleaseComObject(m_vdrb);
			m_vdrb = null;
			if (m_styleSheet != null && Marshal.IsComObject(m_styleSheet))
				Marshal.ReleaseComObject(m_styleSheet);
			if (m_rootb != null && Marshal.IsComObject(m_rootb))
				Marshal.ReleaseComObject(m_rootb);
			m_rootb = null;
			m_styleSheet = null;
			m_graphicsManager = null;
			m_editingHelper = null;
			m_Timer = null;
			m_mediator = null;
			m_wsf = null;
			m_messageSequencer = null;

			// Don't do it here.
			//base.Dispose( disposing );

			m_fDisposed = true;
		}
Ejemplo n.º 22
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Destroy all divisions and pages
		/// </summary>
		/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources;
		/// <c>false</c> to release only unmanaged resources.</param>
		/// ------------------------------------------------------------------------------------
		protected override void Dispose(bool disposing)
		{
			Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
			// Must not be run more than once. Also don't call again while we're still in here
			// (which will happen because base.Dispose() calls DestroyHandle which will call
			// this.Dispose.
			if (IsDisposed || Disposing)
				return;

			if( disposing )
			{
				if(components != null)
					components.Dispose();

				// Even if disposing is false, we still dispose of our pages and and divisions
				// to force their rootboxes to close.
				// NOTE from RandyR: No. If it is false,
				// then the other disposable stuff may have been finalized already,
				// and accessing those kinds of objects will throw exceptions.
				DisposePages();	// also calls m_pages.Clear();

				if (m_divisions != null)
				{
					foreach (DivisionLayoutMgr div in m_divisions)
						div.Dispose();
				}
				if (m_divisions != null)
					m_divisions.Clear();

				if (m_editingHelper != null)
					m_editingHelper.Dispose();

				if (m_sharedStreams != null)
				{
					foreach (IVwRootBox rootb in m_sharedStreams)
						rootb.Close();
				}

				if (m_screenGraphics != null)
					m_screenGraphics.Dispose();
				if (m_printerGraphics != null)
					m_printerGraphics.Dispose();
				if (m_Timer != null)
					m_Timer.Dispose();
			}
			m_divisions = null;
			m_sharedStreams = null;
			components = null;
			m_editingHelper = null;
			m_screenGraphics = null;
			m_printerGraphics = null;
			m_Timer = null;

			base.Dispose(disposing);

			if (disposing)
			{
				if (m_sequencer != null)
					m_sequencer.Dispose();
		}
			m_sequencer = null;
		}
Ejemplo n.º 23
0
		/// <summary>
		/// Make a menu from multiple menu definitions
		/// </summary>
		/// <param name="menuIds"></param>
		/// <param name="location"></param>
		/// <param name="temporaryColleagueParam">
		/// Optional object that holds a Mediator and an XCore colleague
		/// that is used to simulate the blocking of a modal menu, without it really being modal.
		/// That is, the menu will add the colleague to the Mediator before it shows, and then remove
		/// it after it closes.
		/// </param>
		/// <param name="sequencer">
		/// Optional object that holds a MessageSequencer obejct
		/// that is used to simulate the blocking of a modal menu, without it really being modal.
		/// That is, the menu will pause the MsgSeq before it shows, and then resume it
		/// it after it closes.
		/// </param>
		/// <returns></returns>
		public void ShowContextMenu(string[] menuIds, /*out ChoiceGroup group,*/ Point location,
			TemporaryColleagueParameter temporaryColleagueParam,
			MessageSequencer sequencer)
		{
			CheckDisposed();

			List<XmlNode> nodes = new List<XmlNode>(menuIds.Length);
			foreach (string m in menuIds)
			{
				if (m == null || m == "")
					continue; // that's ok
				XmlNode node = GetContextMenuNodeFromMenuId(m);
				nodes.Add(node);
			}
			ChoiceGroup group = new ChoiceGroup(m_mediator, m_menuBarAdapter, nodes, null);
			((IUIMenuAdapter)m_menuBarAdapter).ShowContextMenu(group, location, temporaryColleagueParam, sequencer);
		}
Ejemplo n.º 24
0
		/// <summary/>
		protected override void Dispose(bool release_all)
		{
			if (release_all)
			{
				m_messageSequencer.Dispose();
			}
			m_messageSequencer = null;
			base.Dispose(release_all);
		}
Ejemplo n.º 25
0
		/// <summary>
		///
		/// </summary>
		/// <param name="group"></param>
		/// <param name="location"></param>
		/// <param name="temporaryColleagueParam"></param>
		/// <param name="sequencer"></param>
		public void ShowContextMenu(ChoiceGroup group, Point location,
			TemporaryColleagueParameter temporaryColleagueParam,
			MessageSequencer sequencer)
		{
			// Store optional parameter values.
			m_temporaryColleagueParam = temporaryColleagueParam; // Nulls are just fine.
			m_sequencer = sequencer; // Nulls are just fine.

			// TODO-Linux FWNX-345: Review - don't use TemporaryColleague's
			// This needs to be done before PopulateNow
			if (m_temporaryColleagueParam != null)
				m_temporaryColleagueParam.Mediator.AddTemporaryColleague(m_temporaryColleagueParam.TemporaryColleague);

			// item is used in calling CreateUIForChoiceGroup to attach the choiceGroup
			// menu items to. It is not added to the shown contextMenu.
			ToolStripMenuItem item = new ToolStripMenuItem();
			item.Tag = group;
			group.ReferenceWidget = item;
			group.PopulateNow();
			CreateUIForChoiceGroup(group);

			var contextMenu = new ContextMenuStrip();
			foreach(ToolStripMenuItem menuItem  in item.DropDown.Items)
			{
				contextMenu.Items.Add(menuItem as ToolStripMenuItem);
			}

			contextMenu.Show(location);
		}