Remove NStack and replace ustring to string.

This commit is contained in:
BDisp
2023-05-07 18:16:52 +01:00
parent dea5f0fe03
commit 2a63ede8ba
145 changed files with 2800 additions and 2702 deletions

View File

@@ -1,6 +1,6 @@
using System.Reactive.Disposables;
using System.Reactive.Linq;
using NStack;
using System.Text;
using ReactiveUI;
using Terminal.Gui;
using ReactiveMarbles.ObservableEvents;
@@ -64,7 +64,7 @@ namespace ReactiveExample {
};
ViewModel
.WhenAnyValue (x => x.UsernameLength)
.Select (length => ustring.Make ($"Username ({length} characters)"))
.Select (length => $"Username ({length} characters)")
.BindTo (usernameLengthLabel, x => x.Text)
.DisposeWith (_disposable);
Add (usernameLengthLabel);
@@ -100,7 +100,7 @@ namespace ReactiveExample {
};
ViewModel
.WhenAnyValue (x => x.PasswordLength)
.Select (length => ustring.Make ($"Password ({length} characters)"))
.Select (length => $"Password ({length} characters)")
.BindTo (passwordLengthLabel, x => x.Text)
.DisposeWith (_disposable);
Add (passwordLengthLabel);
@@ -108,8 +108,8 @@ namespace ReactiveExample {
}
Label ValidationLabel (View previous) {
var error = ustring.Make("Please, enter user name and password.");
var success = ustring.Make("The input is valid!");
var error = "Please, enter user name and password.";
var success = "The input is valid!";
var validationLabel = new Label(error) {
X = Pos.Left(previous),
Y = Pos.Top(previous) + 1,
@@ -130,8 +130,8 @@ namespace ReactiveExample {
}
Label LoginProgressLabel (View previous) {
var progress = ustring.Make ("Logging in...");
var idle = ustring.Make ("Press 'Login' to log in.");
var progress = "Logging in...";
var idle = "Press 'Login' to log in.";
var loginProgressLabel = new Label(idle) {
X = Pos.Left(previous),
Y = Pos.Top(previous) + 1,

View File

@@ -3,7 +3,7 @@ using System.Reactive;
using System.Reactive.Linq;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using NStack;
using System.Text;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
@@ -30,8 +30,8 @@ namespace ReactiveExample {
x => x.Username,
x => x.Password,
(username, password) =>
!ustring.IsNullOrEmpty (username) &&
!ustring.IsNullOrEmpty (password));
!string.IsNullOrEmpty (username) &&
!string.IsNullOrEmpty (password));
_isValid = canLogin.ToProperty (this, x => x.IsValid);
Login = ReactiveCommand.CreateFromTask (
@@ -49,16 +49,16 @@ namespace ReactiveExample {
Clear = ReactiveCommand.Create (() => { });
Clear.Subscribe (unit => {
Username = ustring.Empty;
Password = ustring.Empty;
Username = string.Empty;
Password = string.Empty;
});
}
[Reactive, DataMember]
public ustring Username { get; set; } = ustring.Empty;
public string Username { get; set; } = string.Empty;
[Reactive, DataMember]
public ustring Password { get; set; } = ustring.Empty;
public string Password { get; set; } = string.Empty;
[IgnoreDataMember]
public int UsernameLength => _usernameLength.Value;

View File

@@ -38,7 +38,7 @@ usernameInput
.BindTo (ViewModel, x => x.Username);
```
If you combine `OneWay` and `OneWayToSource` data bindings, you get `TwoWay` data binding. Also be sure to use the `ustring` type instead of the `string` type. Invoking commands should be as simple as this:
If you combine `OneWay` and `OneWayToSource` data bindings, you get `TwoWay` data binding. Also be sure to use the `string` type instead of the `string` type. Invoking commands should be as simple as this:
```cs
// 'clearButton' is 'Button'
clearButton