-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
130 additions
and
83 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,42 @@ | ||
using ReactiveUI; | ||
|
||
namespace MQTTnetApp.Common; | ||
|
||
public abstract class BaseSingleSelectionViewModel : BaseViewModel | ||
{ | ||
readonly bool[] _states; | ||
|
||
protected BaseSingleSelectionViewModel(int count) | ||
{ | ||
_states = new bool[count]; | ||
} | ||
|
||
protected bool GetState(int index) | ||
{ | ||
return _states[index]; | ||
} | ||
|
||
protected void UpdateStates(int changedStateIndex, bool changedStateValue) | ||
{ | ||
if (!changedStateValue) | ||
{ | ||
// Do not allow "unchecking" the value. | ||
return; | ||
} | ||
|
||
for (var i = 0; i < _states.Length; i++) | ||
{ | ||
if (i == changedStateIndex) | ||
{ | ||
_states[i] = changedStateValue; | ||
} | ||
else | ||
{ | ||
_states[i] = !changedStateValue; | ||
} | ||
} | ||
|
||
// Notify all properties! | ||
this.RaisePropertyChanged(string.Empty); | ||
} | ||
} |
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
21 changes: 8 additions & 13 deletions
21
Source/Controls/QualityOfServiceLevel/QualityOfServiceLevelSelectorViewModel.cs
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
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
20 changes: 12 additions & 8 deletions
20
Source/Pages/Publish/PayloadFormatIndicatorSelectorViewModel.cs
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
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,14 @@ | ||
<Styles xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
<Design.PreviewWith> | ||
<Border Padding="20"> | ||
<!-- Add Controls for Previewer Here --> | ||
</Border> | ||
</Design.PreviewWith> | ||
|
||
<Style Selector="RadioButton"> | ||
<Setter Property="MinHeight" | ||
Value="26" /> | ||
</Style> | ||
|
||
</Styles> |