Example #1
0
 protected virtual void OnCollapsed(DynamicListEventArgs e)
 {
     if (Collapsed != null)
     {
         Collapsed(this, e);
     }
 }
 protected virtual void OnHidden(DynamicListEventArgs e)
 {
     if (Hidden != null)
     {
         Hidden(this, e);
     }
 }
Example #3
0
 protected virtual void OnExpanded(DynamicListEventArgs e)
 {
     if (Expanded != null)
     {
         Expanded(this, e);
     }
 }
 protected virtual void OnShown(DynamicListEventArgs e)
 {
     if (Shown != null)
     {
         Shown(this, e);
     }
 }
		protected virtual void OnPlusClick(object sender, DynamicListEventArgs e)
		{
			if (blockClickEvent) { blockClickEvent = false; return; }
			OnExpanding(e);
			// If OnExpanding displaies an error message, focus is lost, form is closed and we can not access the handle anymore
			if (e.List.IsDisposed) return;
			ChildForm frm = new ChildForm();
			frm.Closed += delegate {
				blockClickEvent = true;
				if (expandedIn != null)
					expandedIn.Remove(e.List);
				OnCollapsed(e);
				plus.RaiseItemChanged();
				Timer timer = new Timer();
				timer.Interval = 85;
				timer.Tick += delegate(object sender2, EventArgs e2) {
					((Timer)sender2).Stop();
					((Timer)sender2).Dispose();
					blockClickEvent = false;
				};
				timer.Start();
			};
			Point p = e.List.PointToScreen(e.List.GetPositionFromRow(this));
			p.Offset(e.List.Columns[0].Width, Height);
			frm.StartPosition = FormStartPosition.Manual;
			frm.BackColor = childBorderColor;
			frm.Location = p;
			frm.ShowInTaskbar = false;
			frm.Owner = e.List.FindForm();
			
			VerticalScrollContainer scrollContainer = new VerticalScrollContainer();
			scrollContainer.Dock = DockStyle.Fill;
			
			DynamicList childList = new DynamicList(childColumns, childRows);
			childList.Dock = DockStyle.Fill;
			childList.KeyDown += delegate(object sender2, KeyEventArgs e2) {
				if (e2.KeyData == Keys.Escape) {
					frm.Close();
					// workaround focus problem: sometimes the mainform gets focus after this
					e.List.FindForm().Focus();
				}
			};
			scrollContainer.Controls.Add(childList);
			
			frm.Controls.Add(scrollContainer);
			
			int screenHeight = Screen.FromPoint(p).WorkingArea.Bottom - p.Y;
			screenHeight -= frm.Size.Height - frm.ClientSize.Height;
			int requiredHeight = childList.TotalRowHeight + 4;
			int formHeight = Math.Min(requiredHeight, screenHeight);
			if (formHeight < requiredHeight) {
				int missingHeight = Math.Min(100, requiredHeight - formHeight);
				formHeight += missingHeight;
				frm.Top -= missingHeight;
			}
			// Autosize child window
			int formWidth;
			using (Graphics g = childList.CreateGraphics()) {
				formWidth = 8 + childList.GetRequiredWidth(g);
			}
			int screenWidth = Screen.FromPoint(p).WorkingArea.Right - p.X;
			if (formWidth > screenWidth) {
				int missingWidth = Math.Min(100, formWidth - screenWidth);
				formWidth = screenWidth + missingWidth;
				frm.Left -= missingWidth;
			}
			frm.ClientSize = new Size(formWidth, formHeight);
			frm.MinimumSize = new Size(100, Math.Min(50, formHeight));
			isOpeningChild = true;
			frm.Show();
			isOpeningChild = false;
			childList.Focus();
			if (expandedIn != null)
				expandedIn.Add(e.List);
			OnExpanded(e);
			plus.RaiseItemChanged();
		}
		protected virtual void OnCollapsed(DynamicListEventArgs e)
		{
			if (Collapsed != null) {
				Collapsed(this, e);
			}
		}
		protected virtual void OnExpanded(DynamicListEventArgs e)
		{
			if (Expanded != null) {
				Expanded(this, e);
			}
		}
Example #8
0
        protected virtual void OnPlusClick(object sender, DynamicListEventArgs e)
        {
            if (blockClickEvent)
            {
                blockClickEvent = false; return;
            }
            OnExpanding(e);
            // If OnExpanding displaies an error message, focus is lost, form is closed and we can not access the handle anymore
            if (e.List.IsDisposed)
            {
                return;
            }
            ChildForm frm = new ChildForm();

            frm.Closed += delegate {
                blockClickEvent = true;
                if (expandedIn != null)
                {
                    expandedIn.Remove(e.List);
                }
                OnCollapsed(e);
                plus.RaiseItemChanged();
                Timer timer = new Timer();
                timer.Interval = 85;
                timer.Tick    += delegate(object sender2, EventArgs e2) {
                    ((Timer)sender2).Stop();
                    ((Timer)sender2).Dispose();
                    blockClickEvent = false;
                };
                timer.Start();
            };
            Point p = e.List.PointToScreen(e.List.GetPositionFromRow(this));

            p.Offset(e.List.Columns[0].Width, Height);
            frm.StartPosition = FormStartPosition.Manual;
            frm.BackColor     = childBorderColor;
            frm.Location      = p;
            frm.ShowInTaskbar = false;
            frm.Owner         = e.List.FindForm();

            VerticalScrollContainer scrollContainer = new VerticalScrollContainer();

            scrollContainer.Dock = DockStyle.Fill;

            DynamicList childList = new DynamicList(childColumns, childRows);

            childList.Dock     = DockStyle.Fill;
            childList.KeyDown += delegate(object sender2, KeyEventArgs e2) {
                if (e2.KeyData == Keys.Escape)
                {
                    frm.Close();
                    // workaround focus problem: sometimes the mainform gets focus after this
                    e.List.FindForm().Focus();
                }
            };
            scrollContainer.Controls.Add(childList);

            frm.Controls.Add(scrollContainer);

            int screenHeight = Screen.FromPoint(p).WorkingArea.Bottom - p.Y;

            screenHeight -= frm.Size.Height - frm.ClientSize.Height;
            int requiredHeight = childList.TotalRowHeight + 4;
            int formHeight     = Math.Min(requiredHeight, screenHeight);

            if (formHeight < requiredHeight)
            {
                int missingHeight = Math.Min(100, requiredHeight - formHeight);
                formHeight += missingHeight;
                frm.Top    -= missingHeight;
            }
            // Autosize child window
            int formWidth;

            using (Graphics g = childList.CreateGraphics()) {
                formWidth = 8 + childList.GetRequiredWidth(g);
            }
            int screenWidth = Screen.FromPoint(p).WorkingArea.Right - p.X;

            if (formWidth > screenWidth)
            {
                int missingWidth = Math.Min(100, formWidth - screenWidth);
                formWidth = screenWidth + missingWidth;
                frm.Left -= missingWidth;
            }
            frm.ClientSize  = new Size(formWidth, formHeight);
            frm.MinimumSize = new Size(100, Math.Min(50, formHeight));
            isOpeningChild  = true;
            frm.Show();
            isOpeningChild = false;
            childList.Focus();
            if (expandedIn != null)
            {
                expandedIn.Add(e.List);
            }
            OnExpanded(e);
            plus.RaiseItemChanged();
        }
		protected virtual void OnHidden(DynamicListEventArgs e)
		{
			if (Hidden != null) {
				Hidden(this, e);
			}
		}
		protected virtual void OnShown(DynamicListEventArgs e)
		{
			if (Shown != null) {
				Shown(this, e);
			}
		}
		void OnLabelEdited(object sender, DynamicListEventArgs e)
		{
			if (((ISetText)content).CanSetText) {
				((ISetText)content).SetText(((DynamicListItem)sender).Text);
			}
		}
		/// <summary>
		/// Called when plus is pressed in debugger tooltip.
		/// Sets the data to be show in the next level.
		/// </summary>
		protected override void OnExpanding(DynamicListEventArgs e)
		{
			base.OnExpanding(e);
			if (process.IsRunning) {
				MessageService.ShowMessage(
					"${res:MainWindow.Windows.Debug.LocalVariables.CannotExploreVariablesWhileRunning}",
					"${res:MainWindow.Windows.Debug.LocalVariables}"
				);
				return;
			}
			try {
				LoadChilds();
			} catch (AbortedBecauseDebuggeeResumedException) {
			}
		}