+semver:minor Added PrivacyDlg to allow control over analytics tracking#1493
+semver:minor Added PrivacyDlg to allow control over analytics tracking#1493
Conversation
…tics tracking is allowed Added elements to TestApp to exercise the new Privacy dialog
| // | ||
| // _buttonOK | ||
| // | ||
| this._buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
Check warning
Code scanning / CodeQL
Cast to same type Warning
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 13 days ago
To fix this problem, remove the unnecessary cast so that the code directly assigns the AnchorStyles expression to the Anchor property. In general, whenever an expression already has the target type, you should not cast it again.
Concretely, in SIL.Windows.Forms/Privacy/PrivacyDlg.Designer.cs, update the line that sets _buttonOK.Anchor. Currently it casts the result of the bitwise OR between AnchorStyles.Bottom and AnchorStyles.Right back to AnchorStyles, even though both operands are already of that enum type and the result is also AnchorStyles. Remove the outer cast and keep the bitwise OR expression as-is. No new methods, imports, or definitions are required; this is a straightforward one-line change that preserves existing functionality.
| @@ -136,7 +136,7 @@ | ||
| // | ||
| // _buttonOK | ||
| // | ||
| this._buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); | ||
| this._buttonOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; | ||
| this._buttonOK.AutoSize = true; | ||
| this._buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK; | ||
| this.locExtender.SetLocalizableToolTip(this._buttonOK, null); |
There was a problem hiding this comment.
True, but this is generated Designer code.
| // | ||
| // _buttonCancel | ||
| // | ||
| this._buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
Check warning
Code scanning / CodeQL
Cast to same type Warning
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 13 days ago
To fix the problem, remove the redundant cast to System.Windows.Forms.AnchorStyles while preserving the combined anchor style expression. The property Anchor already expects an AnchorStyles value, and the bitwise-or of AnchorStyles.Bottom and AnchorStyles.Right yields that type, so you can assign the expression directly.
Concretely, in SIL.Windows.Forms/Privacy/PrivacyDlg.Designer.cs, within the InitializeComponent method (or equivalent region where controls are initialized), update the assignment to _buttonCancel.Anchor to remove the outer cast and the inner cast, leaving a plain bitwise-or expression. No additional imports, methods, or definitions are required; this is a pure cleanup of the existing expression. The same pattern for _buttonOK.Anchor appears above but was not flagged; per the instructions, only the shown, highlighted code on line 156 will be changed.
| @@ -153,7 +153,7 @@ | ||
| // | ||
| // _buttonCancel | ||
| // | ||
| this._buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); | ||
| this._buttonCancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right; | ||
| this._buttonCancel.AutoSize = true; | ||
| this._buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; | ||
| this.locExtender.SetLocalizableToolTip(this._buttonCancel, null); |
There was a problem hiding this comment.
True, but this is generated Designer code.
tombogle
left a comment
There was a problem hiding this comment.
@tombogle made 2 comments and resolved 2 discussions.
Reviewable status: 0 of 11 files reviewed, all discussions resolved (waiting on andrew-polk, mark-sil, and megahirt).
| // | ||
| // _buttonOK | ||
| // | ||
| this._buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
There was a problem hiding this comment.
True, but this is generated Designer code.
| // | ||
| // _buttonCancel | ||
| // | ||
| this._buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
There was a problem hiding this comment.
True, but this is generated Designer code.


Added elements to TestApp to exercise the new Privacy dialog
This change is