Esempio n. 1
0
        /// <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_sda != null)
                {
                    m_sda.RemoveNotification(this);
                    m_sda = null;
                }
                AtomicReferenceLauncher arl = Control as AtomicReferenceLauncher;
                if (arl != null)
                {
                    arl.ChoicesMade     -= new EventHandler(this.RefreshTree);
                    arl.ViewSizeChanged -= new FwViewSizeChangedEventHandler(this.OnViewSizeChanged);
                    AtomicReferenceView view = (AtomicReferenceView)arl.MainControl;
                    view.ViewSizeChanged -= new FwViewSizeChangedEventHandler(this.OnViewSizeChanged);
                }
            }

            // Dispose unmanaged resources here, whether disposing is true or false.

            base.Dispose(disposing);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="persistenceProvider"></param>
        /// <param name="stringTbl"></param>
        protected override void SetupControls(IPersistenceProvider persistenceProvider,
                                              Mediator mediator, StringTable stringTbl)
        {
            AtomicReferenceLauncher arl = new AtomicReferenceLauncher();

            arl.Initialize(m_cache, m_obj, m_flid, m_fieldName, persistenceProvider, mediator,
                           DisplayNameProperty,
                           BestWsName);      // TODO: Get better default 'best ws'.
            arl.ConfigurationNode = ConfigurationNode;
            XmlNode deParams = ConfigurationNode.SelectSingleNode("deParams");

            if (XmlUtils.GetOptionalBooleanAttributeValue(
                    deParams, "changeRequiresRefresh", false))
            {
                arl.ChoicesMade += new EventHandler(this.RefreshTree);
            }


            // We don't want to be visible until later, since otherwise we get a temporary
            // display in the wrong place with the wrong size that serves only to annoy the
            // user.  See LT-1518 "The drawing of the DataTree for Lexicon/Advanced Edit draws
            // some initial invalid controls."  Becoming visible when we set the width and
            // height seems to delay things enough to avoid this visual clutter.
            arl.Visible          = false;
            this.Control         = arl;
            arl.ViewSizeChanged += new FwViewSizeChangedEventHandler(this.OnViewSizeChanged);
            AtomicReferenceView view = (AtomicReferenceView)arl.MainControl;

            view.ViewSizeChanged += new FwViewSizeChangedEventHandler(this.OnViewSizeChanged);
        }
		/// <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)
			{
			}
			m_atomicRefView = null; // Disposed automatically, since it is in the controls collection.

			base.Dispose(disposing);
		}
Esempio n. 4
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)
            {
            }
            m_atomicRefView = null;             // Disposed automatically, since it is in the controls collection.

            base.Dispose(disposing);
        }
Esempio n. 5
0
        protected override void OnSizeChanged(EventArgs e)
        {
            base.OnSizeChanged(e);
            if (this.Width == m_dxLastWidth)
            {
                return;
            }
            m_dxLastWidth = Width;             // BEFORE doing anything, actions below may trigger recursive call.
            AtomicReferenceLauncher arl  = (AtomicReferenceLauncher)this.Control;
            AtomicReferenceView     view = (AtomicReferenceView)arl.MainControl;

            view.PerformLayout();
            int h1   = view.RootBox.Height;
            int hNew = Math.Max(h1, ContainingDataTree.GetMinFieldHeight()) + 3;

            if (hNew != this.Height)
            {
                this.Height = hNew;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Handle changes in the size of the underlying view.
        /// </summary>
        protected void OnViewSizeChanged(object sender, FwViewSizeEventArgs e)
        {
            // For now, just handle changes in the height.
            AtomicReferenceLauncher arl  = (AtomicReferenceLauncher)this.Control;
            AtomicReferenceView     view = (AtomicReferenceView)arl.MainControl;
            int hMin = ContainingDataTree.GetMinFieldHeight();
            int h1   = view.RootBox.Height;

            Debug.Assert(e.Height == h1);
            int hOld = TreeNode.Height;
            int hNew = Math.Max(h1, hMin) + 3;

            if (hNew > hOld)
            {
                TreeNode.Height = hNew;
                arl.Height      = hNew - 1;
                view.Height     = hNew - 1;
                this.Height     = hNew;
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.m_atomicRefView = CreateAtomicReferenceView();
            this.SuspendLayout();
            //
            // m_panel
            //
            this.m_panel.BackColor = System.Drawing.SystemColors.Window;
            this.m_panel.Name      = "m_panel";

            //
            // m_btnLauncher
            //
            this.m_btnLauncher.Name = "m_btnLauncher";
            //
            // m_atomicRefView
            //
            this.m_atomicRefView.AutoScroll = false;
            this.m_atomicRefView.EditingHelper.DefaultCursor = null;
            this.m_atomicRefView.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.m_atomicRefView.Location = new System.Drawing.Point(0, 0);
            this.m_atomicRefView.Name     = "m_atomicRefView";
            this.m_atomicRefView.Size     = new System.Drawing.Size(250, 20);
            this.m_atomicRefView.TabIndex = 2;
            //
            // AtomicReferenceLauncher
            //
            this.Controls.Add(this.m_atomicRefView);
            this.Controls.Add(this.m_panel);                                    //?
            this.MainControl = this.m_atomicRefView;
            this.Name        = "AtomicReferenceLauncher";
            this.Size        = new System.Drawing.Size(250, 20);
            this.Controls.SetChildIndex(this.m_atomicRefView, 0);
            this.Controls.SetChildIndex(this.m_panel, 1);                       //0
            this.ResumeLayout(false);
        }
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.m_atomicRefView = CreateAtomicReferenceView();
			this.SuspendLayout();
			//
			// m_panel
			//
			this.m_panel.BackColor = System.Drawing.SystemColors.Window;
			this.m_panel.Name = "m_panel";

			//
			// m_btnLauncher
			//
			this.m_btnLauncher.Name = "m_btnLauncher";
			//
			// m_atomicRefView
			//
			this.m_atomicRefView.AutoScroll = false;
			this.m_atomicRefView.EditingHelper.DefaultCursor = null;
			this.m_atomicRefView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.m_atomicRefView.Location = new System.Drawing.Point(0, 0);
			this.m_atomicRefView.Name = "m_atomicRefView";
			this.m_atomicRefView.Size = new System.Drawing.Size(250, 20);
			this.m_atomicRefView.TabIndex = 2;
			//
			// AtomicReferenceLauncher
			//
			this.Controls.Add(this.m_atomicRefView);
			this.Controls.Add(this.m_panel);			//?
			this.MainControl = this.m_atomicRefView;
			this.Name = "AtomicReferenceLauncher";
			this.Size = new System.Drawing.Size(250, 20);
			this.Controls.SetChildIndex(this.m_atomicRefView, 0);
			this.Controls.SetChildIndex(this.m_panel, 1);		//0
			this.ResumeLayout(false);

		}