-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added data validation and automatic closing to the published protocol form. Not an elegant solution at the moment, but it works!
- Loading branch information
1 parent
3b468bd
commit 3713407
Showing
5 changed files
with
112 additions
and
13 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Text; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
|
||
namespace ProtocolMasterWPF.Helpers | ||
{ | ||
public class IsEnabledConverter : IMultiValueConverter | ||
{ | ||
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) | ||
{ | ||
if (values.LongLength > 0) | ||
{ | ||
foreach (var value in values) | ||
{ | ||
if (value is bool && (bool)value) | ||
{ | ||
return false; | ||
} | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
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,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Text; | ||
using System.Windows.Controls; | ||
|
||
namespace ProtocolMasterWPF.Helpers | ||
{ | ||
public class NotEmptyValidationRule : ValidationRule | ||
{ | ||
public override ValidationResult Validate(object value, CultureInfo cultureInfo) | ||
{ | ||
return string.IsNullOrWhiteSpace((value ?? "").ToString()) | ||
? new ValidationResult(false, "Field is required.") | ||
: ValidationResult.ValidResult; | ||
} | ||
} | ||
} |
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