-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into migration---avoid-using-single-chart-when-sc…
…aled
- Loading branch information
Showing
41 changed files
with
645 additions
and
18 deletions.
There are no files selected for viewing
Binary file added
BIN
+12.9 KB
...-firstdayofweek-to-monday-on-a-monthcalendar/monthcalendarfirstdayofweekbad.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13 KB
...firstdayofweek-to-monday-on-a-monthcalendar/monthcalendarfirstdayofweekgood.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
rules/always-set-firstdayofweek-to-monday-on-a-monthcalendar/rule.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
type: rule | ||
title: Do you always set FirstDayOfWeek to Monday on a MonthCalendar? | ||
uri: always-set-firstdayofweek-to-monday-on-a-monthcalendar | ||
authors: | ||
- title: Adam Cogan | ||
url: https://ssw.com.au/people/adam-cogan/ | ||
created: 2014-03-14T02:02:00.000Z | ||
guid: 4207265d-5968-4baf-a294-df489fa32517 | ||
--- | ||
It is always good idea to set FirstDayOfWeek property to Monday to initialize it instead of leave it with the dafault value. | ||
|
||
<!--endintro--> | ||
|
||
::: bad | ||
![Figure: Bad example - FirstDayOfWeek is default](monthcalendarfirstdayofweekbad.gif) | ||
::: | ||
|
||
::: good | ||
![Figure: Good example - FirstDayOfWeek set to Monday](monthcalendarfirstdayofweekgood.gif) | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
type: rule | ||
title: Do you always use GridView instead of ListBox? | ||
uri: always-use-gridview-instead-of-listbox | ||
authors: | ||
- title: Adam Cogan | ||
url: https://ssw.com.au/people/adam-cogan/ | ||
created: 2014-03-14T02:01:00.000Z | ||
guid: 62fdd9ea-cbec-4e93-8547-1da7c2ec13fa | ||
--- | ||
Always choose a GridView (over a ListBox) because it can have: | ||
|
||
<!--endintro--> | ||
|
||
1. Multiple columns | ||
2. Checkboxes in the header of the control, which enables users to easily check or uncheck all items | ||
3. Add sub-controls added such as buttons, links, charts, and even customized controls to the Gridview. This means you get unlimited flexibility with the GridView | ||
|
||
::: bad | ||
![Figure: Bad example - No header rows and no checkbox to check or uncheck all items. None of this can be done with the ListView](datagridviewbad.png) | ||
::: | ||
|
||
::: good | ||
![Figure: Good example - A header row and a checkbox to control all items, and multiple columns give users a richer experience. This can all be done using a GridView](datagridviewgood.png) | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+71.2 KB
rules/do-you-save-user-settings-and-reuse-them-by-default/defaultvalue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions
17
rules/do-you-save-user-settings-and-reuse-them-by-default/rule.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
type: rule | ||
title: Do you save user settings and reuse them by default? | ||
uri: do-you-save-user-settings-and-reuse-them-by-default | ||
authors: | ||
- title: Adam Cogan | ||
url: https://ssw.com.au/people/adam-cogan/ | ||
created: 2014-03-14T00:22:00.000Z | ||
guid: 4fbed628-95fc-4d29-9637-12b6df5958b7 | ||
--- | ||
There should always be default values in your application if you allow users to change the settings. This will help your users to have a better first time experience and insure the application work as expected. | ||
|
||
<!--endintro--> | ||
|
||
However when the users change settings for their own preference, it is better to save these settings and give user has a better return experience, your application looks smarter in this way. | ||
|
||
![Figure: Save user setting](defaultvalue.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
rules/have-a-resetdefault-function-to-handle-messed-up-user-settings/rule.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
type: rule | ||
title: Do you have a ResetDefault() function to handle messed up user settings? | ||
uri: have-a-resetdefault-function-to-handle-messed-up-user-settings | ||
authors: | ||
- title: Adam Cogan | ||
url: https://ssw.com.au/people/adam-cogan/ | ||
created: 2014-03-14T00:22:00.000Z | ||
guid: 6696b1b2-dcd7-475a-990e-b5d610f0a122 | ||
--- | ||
In development life cycle, developers always have different settings to the user's settings. Because of this, debug settings won't always work on the remote machine. | ||
|
||
In order to have settings.config, we also have a defaults.config. This is good because this gives a chance for the user to roll back bad settings without reinstalling the application. The application can also roll back the settings it automatically. Below is the code that what we do. | ||
|
||
<!--endintro--> | ||
|
||
VB.NET | ||
|
||
```vb | ||
Public Sub RuneXtremeEmail(ByVal state As Object) | ||
|
||
If Environment.MachineName <> Configuration.MachineName Then | ||
|
||
resetSettings() | ||
|
||
Else | ||
End | ||
``` | ||
|
||
We have a program called [SSW Code Auditor](https://ssw.com.au/ssw/CodeAuditor/) to check for this rule. | ||
|
||
We have a program called [SSW .NET Toolkit](https://ssw.com.au/ssw/NETToolkit/) that implements this rule. | ||
|
||
*Note: in Access we do like this* | ||
|
||
```vb | ||
Private Sub Form_Load() | ||
|
||
If Nz(DLookup("CurrentComputerName", "ControlLocal", "ID=1"), "") <> CurrentComputerName | ||
Then | ||
Me.ctlCurrentComputerName.Value = CurrentComputerName | ||
Else ... | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
type: rule | ||
title: Do you include "Back" and "Undo" buttons on every form? | ||
uri: include-back-and-undo-buttons-on-every-form | ||
authors: | ||
- title: Adam Cogan | ||
url: https://ssw.com.au/people/adam-cogan | ||
created: 2014-03-14T00:22:00.000Z | ||
guid: 3fbae7db-7cec-4daa-8371-47261cd6117b | ||
--- | ||
|
||
Following on from including a URL, almost every form should have a Back and an Undo button which takes you back to the previous screen, or reverses the last action. This is just like Outlook (see figure below), it has a Back button to take you to the previous folder and an Undo button. | ||
|
||
<!--endintro--> | ||
|
||
::: good | ||
![Figure: Good example - Back & Undo buttons in Outlook Advanced toolbar](outlookviewbar.jpg) | ||
::: | ||
|
||
**Notes:** | ||
- "Back" button should only be implemented if different views can be shown in the same window | ||
- Don't put "Undo" buttons on non data entry forms such as a Print Preview form | ||
|
||
The list of forms/URLs and the order in which they have been accessed should be stored in a DataSet held in memory (like IE) - not saved to disk. | ||
|
||
For example: | ||
|
||
| **Menu** | **Action** | **Undo** | **Back** | | ||
| ----------- | ----------------------------------------------------------------- | -------------------- | ----------- | | ||
| Cut | Remember: Remember Text and Cursor Position <br>Cut To Clipboard | Return to Remember | n/a | | ||
| Save Record | Remember old values <br>Execute procCustomerSave <br>Close Form | Return to Old values | Reopen form | | ||
|
||
Sample code implementation in the [SSW .NET Toolkit](https://ssw.com.au/ssw/NETToolkit). |
36 changes: 36 additions & 0 deletions
36
rules/know-how-to-run-write-application-to-run-with-uac-turn-on/rule.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
type: rule | ||
title: Do you know how to run write application to run with UAC turn on? | ||
uri: know-how-to-run-write-application-to-run-with-uac-turn-on | ||
authors: | ||
- title: Adam Cogan | ||
url: https://ssw.com.au/people/adam-cogan/ | ||
created: 2014-03-14T02:02:00.000Z | ||
guid: d159fc8d-8b7f-4eb3-b6b8-8c193e69ca05 | ||
--- | ||
Some applications may need to have administrator right for running the application, e.g. create a file, access system library, etc. It will be an issue for the application to run if UAC is turned on. Below is the step to solve the issue: | ||
|
||
<!--endintro--> | ||
|
||
1. Add App.Manifest into WindowsUI project. It should contain the below code: | ||
|
||
```xml | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" | ||
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/> | ||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> | ||
<security> | ||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> | ||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> | ||
</requestedPrivileges> | ||
</security> | ||
</trustInfo> | ||
</asmv1:assembly> | ||
``` | ||
|
||
**App.Manifest** | ||
|
||
2. Change the project settings for WindowsUI to use the newly created App.Manifest. | ||
|
||
![Figure: Use the newly created App.Manifest](setmanifest.jpg) |
Binary file added
BIN
+121 KB
rules/know-how-to-run-write-application-to-run-with-uac-turn-on/setmanifest.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+28.9 KB
rules/make-common-controls-with-consistent-widths/commoncontrolbad.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+23.4 KB
rules/make-common-controls-with-consistent-widths/commoncontrolgood.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
type: rule | ||
title: Do you make common controls with consistent widths? | ||
uri: make-common-controls-with-consistent-widths | ||
authors: | ||
- title: Adam Cogan | ||
url: https://ssw.com.au/people/adam-cogan/ | ||
created: 2014-03-14T00:22:00.000Z | ||
guid: abfaa422-644f-4b9f-afa0-9c0374e097b2 | ||
--- | ||
|
||
There are a few common controls we always use in our products. For example, DateTime and Ellipsis Button. We need a standard for the width so the controls should be more consistent. | ||
|
||
<!--endintro--> | ||
|
||
**Note:** Controls on base forms will be made to be 'protected' rather than 'private', especially so that inherited forms of different sizes don't mess up. | ||
|
||
::: bad | ||
![Figure: Bad example - Control sizes are not consistent](commoncontrolbad.gif) | ||
::: | ||
|
||
::: good | ||
![Figure: Good example - Control sizes are all standard and consistent](commoncontrolgood.gif) | ||
::: | ||
|
||
::: bad | ||
![Figure: Bad example - Non-standard size for Add & Delete buttons](adddeletebad.gif) | ||
::: | ||
|
||
::: good | ||
![Figure: Good example - Standard size for Add & Delete buttons](adddeletegood.gif) | ||
::: | ||
|
||
We have a program called [SSW Code Auditor](https://ssw.com.au/ssw/CodeAuditor/Rules.aspx#CommonControl) to check for the following two rules: | ||
|
||
**Rule - C#/VB.NET UI- Button Height and Width - for Standard Button (75 x 23 pixels)** | ||
- **Level 2:** All buttons \< 6 characters:** Check the standard size (75 X 23 pixels) for buttons with the word length less than or equal to six characters, except the following buttons. | ||
- **Level 1:** The action buttons:** Check the standard size (75 X 23 pixels) for the following action buttons: | ||
|
||
- Add | ||
- Delete | ||
- Edit | ||
- OK | ||
- Close | ||
- Cancel | ||
- Save | ||
- Browse | ||
- Select | ||
- Test< | ||
- Next | ||
- Back | ||
- Remove | ||
- Refresh (Exception to the rule as it has 7 letters) |
69 changes: 69 additions & 0 deletions
69
rules/prevent-users-from-running-two-instances-of-your-application/rule.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
type: rule | ||
title: Do you prevent users from running two instances of your application? | ||
uri: prevent-users-from-running-two-instances-of-your-application | ||
authors: | ||
- title: Adam Cogan | ||
url: https://ssw.com.au/people/adam-cogan/ | ||
created: 2014-03-14T00:22:00.000Z | ||
guid: 9fcfbe56-37b2-4f74-9247-12151fd21c8f | ||
--- | ||
|
||
In some cases, running two instances of an application at the same time may cause unexpected result. See this issue is solved via the code below on [SSW Exchange Reporter](/ssw/ExchangeReporter/): | ||
|
||
<!--endintro--> | ||
|
||
```cs | ||
try | ||
{ | ||
Process current = Process.GetCurrentProcess(); | ||
Process[] processes = Process.GetProcessesByName( current.ProcessName); | ||
|
||
if ( processes.Length>1 ) | ||
{ | ||
DialogResult userOption = MessageBox.Show(Application.ProductName + " is already running on this machine. " + Environment.NewLine+Environment.NewLine + "Please click: "+Environment.NewLine+ | ||
" - 'Try again' to exit the other instance and try again, or "+Environment.NewLine+ | ||
" - 'Cancel' to exit now."+Environment.NewLine, | ||
Application.ProductName+" "+(new Version(Application.ProductVersion)).ToString(2), | ||
|
||
MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning); | ||
switch(userOption) | ||
{ | ||
case DialogResult.Cancel: return; | ||
|
||
case DialogResult.Retry: | ||
foreach(Process currProcess in processes) | ||
{ | ||
if ( currProcess.Id != current.Id) | ||
{ | ||
currProcess.Kill(); | ||
} | ||
} | ||
break; | ||
} | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
TracingHelper.Trace(null, Loggers.WindowsUILogger, TracingLevels.DEBUG, "Cannot get process information, Excpetion occured.", ex) ; | ||
|
||
DialogResult result = MessageBox.Show("Exchange Reporter cannot detect process information. This may be caused by disabled 'Performance Counter' on your machine. "+Environment.NewLine+ | ||
"In such case, Exchange Reporter cannot ensure there is only one instance running. "+ | ||
Environment.NewLine+ | ||
"You may continue to run Exchange Reporter, however, please make sure you have only one instance of Exchange Reporter running. "+ | ||
Environment.NewLine+ | ||
"Multiple instances will cause unexpected behaviour. "+ | ||
Environment.NewLine+Environment.NewLine+ | ||
"Please click 'OK' to continue, or click 'Cancel' to quit." | ||
, Application.ProductName+" "+(new Version(Application.ProductVersion)).ToString(2), | ||
MessageBoxButtons.OKCancel, | ||
MessageBoxIcon.Warning); | ||
|
||
if ( result == DialogResult.Cancel) | ||
{ | ||
return; | ||
} | ||
} | ||
``` | ||
**Code: Avoid running two instances of an application** | ||
|
Oops, something went wrong.