更新
This commit is contained in:
15
AntdWpfDemo/ViewModels/AlertViewModel.cs
Normal file
15
AntdWpfDemo/ViewModels/AlertViewModel.cs
Normal 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";
|
||||
}
|
||||
}
|
||||
}
|
||||
60
AntdWpfDemo/ViewModels/AvatarViewModel.cs
Normal file
60
AntdWpfDemo/ViewModels/AvatarViewModel.cs
Normal 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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
AntdWpfDemo/ViewModels/BadgeViewModel.cs
Normal file
15
AntdWpfDemo/ViewModels/BadgeViewModel.cs
Normal 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";
|
||||
}
|
||||
}
|
||||
}
|
||||
59
AntdWpfDemo/ViewModels/ButtonViewModel.cs
Normal file
59
AntdWpfDemo/ViewModels/ButtonViewModel.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
135
AntdWpfDemo/ViewModels/CheckBoxViewModel.cs
Normal file
135
AntdWpfDemo/ViewModels/CheckBoxViewModel.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
AntdWpfDemo/ViewModels/IconViewModel.cs
Normal file
15
AntdWpfDemo/ViewModels/IconViewModel.cs
Normal 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";
|
||||
}
|
||||
}
|
||||
}
|
||||
16
AntdWpfDemo/ViewModels/InputViewModel.cs
Normal file
16
AntdWpfDemo/ViewModels/InputViewModel.cs
Normal 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";
|
||||
}
|
||||
}
|
||||
}
|
||||
15
AntdWpfDemo/ViewModels/ProgressViewModel.cs
Normal file
15
AntdWpfDemo/ViewModels/ProgressViewModel.cs
Normal 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";
|
||||
}
|
||||
}
|
||||
}
|
||||
51
AntdWpfDemo/ViewModels/RadioButtonViewModel.cs
Normal file
51
AntdWpfDemo/ViewModels/RadioButtonViewModel.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
15
AntdWpfDemo/ViewModels/SelectViewModel.cs
Normal file
15
AntdWpfDemo/ViewModels/SelectViewModel.cs
Normal 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";
|
||||
}
|
||||
}
|
||||
}
|
||||
17
AntdWpfDemo/ViewModels/ShellViewModel.cs
Normal file
17
AntdWpfDemo/ViewModels/ShellViewModel.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
AntdWpfDemo/ViewModels/SpinViewModel.cs
Normal file
15
AntdWpfDemo/ViewModels/SpinViewModel.cs
Normal 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";
|
||||
}
|
||||
}
|
||||
}
|
||||
33
AntdWpfDemo/ViewModels/SwitchViewModel.cs
Normal file
33
AntdWpfDemo/ViewModels/SwitchViewModel.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
39
AntdWpfDemo/ViewModels/TagViewModel.cs
Normal file
39
AntdWpfDemo/ViewModels/TagViewModel.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
AntdWpfDemo/ViewModels/ToolTipViewModel.cs
Normal file
15
AntdWpfDemo/ViewModels/ToolTipViewModel.cs
Normal 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";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user