diff --git a/CHANGELOG.md b/CHANGELOG.md index 749d9d177..da0b438c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +## [14.1.1] - 2024-05-23 + +### Fixed + +- [SIL.Windows.Forms.DblBundle] Fixed bug in ProjectsListBase that made it impossible to select a project after double-clicking a column header. (See HT-475) + ## [14.1.0] - 2024-05-13 ### Added @@ -391,7 +397,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - [SIL.NUnit3Compatibility] new project/package that allows to use NUnit3 syntax with NUnit2 projects -[Unreleased]: https://github.com/sillsdev/libpalaso/compare/v14.1.0...master +[Unreleased]: https://github.com/sillsdev/libpalaso/compare/v14.1.1...master +[14.1.1]: https://github.com/sillsdev/libpalaso/compare/v14.1.0...v14.1.1 [14.1.0]: https://github.com/sillsdev/libpalaso/compare/v14.0.0...v14.1.0 [14.0.0]: https://github.com/sillsdev/libpalaso/compare/v13.0.1...v14.0.0 [13.0.1]: https://github.com/sillsdev/libpalaso/compare/v13.0.0...v13.0.1 diff --git a/Palaso.sln.DotSettings b/Palaso.sln.DotSettings index b55cbf111..8ee3e7046 100644 --- a/Palaso.sln.DotSettings +++ b/Palaso.sln.DotSettings @@ -26,6 +26,7 @@ True True True + True True True True diff --git a/SIL.Windows.Forms.DblBundle/ProjectsListBase.cs b/SIL.Windows.Forms.DblBundle/ProjectsListBase.cs index b254ec76c..a92beff3f 100644 --- a/SIL.Windows.Forms.DblBundle/ProjectsListBase.cs +++ b/SIL.Windows.Forms.DblBundle/ProjectsListBase.cs @@ -1,10 +1,11 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Windows.Forms; +using JetBrains.Annotations; using L10NSharp; using SIL.DblBundle; using SIL.DblBundle.Text; @@ -36,7 +37,7 @@ public abstract partial class ProjectsListBase : UserControl private bool m_projectSelected; // The value of this boolean is only reliable if m_sorting is true. private bool m_sorting; - public ProjectsListBase() + protected ProjectsListBase() { InitializeComponent(); } @@ -44,7 +45,7 @@ public ProjectsListBase() [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public string SelectedProject { - get { return m_selectedProject; } + get => m_selectedProject; set { m_selectedProject = value; @@ -61,6 +62,7 @@ public string SelectedProject } } + [PublicAPI] public void AddReadOnlyProject(string projectFilePath) { m_readOnlyProjects.Add(projectFilePath); @@ -68,7 +70,7 @@ public void AddReadOnlyProject(string projectFilePath) public virtual bool IncludeHiddenProjects { - get { return m_includeHiddenProjects; } + get => m_includeHiddenProjects; set { m_includeHiddenProjects = value; @@ -76,23 +78,23 @@ public virtual bool IncludeHiddenProjects } } - protected virtual DataGridViewColumn InactiveColumn { get { return null; } } + protected virtual DataGridViewColumn InactiveColumn => null; + [PublicAPI] protected void OverrideColumnHeaderText(int columnIndex, string displayName) { m_list.Columns[columnIndex].HeaderText = displayName; } + [PublicAPI] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public bool HiddenProjectsExist - { - get { return m_hiddenProjectsExist; } - } + public bool HiddenProjectsExist => m_hiddenProjectsExist; + [PublicAPI] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public GridSettings GridSettings { - get { return GridSettings.Create(m_list); } + get => GridSettings.Create(m_list); set { if (value == null) @@ -134,15 +136,18 @@ protected override void OnLoad(EventArgs e) // don't change the AutoSizeMode of the fill column if (m_list.Columns[i] == FillColumn) continue; - int colw = m_list.Columns[i].Width; + int colWidth = m_list.Columns[i].Width; m_list.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.None; - m_list.Columns[i].Width = colw; + m_list.Columns[i].Width = colWidth; } } } - protected virtual DataGridViewColumn FillColumn { get { return colRecordingProjectName; } } + protected virtual DataGridViewColumn FillColumn => colRecordingProjectName; + /// + /// Enumeration of folders where existing project files are stored + /// protected abstract IEnumerable AllProjectFolders { get; } protected abstract string ProjectFileExtension { get; } @@ -167,8 +172,7 @@ protected virtual IEnumerable> Projects protected virtual IProjectInfo GetProjectInfo(string path) { - Exception exception; - var metadata = DblMetadataBase.Load(path, out exception); + var metadata = DblMetadataBase.Load(path, out var exception); return exception == null ? metadata : null; } @@ -215,10 +219,12 @@ private void LoadExistingProjects() (m_filterBundleId != null && m_filterBundleId != project.Item2.Id)) continue; - List rowData = new List(); - rowData.Add(project.Item1); - rowData.Add(project.Item2.Language); - rowData.Add(GetRecordingProjectName(project)); + List rowData = new List + { + project.Item1, + project.Item2.Language, + GetRecordingProjectName(project) + }; rowData.AddRange(GetAdditionalRowData(project.Item2)); int iRow = m_list.Rows.Add(rowData.ToArray()); @@ -240,8 +246,7 @@ private void LoadExistingProjects() if (SelectedProject != null) { SelectedProject = null; - if (SelectedProjectChanged != null) - SelectedProjectChanged(this, new EventArgs()); + SelectedProjectChanged?.Invoke(this, EventArgs.Empty); } } else @@ -251,8 +256,7 @@ private void LoadExistingProjects() m_list.CellValueChanged += HandleCellValueChanged; m_list.CellValidating += HandleCellValidating; - if (ListLoaded != null) - ListLoaded(this, new EventArgs()); + ListLoaded?.Invoke(this, EventArgs.Empty); } public void SetFilter(string icuLocale, string bundleId) @@ -274,16 +278,15 @@ private void HandleSelectionChanged(object sender, EventArgs e) if (DesignMode || m_list.SelectedRows.Count < 1 || m_list.SelectedRows[0].Index < 0) SelectedProject = null; else - SelectedProject = m_list.SelectedRows[0].Cells[colProjectPathOrId.Index].Value as String; + SelectedProject = m_list.SelectedRows[0].Cells[colProjectPathOrId.Index].Value as string; - if (SelectedProjectChanged != null) - SelectedProjectChanged(this, new EventArgs()); + SelectedProjectChanged?.Invoke(this, EventArgs.Empty); } /// /// See https://stackoverflow.com/questions/1407195/prevent-datagridview-selecting-a-row-when-sorted-if-none-was-previously-selected/1407261#1407261 /// - void HandleProjectListSorted(object sender, EventArgs e) + private void HandleProjectListSorted(object sender, EventArgs e) { if (m_sorting) { @@ -301,18 +304,21 @@ void HandleProjectListSorted(object sender, EventArgs e) private void HandleCellDoubleClick(object sender, DataGridViewCellEventArgs e) { // ignore double-click of header cells - if (e.RowIndex < 0) return; - OnDoubleClick(new EventArgs()); + if (e.RowIndex < 0) + { + m_sorting = false; + return; + } + + OnDoubleClick(EventArgs.Empty); } private void HandleListCellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { // clicking on the header row // also make sure we're not already set for sorting -- can happen if header is double-clicked - if ((e.Button == MouseButtons.Left) && (e.RowIndex == -1) && !m_sorting) - { + if (e.Button == MouseButtons.Left && e.RowIndex == -1 && !m_sorting) PrepareToSort(); - } } protected virtual void SetHiddenFlag(bool inactive) @@ -348,14 +354,12 @@ private void HandleCellValidating(object sender, DataGridViewCellValidatingEvent private void HandleColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) { - if (ColumnWidthChanged != null) - ColumnWidthChanged(this, e); + ColumnWidthChanged?.Invoke(this, e); } private void HandleColumnDisplayIndexChanged(object sender, DataGridViewColumnEventArgs e) { - if (ColumnDisplayIndexChanged != null) - ColumnDisplayIndexChanged(this, e); + ColumnDisplayIndexChanged?.Invoke(this, e); } } } diff --git a/SIL.Windows.Forms.DblBundle/SIL.Windows.Forms.DblBundle.csproj b/SIL.Windows.Forms.DblBundle/SIL.Windows.Forms.DblBundle.csproj index 3763235dd..a800a5a5e 100644 --- a/SIL.Windows.Forms.DblBundle/SIL.Windows.Forms.DblBundle.csproj +++ b/SIL.Windows.Forms.DblBundle/SIL.Windows.Forms.DblBundle.csproj @@ -11,6 +11,7 @@ + diff --git a/TestApps/SIL.Windows.Forms.TestApp/ChooseProject.Designer.cs b/TestApps/SIL.Windows.Forms.TestApp/ChooseProject.Designer.cs new file mode 100644 index 000000000..df33ac996 --- /dev/null +++ b/TestApps/SIL.Windows.Forms.TestApp/ChooseProject.Designer.cs @@ -0,0 +1,117 @@ +namespace SIL.Windows.Forms.TestApp +{ + partial class ChooseProject + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this._okButton = new System.Windows.Forms.Button(); + this._cancelButton = new System.Windows.Forms.Button(); + this._projectsList = new SIL.Windows.Forms.TestApp.ExistingProjectsList(); + this._tableLayoutPanelMain = new System.Windows.Forms.TableLayoutPanel(); + this._tableLayoutPanelMain.SuspendLayout(); + this.SuspendLayout(); + // + // _okButton + // + this._okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this._okButton.Location = new System.Drawing.Point(213, 296); + this._okButton.Name = "_okButton"; + this._okButton.Size = new System.Drawing.Size(69, 24); + this._okButton.TabIndex = 1; + this._okButton.Text = "OK"; + this._okButton.UseVisualStyleBackColor = true; + this._okButton.Click += new System.EventHandler(this._okButton_Click); + // + // _cancelButton + // + this._cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this._cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this._cancelButton.Location = new System.Drawing.Point(288, 296); + this._cancelButton.Name = "_cancelButton"; + this._cancelButton.Size = new System.Drawing.Size(69, 24); + this._cancelButton.TabIndex = 2; + this._cancelButton.Text = "&Cancel"; + this._cancelButton.UseVisualStyleBackColor = true; + // + // _projectsList + // + this._projectsList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._projectsList.IncludeHiddenProjects = false; + this._projectsList.Location = new System.Drawing.Point(3, 3); + this._projectsList.Name = "_projectsList"; + this._projectsList.Size = new System.Drawing.Size(339, 262); + this._projectsList.TabIndex = 0; + this._projectsList.SelectedProjectChanged += new System.EventHandler(this._projectsList_SelectedProjectChanged); + this._projectsList.DoubleClick += new System.EventHandler(this._projectsList_DoubleClick); + // + // _tableLayoutPanelMain + // + this._tableLayoutPanelMain.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._tableLayoutPanelMain.ColumnCount = 1; + this._tableLayoutPanelMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this._tableLayoutPanelMain.Controls.Add(this._projectsList, 0, 0); + this._tableLayoutPanelMain.Location = new System.Drawing.Point(12, 12); + this._tableLayoutPanelMain.Name = "_tableLayoutPanelMain"; + this._tableLayoutPanelMain.RowCount = 1; + this._tableLayoutPanelMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this._tableLayoutPanelMain.Size = new System.Drawing.Size(345, 268); + this._tableLayoutPanelMain.TabIndex = 4; + // + // ChooseProject + // + this.AcceptButton = this._okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this._cancelButton; + this.ClientSize = new System.Drawing.Size(369, 332); + this.Controls.Add(this._tableLayoutPanelMain); + this.Controls.Add(this._cancelButton); + this.Controls.Add(this._okButton); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(385, 370); + this.Name = "ChooseProject"; + this.ShowIcon = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "Choose Project"; + this._tableLayoutPanelMain.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private ExistingProjectsList _projectsList; + private System.Windows.Forms.Button _okButton; + private System.Windows.Forms.Button _cancelButton; + private System.Windows.Forms.TableLayoutPanel _tableLayoutPanelMain; + } +} diff --git a/TestApps/SIL.Windows.Forms.TestApp/ChooseProject.cs b/TestApps/SIL.Windows.Forms.TestApp/ChooseProject.cs new file mode 100644 index 000000000..472d3d63e --- /dev/null +++ b/TestApps/SIL.Windows.Forms.TestApp/ChooseProject.cs @@ -0,0 +1,48 @@ +using System; +using System.Windows.Forms; +using static System.String; + +namespace SIL.Windows.Forms.TestApp +{ + public partial class ChooseProject : Form + { + public string SelectedProject { get; set; } + + public ChooseProject() + { + InitializeComponent(); + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + UpdateDisplay(); + } + + private void _projectsList_SelectedProjectChanged(object sender, EventArgs e) + { + UpdateDisplay(); + } + + private void UpdateDisplay() + { + _okButton.Enabled = !IsNullOrEmpty(_projectsList.SelectedProject); + } + + private void _okButton_Click(object sender, EventArgs e) + { + if (_projectsList.SelectedProject == null) + throw new NullReferenceException("Should not be able to click OK if no project is selected."); + + SelectedProject = _projectsList.SelectedProject; + + DialogResult = DialogResult.OK; + Close(); + } + + private void _projectsList_DoubleClick(object sender, EventArgs e) + { + _okButton_Click(this, null); + } + } +} diff --git a/TestApps/SIL.Windows.Forms.TestApp/ChooseProject.resx b/TestApps/SIL.Windows.Forms.TestApp/ChooseProject.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/TestApps/SIL.Windows.Forms.TestApp/ChooseProject.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TestApps/SIL.Windows.Forms.TestApp/ExistingProjectsList.cs b/TestApps/SIL.Windows.Forms.TestApp/ExistingProjectsList.cs new file mode 100644 index 000000000..0c7d9f7f4 --- /dev/null +++ b/TestApps/SIL.Windows.Forms.TestApp/ExistingProjectsList.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using SIL.DblBundle; +using SIL.DblBundle.Text; +using SIL.Windows.Forms.DblBundle; + +namespace SIL.Windows.Forms.TestApp +{ + public partial class ExistingProjectsList : ProjectsListBase, DblMetadataLanguage> + { + private class SampleProject : IProjectInfo + { + private readonly int _id; + public string Name => "Sample " + _id; + public string Id => "sample" + _id; + public DblMetadataLanguage Language => new DblMetadataLanguage {Name = "English", Iso = "en"}; + + public SampleProject(int id) + { + _id = id; + } + } + + public ExistingProjectsList() + { + InitializeComponent(); + } + + protected override DataGridViewColumn FillColumn => colFullName; + + protected override IEnumerable AllProjectFolders => Array.Empty(); + + public const string kProjectFileExtension = ".hearthis"; + + protected override IEnumerable GetAdditionalRowData(IProjectInfo projectInfo) + { + yield return projectInfo.Name; + yield return projectInfo is SampleProject ? "Sample project" : "Other"; + } + + protected override string ProjectFileExtension => kProjectFileExtension; + + protected override IEnumerable> Projects + { + get + { + foreach (var project in base.Projects) + yield return project; + + for (int i = 1; i < 1500; i++) + yield return new Tuple("sample" + i, new SampleProject(i)); + } + } + + protected override IProjectInfo GetProjectInfo(string path) + { + var bundle = new TextBundle, DblMetadataLanguage>(path); + return bundle.Metadata; + } + + protected override string GetRecordingProjectName(Tuple project) + { + if (project.Item2 is DblTextMetadata) + return project.Item2.Id; + return base.GetRecordingProjectName(project); + } + } +} diff --git a/TestApps/SIL.Windows.Forms.TestApp/ExistingProjectsList.designer.cs b/TestApps/SIL.Windows.Forms.TestApp/ExistingProjectsList.designer.cs new file mode 100644 index 000000000..64e7f5f4a --- /dev/null +++ b/TestApps/SIL.Windows.Forms.TestApp/ExistingProjectsList.designer.cs @@ -0,0 +1,67 @@ +namespace SIL.Windows.Forms.TestApp +{ + partial class ExistingProjectsList + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing) + components?.Dispose(); + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.colFullName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colType = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.SuspendLayout(); + this.m_list.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.colFullName, + this.colType}); + // + // colFullName + // + this.colFullName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; + this.colFullName.HeaderText = "Full Name"; + this.colFullName.MinimumWidth = 50; + this.colFullName.Name = "colFullName"; + this.colFullName.ReadOnly = true; + this.colFullName.Width = 200; + // + // colType + // + this.colType.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; + this.colType.HeaderText = "Type"; + this.colType.MinimumWidth = 50; + this.colType.Name = "colType"; + this.colType.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colType.Width = 100; + // + // ExistingProjectsList + // + this.Name = "ExistingProjectsList"; + this.Size = new System.Drawing.Size(368, 147); + this.ResumeLayout(false); + } + + #endregion + + private System.Windows.Forms.DataGridViewTextBoxColumn colFullName; + private System.Windows.Forms.DataGridViewTextBoxColumn colType; + } +} diff --git a/TestApps/SIL.Windows.Forms.TestApp/SIL.Windows.Forms.TestApp.csproj b/TestApps/SIL.Windows.Forms.TestApp/SIL.Windows.Forms.TestApp.csproj index b34c0b462..302f0679d 100644 --- a/TestApps/SIL.Windows.Forms.TestApp/SIL.Windows.Forms.TestApp.csproj +++ b/TestApps/SIL.Windows.Forms.TestApp/SIL.Windows.Forms.TestApp.csproj @@ -28,8 +28,10 @@ + + diff --git a/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.Designer.cs b/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.Designer.cs index 13534f10b..c2f436ff8 100644 --- a/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.Designer.cs +++ b/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.Designer.cs @@ -55,10 +55,10 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - SIL.Windows.Forms.SuperToolTip.SuperToolTipInfoWrapper superToolTipInfoWrapper3 = new SIL.Windows.Forms.SuperToolTip.SuperToolTipInfoWrapper(); - SIL.Windows.Forms.SuperToolTip.SuperToolTipInfo superToolTipInfo3 = new SIL.Windows.Forms.SuperToolTip.SuperToolTipInfo(); - SIL.Windows.Forms.SuperToolTip.SuperToolTipInfoWrapper superToolTipInfoWrapper4 = new SIL.Windows.Forms.SuperToolTip.SuperToolTipInfoWrapper(); - SIL.Windows.Forms.SuperToolTip.SuperToolTipInfo superToolTipInfo4 = new SIL.Windows.Forms.SuperToolTip.SuperToolTipInfo(); + SIL.Windows.Forms.SuperToolTip.SuperToolTipInfoWrapper superToolTipInfoWrapper1 = new SIL.Windows.Forms.SuperToolTip.SuperToolTipInfoWrapper(); + SIL.Windows.Forms.SuperToolTip.SuperToolTipInfo superToolTipInfo1 = new SIL.Windows.Forms.SuperToolTip.SuperToolTipInfo(); + SIL.Windows.Forms.SuperToolTip.SuperToolTipInfoWrapper superToolTipInfoWrapper2 = new SIL.Windows.Forms.SuperToolTip.SuperToolTipInfoWrapper(); + SIL.Windows.Forms.SuperToolTip.SuperToolTipInfo superToolTipInfo2 = new SIL.Windows.Forms.SuperToolTip.SuperToolTipInfo(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TestAppForm)); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this._uiLanguageMenu = new System.Windows.Forms.ToolStripDropDownButton(); @@ -83,6 +83,7 @@ private void InitializeComponent() this.superToolTip2 = new SIL.Windows.Forms.SuperToolTip.SuperToolTip(this.components); this.btnMediaFileInfo = new System.Windows.Forms.Button(); this.btnShowFileOverwriteDlg = new System.Windows.Forms.Button(); + this.btnOpenProject = new System.Windows.Forms.Button(); this.toolStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -180,23 +181,23 @@ private void InitializeComponent() // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 533); + this.label1.Location = new System.Drawing.Point(12, 569); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(149, 13); - superToolTipInfo3.BackgroundGradientBegin = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); - superToolTipInfo3.BackgroundGradientEnd = System.Drawing.Color.Blue; - superToolTipInfo3.BackgroundGradientMiddle = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(246)))), ((int)(((byte)(251))))); - superToolTipInfo3.BodyText = "This is the body text"; - superToolTipInfo3.FooterForeColor = System.Drawing.Color.Lime; - superToolTipInfo3.FooterText = "And this is the footer"; - superToolTipInfo3.HeaderForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); - superToolTipInfo3.HeaderText = "The header can serve as a title"; - superToolTipInfo3.OffsetForWhereToDisplay = new System.Drawing.Point(0, 0); - superToolTipInfo3.ShowFooter = true; - superToolTipInfo3.ShowFooterSeparator = true; - superToolTipInfoWrapper3.SuperToolTipInfo = superToolTipInfo3; - superToolTipInfoWrapper3.UseSuperToolTip = true; - this.superToolTip1.SetSuperStuff(this.label1, superToolTipInfoWrapper3); + superToolTipInfo1.BackgroundGradientBegin = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); + superToolTipInfo1.BackgroundGradientEnd = System.Drawing.Color.Blue; + superToolTipInfo1.BackgroundGradientMiddle = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(246)))), ((int)(((byte)(251))))); + superToolTipInfo1.BodyText = "This is the body text"; + superToolTipInfo1.FooterForeColor = System.Drawing.Color.Lime; + superToolTipInfo1.FooterText = "And this is the footer"; + superToolTipInfo1.HeaderForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); + superToolTipInfo1.HeaderText = "The header can serve as a title"; + superToolTipInfo1.OffsetForWhereToDisplay = new System.Drawing.Point(0, 0); + superToolTipInfo1.ShowFooter = true; + superToolTipInfo1.ShowFooterSeparator = true; + superToolTipInfoWrapper1.SuperToolTipInfo = superToolTipInfo1; + superToolTipInfoWrapper1.UseSuperToolTip = true; + this.superToolTip1.SetSuperStuff(this.label1, superToolTipInfoWrapper1); this.label1.TabIndex = 1; this.label1.Text = "Hover over me to see a tooltip"; // @@ -204,18 +205,18 @@ private void InitializeComponent() // this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 553); + this.label2.Location = new System.Drawing.Point(12, 589); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(140, 13); - superToolTipInfo4.BackgroundGradientBegin = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); - superToolTipInfo4.BackgroundGradientEnd = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(218)))), ((int)(((byte)(239))))); - superToolTipInfo4.BackgroundGradientMiddle = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(246)))), ((int)(((byte)(251))))); - superToolTipInfo4.BodyText = resources.GetString("superToolTipInfo4.BodyText"); - superToolTipInfo4.OffsetForWhereToDisplay = new System.Drawing.Point(0, 0); - superToolTipInfo4.ShowHeader = false; - superToolTipInfoWrapper4.SuperToolTipInfo = superToolTipInfo4; - superToolTipInfoWrapper4.UseSuperToolTip = true; - this.superToolTip2.SetSuperStuff(this.label2, superToolTipInfoWrapper4); + superToolTipInfo2.BackgroundGradientBegin = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + superToolTipInfo2.BackgroundGradientEnd = System.Drawing.Color.FromArgb(((int)(((byte)(202)))), ((int)(((byte)(218)))), ((int)(((byte)(239))))); + superToolTipInfo2.BackgroundGradientMiddle = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(246)))), ((int)(((byte)(251))))); + superToolTipInfo2.BodyText = resources.GetString("superToolTipInfo2.BodyText"); + superToolTipInfo2.OffsetForWhereToDisplay = new System.Drawing.Point(0, 0); + superToolTipInfo2.ShowHeader = false; + superToolTipInfoWrapper2.SuperToolTipInfo = superToolTipInfo2; + superToolTipInfoWrapper2.UseSuperToolTip = true; + this.superToolTip2.SetSuperStuff(this.label2, superToolTipInfoWrapper2); this.label2.TabIndex = 1; this.label2.Text = "Hover for simple, long tooltip"; // @@ -310,7 +311,7 @@ private void InitializeComponent() // btnMediaFileInfo // this.btnMediaFileInfo.Location = new System.Drawing.Point(12, 468); - this.btnMediaFileInfo.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnMediaFileInfo.Margin = new System.Windows.Forms.Padding(2); this.btnMediaFileInfo.Name = "btnMediaFileInfo"; this.btnMediaFileInfo.Size = new System.Drawing.Size(157, 23); this.btnMediaFileInfo.TabIndex = 10; @@ -329,11 +330,23 @@ private void InitializeComponent() this.btnShowFileOverwriteDlg.UseVisualStyleBackColor = true; this.btnShowFileOverwriteDlg.Click += new System.EventHandler(this.btnShowFileOverwriteDlg_Click); // + // btnOpenProject + // + this.btnOpenProject.Location = new System.Drawing.Point(12, 523); + this.btnOpenProject.Margin = new System.Windows.Forms.Padding(2); + this.btnOpenProject.Name = "btnOpenProject"; + this.btnOpenProject.Size = new System.Drawing.Size(157, 23); + this.btnOpenProject.TabIndex = 12; + this.btnOpenProject.Text = "Open Project"; + this.btnOpenProject.UseVisualStyleBackColor = true; + this.btnOpenProject.Click += new System.EventHandler(this.btnOpenProject_Click); + // // TestAppForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(187, 577); + this.ClientSize = new System.Drawing.Size(187, 613); + this.Controls.Add(this.btnOpenProject); this.Controls.Add(this.btnShowFileOverwriteDlg); this.Controls.Add(this.btnMediaFileInfo); this.Controls.Add(this.toolStrip1); @@ -388,5 +401,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripDropDownButton _uiLanguageMenu; private System.Windows.Forms.Button btnMediaFileInfo; private System.Windows.Forms.Button btnShowFileOverwriteDlg; + private System.Windows.Forms.Button btnOpenProject; } } diff --git a/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.cs b/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.cs index eb67f763c..978db2993 100644 --- a/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.cs +++ b/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.cs @@ -538,5 +538,12 @@ private void btnShowFileOverwriteDlg_Click(object sender, EventArgs e) MessageBox.Show( $"Files overwritten:\r\t{filesOverwritten.ToString("\r\t")}\rFiles skipped:\r\t{filesSkipped.ToString("\r\t")}", "Results"); } + + private void btnOpenProject_Click(object sender, EventArgs e) + { + using var dlg = new ChooseProject(); + if (dlg.ShowDialog(this) == DialogResult.OK) + MessageBox.Show("Got " + dlg.SelectedProject); + } } } \ No newline at end of file diff --git a/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.resx b/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.resx index ed341c3f9..4e8fb7932 100644 --- a/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.resx +++ b/TestApps/SIL.Windows.Forms.TestApp/TestAppForm.resx @@ -126,7 +126,7 @@ 17, 17 - + Spare ribs chicken shoulder flank, meatball sausage corned beef turducken doner bacon jowl fatback kielbasa. Shankle cow ground round buffalo ham shank. Meatball ribeye cow chuck. Doner sirloin cupim ground round rump turkey tail flank. Jerky meatball boudin biltong shankle filet mignon burgdoggen.