This commit is contained in:
ShrlAlgo
2025-07-11 09:20:23 +08:00
parent c7b104f44f
commit 4d35cadb56
840 changed files with 102347 additions and 11595 deletions

View File

@@ -0,0 +1,15 @@
using Caliburn.Micro;
using System.ComponentModel.Composition;
namespace AntdWpfDemo.ViewModels
{
[Export(typeof(IScreen))]
internal class AlertViewModel : Screen
{
public AlertViewModel()
{
DisplayName = "Alert";
}
}
}

View File

@@ -0,0 +1,60 @@
using Caliburn.Micro;
using System.ComponentModel.Composition;
using System.Windows.Media;
namespace AntdWpfDemo.ViewModels
{
[Export(typeof(IScreen))]
internal class AvatarViewModel : Screen
{
private string[] users = { "U", "Lucy", "Tom", "Edward" };
private string[] colors = { "#f56a00", "#7265e6", "#ffbf00", "#00a2ae" };
private int index = 0;
private Brush background;
public Brush Background
{
get { return background; }
set
{
background = value;
NotifyOfPropertyChange();
}
}
private string text;
public string Text
{
get { return text; }
set
{
text = value;
NotifyOfPropertyChange();
}
}
public AvatarViewModel()
{
DisplayName = "Avatar";
Change();
}
public void Change()
{
if (index >= users.Length)
{
index = 0;
}
Text = users[index];
Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(colors[index]));
index++;
}
}
}

View File

@@ -0,0 +1,15 @@
using Caliburn.Micro;
using System.ComponentModel.Composition;
namespace AntdWpfDemo.ViewModels
{
[Export(typeof(IScreen))]
internal class BadgeViewModel : Screen
{
public BadgeViewModel()
{
DisplayName = " Badge";
}
}
}

View File

@@ -0,0 +1,59 @@
using AntdWpf.Controls;
using Caliburn.Micro;
using System.ComponentModel.Composition;
using System.Windows;
using System.Windows.Media;
namespace AntdWpfDemo.ViewModels
{
[Export(typeof(IScreen))]
internal class ButtonViewModel : Screen
{
public Sizes? Size { get; set; }
private bool loading1;
public bool Loading1
{
get { return loading1; }
set
{
loading1 = value;
NotifyOfPropertyChange();
}
}
private bool loading2;
public bool Loading2
{
get { return loading2; }
set
{
loading2 = value;
NotifyOfPropertyChange();
}
}
public ButtonViewModel()
{
DisplayName = "Button";
}
public void Click1()
{
Loading1 = true;
var app = Application.Current;
//app.Resources["ButtonPrimaryBrush"] = new SolidColorBrush(Color.FromRgb(114, 46, 209));
app.Resources["PrimaryBrush"] = new SolidColorBrush(Color.FromRgb(114, 46, 209));
}
public void Click2()
{
Loading2 = true;
}
}
}

View File

@@ -0,0 +1,135 @@
using Caliburn.Micro;
using System.ComponentModel.Composition;
namespace AntdWpfDemo.ViewModels
{
[Export(typeof(IScreen))]
internal class CheckBoxViewModel : Screen
{
private bool isChecked;
public bool IsChecked
{
get { return isChecked; }
set
{
isChecked = value;
NotifyOfPropertyChange();
NotifyOfPropertyChange("Check");
NotifyOfPropertyChange("CheckBox");
}
}
private bool isEnabled;
public bool IsEnabled
{
get { return isEnabled; }
set
{
isEnabled = value;
NotifyOfPropertyChange();
NotifyOfPropertyChange("Enabled");
NotifyOfPropertyChange("CheckBox");
}
}
public string Check
{
get { return (isChecked ? "Uncheck" : "Check"); }
}
public string Enabled
{
get { return (isEnabled ? "Disabled" : "Enabled"); }
}
public string CheckBox
{
get { return (isChecked ? "Checked" : "Unchecked") + "-" + (isEnabled ? "Enabled" : "Disabled"); }
}
private bool apple;
public bool Apple
{
get { return apple; }
set
{
apple = value;
NotifyOfPropertyChange();
NotifyOfPropertyChange(nameof(CheckAll));
}
}
private bool pear;
public bool Pear
{
get { return pear; }
set
{
pear = value;
NotifyOfPropertyChange();
NotifyOfPropertyChange(nameof(CheckAll));
}
}
private bool orange;
public bool Orange
{
get { return orange; }
set
{
orange = value;
NotifyOfPropertyChange();
NotifyOfPropertyChange(nameof(CheckAll));
}
}
public bool? CheckAll
{
get
{
if (apple && pear && orange)
{
return true;
}
if (apple || pear || Orange)
{
return null;
}
return false;
}
set
{
Apple = Pear = Orange = value.Value;
}
}
public CheckBoxViewModel()
{
DisplayName = "CheckBox";
ToggleCheck();
ToggleEnabled();
}
public void ToggleCheck()
{
IsChecked = !isChecked;
}
public void ToggleEnabled()
{
IsEnabled = !isEnabled;
}
}
}

View File

@@ -0,0 +1,15 @@
using Caliburn.Micro;
using System.ComponentModel.Composition;
namespace AntdWpfDemo.ViewModels
{
[Export(typeof(IScreen))]
public class IconViewModel : Screen
{
public IconViewModel()
{
DisplayName = "Icon";
}
}
}

View File

@@ -0,0 +1,16 @@
using Caliburn.Micro;
using System;
using System.ComponentModel.Composition;
namespace AntdWpfDemo.ViewModels
{
[Export(typeof(IScreen))]
internal class InputViewModel : Screen
{
public InputViewModel()
{
DisplayName = "Input";
}
}
}

View File

@@ -0,0 +1,15 @@
using Caliburn.Micro;
using System.ComponentModel.Composition;
namespace AntdWpfDemo.ViewModels
{
[Export(typeof(IScreen))]
internal class ProgressViewModel : Screen
{
public ProgressViewModel()
{
DisplayName = "Progress";
}
}
}

View File

@@ -0,0 +1,51 @@
using Caliburn.Micro;
using System.Collections.Generic;
using System.ComponentModel.Composition;
namespace AntdWpfDemo.ViewModels
{
[Export(typeof(IScreen))]
public class RadioButtonViewModel : Screen
{
private bool isEnabled;
public bool IsEnabled
{
get { return isEnabled; }
set
{
isEnabled = value;
NotifyOfPropertyChange();
}
}
public IEnumerable<RadioItem> Items { get; set; }
public RadioButtonViewModel()
{
DisplayName = "Radio";
Items = new List<RadioItem>
{
new RadioItem { Label = "Apple", Value = "Apple" },
new RadioItem { Label = "Pear", Value = "Pear" },
new RadioItem { Label = "Orange", Value = "Orange" }
};
}
public void Toggle()
{
IsEnabled = !isEnabled;
}
}
public struct RadioItem
{
public string Label;
public string Value;
}
}

View File

@@ -0,0 +1,15 @@
using Caliburn.Micro;
using System.ComponentModel.Composition;
namespace AntdWpfDemo.ViewModels
{
[Export(typeof(IScreen))]
internal class SelectViewModel : Screen
{
public SelectViewModel()
{
DisplayName = "Select";
}
}
}

View File

@@ -0,0 +1,17 @@
using Caliburn.Micro;
using System.Collections.Generic;
using System.ComponentModel.Composition;
namespace AntdWpfDemo.ViewModels
{
[Export(typeof(IShell))]
internal class ShellViewModel : Conductor<IScreen>.Collection.OneActive
{
[ImportingConstructor]
protected ShellViewModel([ImportMany] IEnumerable<IScreen> screens)
{
Items.AddRange(screens);
}
}
}

View File

@@ -0,0 +1,15 @@
using Caliburn.Micro;
using System.ComponentModel.Composition;
namespace AntdWpfDemo.ViewModels
{
[Export(typeof(IScreen))]
internal class SpinViewModel : Screen
{
public SpinViewModel()
{
DisplayName = "Spin";
}
}
}

View File

@@ -0,0 +1,33 @@
using Caliburn.Micro;
using System.ComponentModel.Composition;
namespace AntdWpfDemo.ViewModels
{
[Export(typeof(IScreen))]
internal class SwitchViewModel : Screen
{
private bool isEnabled;
public bool IsEnabled
{
get { return isEnabled; }
set
{
isEnabled = value;
NotifyOfPropertyChange();
}
}
public SwitchViewModel()
{
DisplayName = "Switch";
}
public void Toggle()
{
IsEnabled = !isEnabled;
}
}
}

View File

@@ -0,0 +1,39 @@
using Caliburn.Micro;
using System.ComponentModel.Composition;
using System.Windows;
namespace AntdWpfDemo.ViewModels
{
[Export(typeof(IScreen))]
internal class TagViewModel : Screen
{
private Visibility visibility;
public Visibility Visibility
{
get { return visibility; }
set
{
visibility = value;
NotifyOfPropertyChange();
}
}
public TagViewModel()
{
DisplayName = "Tag";
}
public void Closing(object sender, RoutedEventArgs e)
{
e.Handled = true;
}
public void Toggle()
{
Visibility = visibility == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
}
}
}

View File

@@ -0,0 +1,15 @@
using Caliburn.Micro;
using System.ComponentModel.Composition;
namespace AntdWpfDemo.ViewModels
{
[Export(typeof(IScreen))]
internal class ToolTipViewModel : Screen
{
public ToolTipViewModel()
{
DisplayName = "ToolTip";
}
}
}