public GoTo(RichPanel panel) { this.panel = panel; InitializeComponent(); this.numericUpDownLine.Maximum = this.panel.TotalLines; this.numericUpDownLine.Value = this.panel.CurrentLine; this.numericUpDownLine.Select(0, this.numericUpDownLine.Text.Length); }
private void CreatePanel(string name, DockState state, Action <string, bool> visibilityCallback) { if (this.panels.ContainsKey(name)) { return; } var panel = new RichPanel(name, Settings.Instance.Theme) { WordWrap = Settings.Instance.WordWrap }; panel.VisibleChanged += (s, e) => { visibilityCallback?.Invoke(name, panel.IsHidden); this.saveToolStripMenuItem.Enabled = this.panels.Values.Any(p => p.Visible && p.Text != "Welcome"); this.copyToolStripMenuItem.Enabled = this.panels.Values.Any(p => p.Visible); this.goToToolStripMenuItem.Enabled = this.panels.Values.Any(p => p.Visible); this.selectAllToolStripMenuItem.Enabled = this.panels.Values.Any(p => p.Visible); }; panel.PositionChanged += (s, e) => { if (this.ActiveControl != s) { return; } this.timestampToolStripStatusLabel.Text = e.Timestamp; this.levelToolStripStatusLabel.Text = e.Level; this.lineToolStripStatusLabel.Text = $"Ln {e.Line}"; this.columnToolStripStatusLabel.Text = $"Col {e.Column}"; this.selectionToolStripStatusLabel.Text = $"Sel {Math.Abs(e.Position - e.Anchor)}"; }; var lastForm = this.dockPanel?.ActiveDocument?.DockHandler?.Form; panel.Show(this.dockPanel); panel.DockState = state; lastForm?.Activate(); this.panels[name] = panel; }