示例#1
0
 /// <summary>
 /// Fires 'update begin' event on the main thread context
 /// </summary>
 internal void FireOnUpdateBegin()
 {
     Check.InvalidOperation(() => Thread.CurrentThread.ManagedThreadId == _ownerThread, _threadCheckMessage);
     try {
         UpdateBegin?.Invoke(this, EventArgs.Empty);
     } catch (Exception ex) {
         Debug.Assert(false, Invariant($"Exception thrown in a tree.UpdateBegin event handler: {ex.Message}"));
     }
 }
示例#2
0
        /// <summary>
        /// Fires 'update begin' event on the main thread context
        /// </summary>
        internal void FireOnUpdateBegin()
        {
            if (_ownerThread != Thread.CurrentThread.ManagedThreadId)
            {
                Debug.Fail(_threadContextInvalidMessage);
                return;
            }

            try {
                UpdateBegin?.Invoke(this, EventArgs.Empty);
            } catch (Exception ex) {
                Debug.Assert(false, Invariant($"Exception thrown in a tree.UpdateBegin event handler: {ex.Message}"));
            }
        }
        //!!!!может есть опции обновления какие-то
        public void PerformUpdate(bool clear)
        {
            if (clear)
            {
                Clear();
            }

            UpdateBegin?.Invoke(this);
            AllProviders_UpdateBegin?.Invoke(this);

            OnUpdate();

            //!!!!внутри suspend update видать тут что-то

            //sort by priority
            {
                List <Tuple <Control, float> > list = new List <Tuple <Control, float> >();
                foreach (Control control in layoutPanel.Controls)
                {
                    float        priority = 0;
                    SettingsCell cell     = control as SettingsCell;
                    if (cell != null)
                    {
                        priority = cell.CellsSortingPriority;
                    }
                    list.Add(new Tuple <Control, float>(control, priority));
                }

                CollectionUtility.MergeSort(list, delegate(Tuple <Control, float> c1, Tuple <Control, float> c2)
                {
                    if (c1.Item2 < c2.Item2)
                    {
                        return(-1);
                    }
                    if (c1.Item2 > c2.Item2)
                    {
                        return(1);
                    }
                    return(0);
                });

                for (int n = 0; n < list.Count; n++)
                {
                    var t = list[n];
                    layoutPanel.Controls.SetChildIndex(t.Item1, n);
                }
            }

            ////change docking
            //if( layoutPanel.Controls.Count == 1 && layoutPanel.Controls[ 0 ] is SettingsCell_Properties )
            //{
            //	//only Properties. no another controls
            //	layoutPanel.Controls[0].Size = new System.Drawing.Size(30, 15);
            //	layoutPanel.Controls[0].Dock = DockStyle.Fill;
            //}
            //else
            //{
            //	//!!!!!temp

            //	foreach( Control c in layoutPanel.Controls )
            //	{
            //		var p = c as SettingsCell_Properties;
            //		if( p != null )
            //		{
            //			//p.Size = new System.Drawing.Size( 30, 15 );
            //			//p.Dock = DockStyle.Fill;
            //			break;
            //		}
            //	}

            //	//!!!!!
            //	//layoutPanel.AutoScroll = true;
            //	//layoutPanel.HorizontalScroll.Enabled = false;
            //}

            UpdateEnd?.Invoke(this);
            AllProviders_UpdateEnd?.Invoke(this);
        }
 internal void PerformUpdateBegin(Viewport viewport)
 {
     OnUpdateBegin(viewport);
     UpdateBegin?.Invoke(this, viewport);
 }