Skip to content

Commit d0e1ebe

Browse files
author
Petteri Kautonen
authored
Merge pull request #356 from VPKSoft/fix_scripting
Fix scripting
2 parents 1674e89 + f38e3d3 commit d0e1ebe

161 files changed

Lines changed: 22605 additions & 22663 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CustomControls/ComboBoxCustomSearch.cs

Lines changed: 68 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
MIT License
44
5-
Copyright(c) 2021 Petteri Kautonen
5+
Copyright(c) 2022 Petteri Kautonen
66
77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal
@@ -29,91 +29,89 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2929
using System.Linq;
3030
using System.Windows.Forms;
3131

32-
namespace CustomControls
32+
namespace CustomControls;
33+
// Parts of the code from (C): https://social.msdn.microsoft.com/Forums/en-US/4ebaaed0-cd29-4663-9a43-973729d66cea/autocomplete-combobox-match-any-part-of-string-not-only-beginning-string?forum=winforms
34+
35+
/// <summary>
36+
/// A <see cref="ComboBox"/> implementation auto-completing case-insensitively items containing the typed text.
37+
/// Implements the <see cref="System.Windows.Forms.ComboBox" />
38+
/// </summary>
39+
/// <seealso cref="System.Windows.Forms.ComboBox" />
40+
public class ComboBoxCustomSearch : ComboBox
3341
{
34-
// Parts of the code from (C): https://social.msdn.microsoft.com/Forums/en-US/4ebaaed0-cd29-4663-9a43-973729d66cea/autocomplete-combobox-match-any-part-of-string-not-only-beginning-string?forum=winforms
42+
private IList<object> collectionList;
3543

3644
/// <summary>
37-
/// A <see cref="ComboBox"/> implementation auto-completing case-insensitively items containing the typed text.
38-
/// Implements the <see cref="System.Windows.Forms.ComboBox" />
45+
/// Initializes a new instance of the <see cref="T:CustomControls.ComboBoxCustomSearch" /> class.
3946
/// </summary>
40-
/// <seealso cref="System.Windows.Forms.ComboBox" />
41-
public class ComboBoxCustomSearch : ComboBox
47+
public ComboBoxCustomSearch()
4248
{
43-
private IList<object> collectionList;
49+
collectionList = new List<object>();
50+
}
4451

45-
/// <summary>
46-
/// Initializes a new instance of the <see cref="T:CustomControls.ComboBoxCustomSearch" /> class.
47-
/// </summary>
48-
public ComboBoxCustomSearch()
49-
{
50-
collectionList = new List<object>();
51-
}
52+
// ReSharper disable four times InconsistentNaming, WinApi constant..
53+
// ReSharper disable four times IdentifierTypo, WinApi constant..
54+
private const int CB_ADDSTRING = 0x143;
55+
private const int CB_DELETESTRING = 0x144;
56+
private const int CB_INSERTSTRING = 0x14A;
57+
private const int CB_RESETCONTENT = 0x14B;
5258

53-
// ReSharper disable four times InconsistentNaming, WinApi constant..
54-
// ReSharper disable four times IdentifierTypo, WinApi constant..
55-
private const int CB_ADDSTRING = 0x143;
56-
private const int CB_DELETESTRING = 0x144;
57-
private const int CB_INSERTSTRING = 0x14A;
58-
private const int CB_RESETCONTENT = 0x14B;
59-
60-
/// <summary>
61-
/// Processes Windows messages.
62-
/// </summary>
63-
/// <param name="m">The <see cref="Message"/> message to process.</param>
64-
protected override void WndProc(ref Message m)
59+
/// <summary>
60+
/// Processes Windows messages.
61+
/// </summary>
62+
/// <param name="m">The <see cref="Message"/> message to process.</param>
63+
protected override void WndProc(ref Message m)
64+
{
65+
if (m.Msg is CB_ADDSTRING or CB_DELETESTRING or CB_INSERTSTRING or CB_RESETCONTENT)
6566
{
66-
if (m.Msg is CB_ADDSTRING or CB_DELETESTRING or CB_INSERTSTRING or CB_RESETCONTENT)
67+
if (!filtering)
6768
{
68-
if (!filtering)
69-
{
70-
collectionList = Items.OfType<object>().ToList();
71-
}
69+
collectionList = Items.OfType<object>().ToList();
7270
}
73-
base.WndProc(ref m);
7471
}
72+
base.WndProc(ref m);
73+
}
7574

76-
/// <summary>
77-
/// A flag indicting whether the combo box is being filtered.
78-
/// </summary>
79-
private bool filtering;
80-
81-
/// <summary>
82-
/// A flag indicating whether <see cref="OnCreateControl"/> has been called once.
83-
/// </summary>
84-
private bool controlCreated;
85-
86-
/// <summary>
87-
/// Raises the <see cref="ComboBox.TextUpdate"/> event.
88-
/// </summary>
89-
/// <param name="e">An <see cref="EventArgs"/> that contains the event data.</param>
90-
protected override void OnTextUpdate(EventArgs e)
91-
{
92-
filtering = true;
93-
IList<object> Values = collectionList
94-
.Where(x => (x.ToString() ?? "").Contains(Text, StringComparison.OrdinalIgnoreCase))
95-
.ToList<object>();
75+
/// <summary>
76+
/// A flag indicting whether the combo box is being filtered.
77+
/// </summary>
78+
private bool filtering;
9679

97-
Items.Clear();
98-
Items.AddRange(Text != string.Empty ? Values.ToArray() : collectionList.ToArray());
80+
/// <summary>
81+
/// A flag indicating whether <see cref="OnCreateControl"/> has been called once.
82+
/// </summary>
83+
private bool controlCreated;
9984

100-
SelectionStart = Text.Length;
101-
DroppedDown = true;
102-
filtering = false;
103-
}
85+
/// <summary>
86+
/// Raises the <see cref="ComboBox.TextUpdate"/> event.
87+
/// </summary>
88+
/// <param name="e">An <see cref="EventArgs"/> that contains the event data.</param>
89+
protected override void OnTextUpdate(EventArgs e)
90+
{
91+
filtering = true;
92+
IList<object> Values = collectionList
93+
.Where(x => (x.ToString() ?? "").Contains(Text, StringComparison.OrdinalIgnoreCase))
94+
.ToList<object>();
95+
96+
Items.Clear();
97+
Items.AddRange(Text != string.Empty ? Values.ToArray() : collectionList.ToArray());
98+
99+
SelectionStart = Text.Length;
100+
DroppedDown = true;
101+
filtering = false;
102+
}
104103

105104

106-
/// <summary>
107-
/// Raises the <see cref="Control.CreateControl"/> method.
108-
/// </summary>
109-
protected override void OnCreateControl()
105+
/// <summary>
106+
/// Raises the <see cref="Control.CreateControl"/> method.
107+
/// </summary>
108+
protected override void OnCreateControl()
109+
{
110+
base.OnCreateControl();
111+
if (!controlCreated)
110112
{
111-
base.OnCreateControl();
112-
if (!controlCreated)
113-
{
114-
collectionList = Items.OfType<object>().ToList();
115-
controlCreated = true;
116-
}
113+
collectionList = Items.OfType<object>().ToList();
114+
controlCreated = true;
117115
}
118116
}
119-
}
117+
}
Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<UseWindowsForms>true</UseWindowsForms>
5-
<TargetFramework>net6.0-windows</TargetFramework>
6-
<ApplicationIcon />
7-
<OutputType>Library</OutputType>
8-
<StartupObject />
9-
<Authors>VPKSoft</Authors>
10-
<Product>ScriptNotepad Custom Controls</Product>
11-
<PackageId>CustomControls</PackageId>
12-
<Description>Custom controls for the ScriptNotepad software.</Description>
13-
<Copyright>Copyright © VPKSoft 2021</Copyright>
14-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
15-
<PackageProjectUrl>https://www.vpksoft.net/2015-03-31-13-33-28/scriptnotepad</PackageProjectUrl>
16-
<PackageIcon>ScriptNotepad_icon.png</PackageIcon>
17-
<PackageIconUrl />
18-
<RepositoryUrl>https://github.com/VPKSoft/ScriptNotepad</RepositoryUrl>
19-
<RepositoryType>git</RepositoryType>
20-
<PackageTags>custom control winforms</PackageTags>
21-
<PackageReleaseNotes>See: https://github.com/VPKSoft/ScriptNotepad</PackageReleaseNotes>
22-
</PropertyGroup>
3+
<PropertyGroup>
4+
<UseWindowsForms>true</UseWindowsForms>
5+
<TargetFramework>net6.0-windows</TargetFramework>
6+
<ApplicationIcon />
7+
<OutputType>Library</OutputType>
8+
<StartupObject />
9+
<Authors>VPKSoft</Authors>
10+
<Product>ScriptNotepad Custom Controls</Product>
11+
<PackageId>CustomControls</PackageId>
12+
<Description>Custom controls for the ScriptNotepad software.</Description>
13+
<Copyright>Copyright © VPKSoft 2022</Copyright>
14+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
15+
<PackageProjectUrl>https://www.vpksoft.net/2015-03-31-13-33-28/scriptnotepad</PackageProjectUrl>
16+
<PackageIcon>ScriptNotepad_icon.png</PackageIcon>
17+
<PackageIconUrl />
18+
<RepositoryUrl>https://github.com/VPKSoft/ScriptNotepad</RepositoryUrl>
19+
<RepositoryType>git</RepositoryType>
20+
<PackageTags>custom control winforms</PackageTags>
21+
<PackageReleaseNotes>See: https://github.com/VPKSoft/ScriptNotepad</PackageReleaseNotes>
22+
</PropertyGroup>
2323

24-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
25-
<DocumentationFile>C:\Files\GitHub\ScriptNotepad\CustomControls\CustomControls.xml</DocumentationFile>
26-
</PropertyGroup>
24+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
25+
<DocumentationFile>C:\Files\GitHub\ScriptNotepad\CustomControls\CustomControls.xml</DocumentationFile>
26+
</PropertyGroup>
2727

28-
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
29-
<DocumentationFile>C:\Files\GitHub\ScriptNotepad\CustomControls\CustomControls.xml</DocumentationFile>
30-
</PropertyGroup>
28+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
29+
<DocumentationFile>C:\Files\GitHub\ScriptNotepad\CustomControls\CustomControls.xml</DocumentationFile>
30+
</PropertyGroup>
3131

32-
<ItemGroup>
33-
<None Include="..\ScriptNotepad_icon.png">
34-
<Pack>True</Pack>
35-
<PackagePath></PackagePath>
36-
</None>
37-
</ItemGroup>
32+
<ItemGroup>
33+
<None Include="..\ScriptNotepad_icon.png">
34+
<Pack>True</Pack>
35+
<PackagePath></PackagePath>
36+
</None>
37+
</ItemGroup>
3838
</Project>

CustomControls/ImageButton.cs

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
MIT License
44
5-
Copyright(c) 2021 Petteri Kautonen
5+
Copyright(c) 2022 Petteri Kautonen
66
77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal
@@ -29,67 +29,66 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2929
using System.Drawing;
3030
using System.Windows.Forms;
3131

32-
namespace CustomControls
32+
namespace CustomControls;
33+
34+
/// <summary>
35+
/// A custom button control with an image and a label.
36+
/// Implements the <see cref="System.Windows.Forms.UserControl" />
37+
/// </summary>
38+
/// <seealso cref="System.Windows.Forms.UserControl" />
39+
[DefaultEvent(nameof(Click))]
40+
public partial class ImageButton : UserControl
3341
{
3442
/// <summary>
35-
/// A custom button control with an image and a label.
36-
/// Implements the <see cref="System.Windows.Forms.UserControl" />
43+
/// Initializes a new instance of the <see cref="ImageButton"/> class.
3744
/// </summary>
38-
/// <seealso cref="System.Windows.Forms.UserControl" />
39-
[DefaultEvent(nameof(Click))]
40-
public partial class ImageButton : UserControl
45+
public ImageButton()
4146
{
42-
/// <summary>
43-
/// Initializes a new instance of the <see cref="ImageButton"/> class.
44-
/// </summary>
45-
public ImageButton()
46-
{
47-
InitializeComponent();
48-
}
47+
InitializeComponent();
48+
}
4949

50-
/// <summary>
51-
/// Gets or sets the button image.
52-
/// </summary>
53-
/// <value>The button image.</value>
54-
[Category("Appearance")]
55-
[Description("The button image.")]
56-
public Image ButtonImage { get => pnImage.BackgroundImage; set => pnImage.BackgroundImage = value; }
50+
/// <summary>
51+
/// Gets or sets the button image.
52+
/// </summary>
53+
/// <value>The button image.</value>
54+
[Category("Appearance")]
55+
[Description("The button image.")]
56+
public Image ButtonImage { get => pnImage.BackgroundImage; set => pnImage.BackgroundImage = value; }
5757

58-
/// <summary>
59-
/// Gets or sets the button image layout.
60-
/// </summary>
61-
/// <value>The button image layout.</value>
62-
[Category("Appearance")]
63-
[Description("The button image layout.")]
64-
public ImageLayout ButtonImageLayout { get => pnImage.BackgroundImageLayout; set => pnImage.BackgroundImageLayout = value; }
58+
/// <summary>
59+
/// Gets or sets the button image layout.
60+
/// </summary>
61+
/// <value>The button image layout.</value>
62+
[Category("Appearance")]
63+
[Description("The button image layout.")]
64+
public ImageLayout ButtonImageLayout { get => pnImage.BackgroundImageLayout; set => pnImage.BackgroundImageLayout = value; }
6565

66-
/// <summary>
67-
/// Gets or sets the text associated with this control.
68-
/// </summary>
69-
/// <value>The text.</value>
70-
[Category("Appearance")]
71-
[Description("The text associated with this control.")]
72-
[Browsable(true)]
73-
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
74-
[EditorBrowsable(EditorBrowsableState.Always)]
75-
public override string Text { get => lbButtonText.Text; set => lbButtonText.Text = value; }
66+
/// <summary>
67+
/// Gets or sets the text associated with this control.
68+
/// </summary>
69+
/// <value>The text.</value>
70+
[Category("Appearance")]
71+
[Description("The text associated with this control.")]
72+
[Browsable(true)]
73+
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
74+
[EditorBrowsable(EditorBrowsableState.Always)]
75+
public override string Text { get => lbButtonText.Text; set => lbButtonText.Text = value; }
7676

77-
/// <summary>
78-
/// Occurs when the control is clicked.
79-
/// </summary>
80-
[Category("Behaviour")]
81-
[Description("The text associated with this control.")]
82-
// ReSharper disable once InconsistentNaming
83-
public new EventHandler Click;
77+
/// <summary>
78+
/// Occurs when the control is clicked.
79+
/// </summary>
80+
[Category("Behaviour")]
81+
[Description("The text associated with this control.")]
82+
// ReSharper disable once InconsistentNaming
83+
public new EventHandler Click;
8484

85-
/// <summary>
86-
/// Delegates the <see cref="Click"/> event to the base control.
87-
/// </summary>
88-
/// <param name="sender">The sender.</param>
89-
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
90-
private void DelegateClick(object sender, EventArgs e)
91-
{
92-
Click?.Invoke(this, EventArgs.Empty);
93-
}
85+
/// <summary>
86+
/// Delegates the <see cref="Click"/> event to the base control.
87+
/// </summary>
88+
/// <param name="sender">The sender.</param>
89+
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
90+
private void DelegateClick(object sender, EventArgs e)
91+
{
92+
Click?.Invoke(this, EventArgs.Empty);
9493
}
95-
}
94+
}

InstallerBaseWixSharp/Files/Dialogs/ProgressDialog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public ProgressDialog()
4848
InitializeComponent();
4949
dialogText.MakeTransparentOn(banner);
5050

51-
showWaitPromptTimer = new System.Windows.Forms.Timer { Interval = 4000 };
51+
showWaitPromptTimer = new System.Windows.Forms.Timer { Interval = 4000, };
5252
showWaitPromptTimer.Tick += (s, e) =>
5353
{
5454
waitPrompt.Visible = true;

InstallerBaseWixSharp/Files/Localization/TabDeliLocalization/TabDeliLocalization.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public void GetLocalizedTexts(string fileContents)
167167
{
168168
continue;
169169
}
170-
LocalizationTexts.Add(new LocalizationTextContainer { MessageName = delimited[0], Message = delimited[1], CultureName = locale});
170+
LocalizationTexts.Add(new LocalizationTextContainer { MessageName = delimited[0], Message = delimited[1], CultureName = locale, });
171171
}
172172
}
173173
}

0 commit comments

Comments
 (0)