feat: clean up warnings.

This commit is contained in:
rabbitism
2024-07-30 18:33:30 +08:00
parent e1f91f612b
commit 15fb5a2d1b
167 changed files with 473 additions and 825 deletions

View File

@@ -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);
}
}
}