feat: clean up warnings.
This commit is contained in:
@@ -8,34 +8,29 @@ namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public class BreadcrumbDemoViewModel: ObservableObject
|
||||
{
|
||||
public ObservableCollection<BreadcrumbDemoItem> Items1 { get; set; }
|
||||
|
||||
public BreadcrumbDemoViewModel()
|
||||
{
|
||||
Items1 = new ObservableCollection<BreadcrumbDemoItem>()
|
||||
{
|
||||
new BreadcrumbDemoItem() { Section = "Home", Icon = "Home" },
|
||||
new BreadcrumbDemoItem() { Section = "Page 1", Icon = "Page" },
|
||||
new BreadcrumbDemoItem() { Section = "Page 2", Icon = "Page" },
|
||||
new BreadcrumbDemoItem() { Section = "Page 3", Icon = "Page" },
|
||||
new BreadcrumbDemoItem() { Section = "Page 4", Icon = "Page", IsReadOnly = true},
|
||||
};
|
||||
}
|
||||
public ObservableCollection<BreadcrumbDemoItem> Items1 { get; set; } =
|
||||
[
|
||||
new BreadcrumbDemoItem { Section = "Home", Icon = "Home" },
|
||||
new BreadcrumbDemoItem { Section = "Page 1", Icon = "Page" },
|
||||
new BreadcrumbDemoItem { Section = "Page 2", Icon = "Page" },
|
||||
new BreadcrumbDemoItem { Section = "Page 3", Icon = "Page" },
|
||||
new BreadcrumbDemoItem { Section = "Page 4", Icon = "Page", IsReadOnly = true }
|
||||
];
|
||||
}
|
||||
|
||||
public partial class BreadcrumbDemoItem: ObservableObject
|
||||
{
|
||||
public string Section { get; set; }
|
||||
public string Icon { get; set; }
|
||||
public string? Section { get; set; }
|
||||
public string? Icon { get; set; }
|
||||
[ObservableProperty] private bool _isReadOnly;
|
||||
|
||||
public ICommand Command { get; set; }
|
||||
|
||||
public BreadcrumbDemoItem()
|
||||
{
|
||||
Command = new RelayCommand(() =>
|
||||
Command = new AsyncRelayCommand(async () =>
|
||||
{
|
||||
MessageBox.ShowOverlayAsync(Section);
|
||||
await MessageBox.ShowOverlayAsync(Section ?? string.Empty);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,8 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Ursa.Common;
|
||||
using Ursa.Controls;
|
||||
using Ursa.Demo.Dialogs;
|
||||
using Ursa.Demo.Pages;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Input;
|
||||
using Avalonia.Animation;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Data;
|
||||
@@ -9,7 +8,6 @@ using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Layout;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public partial class FormDemoViewModel : ObservableObject
|
||||
|
||||
public partial class DataModel : ObservableObject
|
||||
{
|
||||
private string _name;
|
||||
private string _name = string.Empty;
|
||||
|
||||
[MinLength(10)]
|
||||
public string Name
|
||||
@@ -55,7 +55,7 @@ public partial class DataModel : ObservableObject
|
||||
set => SetProperty(ref _number, value);
|
||||
}
|
||||
|
||||
private string _email;
|
||||
private string _email = string.Empty;
|
||||
|
||||
[EmailAddress]
|
||||
public string Email
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using System;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
@@ -67,6 +68,7 @@ public class MainViewViewModel : ViewModelBase
|
||||
MenuKeys.MenuKeyToolBar => new ToolBarDemoViewModel(),
|
||||
MenuKeys.MenuKeyTimeBox => new TimeBoxDemoViewModel(),
|
||||
MenuKeys.MenuKeyVerificationCode => new VerificationCodeDemoViewModel(),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(s), s, null)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,10 @@ public enum ControlStatus
|
||||
|
||||
public class MenuItemViewModel: ViewModelBase
|
||||
{
|
||||
public string MenuHeader { get; set; }
|
||||
public string MenuIconName { get; set; }
|
||||
public string Key { get; set; }
|
||||
public string Status { get; set; }
|
||||
public string? MenuHeader { get; set; }
|
||||
public string? MenuIconName { get; set; }
|
||||
public string? Key { get; set; }
|
||||
public string? Status { get; set; }
|
||||
|
||||
public bool IsSeparator { get; set; }
|
||||
public ObservableCollection<MenuItemViewModel> Children { get; set; } = new();
|
||||
@@ -31,7 +31,7 @@ public class MenuItemViewModel: ViewModelBase
|
||||
|
||||
private void OnActivate()
|
||||
{
|
||||
if (IsSeparator) return;
|
||||
WeakReferenceMessenger.Default.Send<string>(Key);
|
||||
if (IsSeparator || Key is null) return;
|
||||
WeakReferenceMessenger.Default.Send(Key);
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ public class MessageBoxDemoViewModel: ObservableObject
|
||||
|
||||
private readonly string _shortMessage = "Welcome to Ursa Avalonia!";
|
||||
private string _message;
|
||||
private string _title;
|
||||
private string? _title;
|
||||
|
||||
public ICommand DefaultMessageBoxCommand { get; set; }
|
||||
public ICommand OkCommand { get; set; }
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Layout;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Ursa.Controls;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
@@ -14,39 +11,36 @@ public partial class NumericUpDownDemoViewModel : ObservableObject
|
||||
|
||||
|
||||
private double _oldWidth = 300;
|
||||
[ObservableProperty] private bool _AutoWidth = true;
|
||||
[ObservableProperty] private double _Width = Double.NaN;
|
||||
[ObservableProperty] private uint _Value;
|
||||
[ObservableProperty] private string _FontFamily = "Consolas";
|
||||
[ObservableProperty] private bool _AllowDrag = false;
|
||||
[ObservableProperty] private bool _IsReadOnly = false;
|
||||
[ObservableProperty] private bool _autoWidth = true;
|
||||
[ObservableProperty] private double _width = double.NaN;
|
||||
[ObservableProperty] private uint _value;
|
||||
[ObservableProperty] private string _fontFamily = "Consolas";
|
||||
[ObservableProperty] private bool _allowDrag;
|
||||
[ObservableProperty] private bool _isReadOnly;
|
||||
|
||||
[ObservableProperty] private Array _Array_HorizontalAlignment;
|
||||
[ObservableProperty] private HorizontalAlignment _HorizontalAlignment = HorizontalAlignment.Center;
|
||||
[ObservableProperty] private Array _arrayHorizontalAlignment;
|
||||
[ObservableProperty] private HorizontalAlignment _horizontalAlignment = HorizontalAlignment.Center;
|
||||
|
||||
[ObservableProperty] private Array _Array_HorizontalContentAlignment;
|
||||
[ObservableProperty] private HorizontalAlignment _HorizontalContentAlignment = HorizontalAlignment.Center;
|
||||
[ObservableProperty] private object? _InnerLeftContent = "obj:0x";
|
||||
[ObservableProperty] private string _Watermark = "Water mark showed";
|
||||
[ObservableProperty] private string _FormatString = "X8";
|
||||
[ObservableProperty] private Array _Array_ParsingNumberStyle;
|
||||
[ObservableProperty] private NumberStyles _ParsingNumberStyle = NumberStyles.AllowHexSpecifier;
|
||||
[ObservableProperty] private bool _AllowSpin = true;
|
||||
[ObservableProperty] private bool _ShowButtonSpinner = true;
|
||||
[ObservableProperty] private Array _arrayHorizontalContentAlignment;
|
||||
[ObservableProperty] private HorizontalAlignment _horizontalContentAlignment = HorizontalAlignment.Center;
|
||||
[ObservableProperty] private object? _innerLeftContent = "obj:0x";
|
||||
[ObservableProperty] private string _watermark = "Water mark showed";
|
||||
[ObservableProperty] private string _formatString = "X8";
|
||||
[ObservableProperty] private Array _arrayParsingNumberStyle;
|
||||
[ObservableProperty] private NumberStyles _parsingNumberStyle = NumberStyles.AllowHexSpecifier;
|
||||
[ObservableProperty] private bool _allowSpin = true;
|
||||
[ObservableProperty] private bool _showButtonSpinner = true;
|
||||
|
||||
[ObservableProperty] private UInt32 _Maximum = UInt32.MaxValue;
|
||||
[ObservableProperty] private UInt32 _Minimum = UInt32.MinValue;
|
||||
[ObservableProperty] private UInt32 _Step = 1;
|
||||
[ObservableProperty] private UInt32 _maximum = UInt32.MaxValue;
|
||||
[ObservableProperty] private UInt32 _minimum = UInt32.MinValue;
|
||||
[ObservableProperty] private UInt32 _step = 1;
|
||||
|
||||
[ObservableProperty] private bool _IsEnable = true;
|
||||
[ObservableProperty] private bool _isEnable = true;
|
||||
|
||||
[ObservableProperty] private string _CommandUpdateText = "Command not Execute";
|
||||
|
||||
uint v = 0;
|
||||
[ObservableProperty] private string _commandUpdateText = "Command not Execute";
|
||||
|
||||
[RelayCommand]
|
||||
// void Trythis()
|
||||
void Trythis(uint v)
|
||||
// void Trythis(object v)
|
||||
{
|
||||
CommandUpdateText = $"Command Exe,CommandParameter={v}";
|
||||
}
|
||||
@@ -54,12 +48,9 @@ public partial class NumericUpDownDemoViewModel : ObservableObject
|
||||
|
||||
public NumericUpDownDemoViewModel()
|
||||
{
|
||||
Array_HorizontalContentAlignment = Enum.GetValues(typeof(HorizontalAlignment));
|
||||
Array_HorizontalAlignment = Enum.GetValues(typeof(HorizontalAlignment));
|
||||
Array_ParsingNumberStyle = Enum.GetValues(typeof(NumberStyles));
|
||||
NumericUIntUpDown numericUIntUpDown;
|
||||
TextBox textBox;
|
||||
|
||||
ArrayHorizontalContentAlignment = Enum.GetValues(typeof(HorizontalAlignment));
|
||||
ArrayHorizontalAlignment = Enum.GetValues(typeof(HorizontalAlignment));
|
||||
ArrayParsingNumberStyle = Enum.GetValues(typeof(NumberStyles));
|
||||
}
|
||||
|
||||
partial void OnAutoWidthChanged(bool value)
|
||||
@@ -74,10 +65,4 @@ public partial class NumericUpDownDemoViewModel : ObservableObject
|
||||
Width = _oldWidth;
|
||||
}
|
||||
}
|
||||
|
||||
partial void OnValueChanging(uint oldValue, uint newValue)
|
||||
{
|
||||
// Console.WriteLine(oldValue);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Input;
|
||||
using Avalonia.Collections;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ursa.Demo.ViewModels
|
||||
namespace Ursa.Demo.ViewModels
|
||||
{
|
||||
public class SkeletonDemoViewModel : ViewModelBase
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
|
||||
@@ -23,21 +23,21 @@ public partial class ToolBarDemoViewModel : ObservableObject
|
||||
{
|
||||
Items = new()
|
||||
{
|
||||
new ToolBarButtonItemViewModel() { Content = "New", OverflowMode = OverflowMode.AsNeeded },
|
||||
new ToolBarButtonItemViewModel() { Content = "Open" },
|
||||
new ToolBarButtonItemViewModel() { Content = "Save1" },
|
||||
new ToolBarButtonItemViewModel() { Content = "Save2" },
|
||||
new ToolBarButtonItemViewModel { Content = "New", OverflowMode = OverflowMode.AsNeeded },
|
||||
new ToolBarButtonItemViewModel { Content = "Open" },
|
||||
new ToolBarButtonItemViewModel { Content = "Save1" },
|
||||
new ToolBarButtonItemViewModel { Content = "Save2" },
|
||||
new ToolBarSeparatorViewModel(),
|
||||
new ToolBarButtonItemViewModel() { Content = "Save3" },
|
||||
new ToolBarButtonItemViewModel() { Content = "Save4" },
|
||||
new ToolBarButtonItemViewModel() { Content = "Save5" },
|
||||
new ToolBarButtonItemViewModel() { Content = "Save6" },
|
||||
new ToolBarButtonItemViewModel() { Content = "Save7" },
|
||||
new ToolBarButtonItemViewModel { Content = "Save3" },
|
||||
new ToolBarButtonItemViewModel { Content = "Save4" },
|
||||
new ToolBarButtonItemViewModel { Content = "Save5" },
|
||||
new ToolBarButtonItemViewModel { Content = "Save6" },
|
||||
new ToolBarButtonItemViewModel { Content = "Save7" },
|
||||
new ToolBarSeparatorViewModel(),
|
||||
new ToolBarButtonItemViewModel() { Content = "Save8" },
|
||||
new ToolBarCheckBoxItemViweModel() { Content = "Bold" },
|
||||
new ToolBarCheckBoxItemViweModel() { Content = "Italic", OverflowMode = OverflowMode.Never },
|
||||
new ToolBarComboBoxItemViewModel() { Content = "Font Size", Items = new() { "10", "12", "14" } }
|
||||
new ToolBarButtonItemViewModel { Content = "Save8" },
|
||||
new ToolBarCheckBoxItemViweModel { Content = "Bold" },
|
||||
new ToolBarCheckBoxItemViweModel { Content = "Italic", OverflowMode = OverflowMode.Never },
|
||||
new ToolBarComboBoxItemViewModel { Content = "Font Size", Items = ["10", "12", "14"] }
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -49,41 +49,40 @@ public abstract class ToolBarItemViewModel : ObservableObject
|
||||
|
||||
public class ToolBarButtonItemViewModel : ToolBarItemViewModel
|
||||
{
|
||||
public string Content { get; set; }
|
||||
public ICommand Command { get; set; }
|
||||
public string? Content { get; set; }
|
||||
public ICommand? Command { get; set; }
|
||||
|
||||
public ToolBarButtonItemViewModel()
|
||||
{
|
||||
Command = new AsyncRelayCommand(async () => { await MessageBox.ShowOverlayAsync(Content); });
|
||||
Command = new AsyncRelayCommand(async () => { await MessageBox.ShowOverlayAsync(Content ?? string.Empty); });
|
||||
}
|
||||
}
|
||||
|
||||
public class ToolBarCheckBoxItemViweModel : ToolBarItemViewModel
|
||||
{
|
||||
public string Content { get; set; }
|
||||
public string? Content { get; set; }
|
||||
public bool IsChecked { get; set; }
|
||||
public ICommand Command { get; set; }
|
||||
public ICommand? Command { get; set; }
|
||||
|
||||
public ToolBarCheckBoxItemViweModel()
|
||||
{
|
||||
Command = new AsyncRelayCommand(async () => { await MessageBox.ShowOverlayAsync(Content); });
|
||||
Command = new AsyncRelayCommand(async () => { await MessageBox.ShowOverlayAsync(Content ?? string.Empty); });
|
||||
}
|
||||
}
|
||||
|
||||
public class ToolBarComboBoxItemViewModel : ToolBarItemViewModel
|
||||
{
|
||||
public string Content { get; set; }
|
||||
public ObservableCollection<string> Items { get; set; }
|
||||
public string? Content { get; set; }
|
||||
public ObservableCollection<string>? Items { get; set; }
|
||||
|
||||
private string _selectedItem;
|
||||
|
||||
public string SelectedItem
|
||||
private string? _selectedItem;
|
||||
public string? SelectedItem
|
||||
{
|
||||
get => _selectedItem;
|
||||
set
|
||||
{
|
||||
SetProperty(ref _selectedItem, value);
|
||||
MessageBox.ShowOverlayAsync(value);
|
||||
_ = MessageBox.ShowOverlayAsync(value ?? string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Avalonia.Collections;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Ursa.Controls;
|
||||
|
||||
Reference in New Issue
Block a user