oqtane.framework/Oqtane.Client/Modules/Controls/TriStateCheckBox.razor
Hisham Bin Ateya 66ad089088
Refactoring (#314)
* Refactoring

* Refactoring

* Check for a valid email.

* Fixed missing character.

* Moved logic to  the Utilities class.

* Rename template .sql file

* Modified null and empty string check.

* Check for a valid email.

* Fixed missing character.

* Moved logic to  the Utilities class.

* Added Favicon support, Progressive Web App support, page title and url support, and private/public user registration options

* Refactoring

* Refactoring

* Check for a valid email.

* Moved logic to  the Utilities class.

Co-authored-by: Aubrey <aubrey.b@treskcow.tech>
Co-authored-by: MIchael Atwood <matwood@dragonmastery.com>
Co-authored-by: Shaun Walker <shaun.walker@siliqon.com>
2020-03-31 10:21:05 -04:00

68 lines
1.4 KiB
Plaintext

@namespace Oqtane.Modules.Controls
<img src="@_src" title="@_title" @onclick="SetValue" />
@code {
private bool? _value = null;
private string _title;
private string _src = string.Empty;
[Parameter]
public bool? Value { get; set; }
[Parameter]
public bool Disabled { get; set; }
[Parameter]
public Action<bool?> OnChange { get; set; }
protected override void OnInitialized()
{
_value = Value;
SetImage();
}
private void SetValue()
{
if (!Disabled)
{
switch (_value)
{
case true:
_value = false;
break;
case false:
_value = null;
break;
case null:
_value = true;
break;
}
SetImage();
OnChange(_value);
}
}
private void SetImage()
{
switch (_value)
{
case true:
_src = "images/checked.png";
_title = "Permission Granted";
break;
case false:
_src = "images/unchecked.png";
_title = "Permission Denied";
break;
case null:
_src = "images/null.png";
_title = string.Empty;
break;
}
StateHasChanged();
}
}