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

@@ -14,11 +14,11 @@ public class ToolBarItemTemplateSelector: IDataTemplate
public Control? Build(object? param)
{
if (param is null) return null;
if (param is ToolBarSeparatorViewModel sep)
if (param is ToolBarSeparatorViewModel)
{
return new ToolBarSeparator();
}
if (param is ToolBarButtonItemViewModel vm)
if (param is ToolBarButtonItemViewModel)
{
return new Button()
{
@@ -27,7 +27,7 @@ public class ToolBarItemTemplateSelector: IDataTemplate
[!ToolBar.OverflowModeProperty] = new Binding(){Path = nameof(ToolBarItemViewModel.OverflowMode)},
};
}
if (param is ToolBarCheckBoxItemViweModel cb)
if (param is ToolBarCheckBoxItemViweModel)
{
return new CheckBox()
{
@@ -36,7 +36,7 @@ public class ToolBarItemTemplateSelector: IDataTemplate
[!ToolBar.OverflowModeProperty] = new Binding(){Path = nameof(ToolBarItemViewModel.OverflowMode)},
};
}
if (param is ToolBarComboBoxItemViewModel combo)
if (param is ToolBarComboBoxItemViewModel)
{
return new ComboBox()
{

View File

@@ -1,7 +1,6 @@
using System;
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using Ursa.Demo.Pages;
namespace Ursa.Demo.Converters;
@@ -10,16 +9,13 @@ public class ViewLocator: IDataTemplate
public Control? Build(object? param)
{
if (param is null) return null;
var name = param.GetType().Name!.Replace("ViewModel", "");
var name = param.GetType().Name.Replace("ViewModel", "");
var type = Type.GetType("Ursa.Demo.Pages."+name);
if (type != null)
{
return (Control)Activator.CreateInstance(type)!;
}
else
{
return new TextBlock { Text = "Not Found: " + name };
}
return new TextBlock { Text = "Not Found: " + name };
}
public bool Match(object? data)