Code cleaning (unused using)

This commit is contained in:
appleneko2001
2022-07-05 10:21:35 +09:00
parent 60c0aa2e51
commit 35a8b3e85c
166 changed files with 1804 additions and 1300 deletions
@@ -1,3 +1,6 @@
namespace Material.Avalonia {
public class MaterialAvaloniaTemplates : global::Avalonia.Styling.Styles { }
namespace Material.Avalonia
{
public class MaterialAvaloniaTemplates : global::Avalonia.Styling.Styles
{
}
}
@@ -1,7 +1,8 @@
using System;
using Avalonia.Media;
namespace Material.Colors.ColorManipulation {
namespace Material.Colors.ColorManipulation
{
public static class ColorHelper
{
[Obsolete("Please use PickContrastColor method instead.")]
@@ -18,7 +19,7 @@ namespace Material.Colors.ColorManipulation {
{
return AlgorithmContrastColor(color, Avalonia.Media.Colors.Black, Avalonia.Media.Colors.White, ratio);
}
/// <summary>
/// Choose most accessible color by algorithm.
/// </summary>
@@ -32,17 +33,20 @@ namespace Material.Colors.ColorManipulation {
return AlgorithmContrastColor(color, a, b, ratio);
}
public static Color ShiftLightness(this Color color, int amount = 1) {
public static Color ShiftLightness(this Color color, int amount = 1)
{
var lab = color.ToLab();
var shifted = new Lab(lab.L - LabConstants.Kn * amount, lab.A, lab.B);
return shifted.ToColor();
}
public static Color Darken(this Color color, int amount = 1) {
public static Color Darken(this Color color, int amount = 1)
{
return color.ShiftLightness(amount);
}
public static Color Lighten(this Color color, int amount = 1) {
public static Color Lighten(this Color color, int amount = 1)
{
return color.ShiftLightness(-amount);
}
@@ -54,20 +58,20 @@ namespace Material.Colors.ColorManipulation {
/// <returns>The magnitude of relative luminance of color</returns>
public static double RelativeLuminance(this Color c)
{
double Process(double s) =>
double Process(double s) =>
s < 0.03928 ? s / 12.92 : Math.Pow((s + 0.055) / 1.055, 2.4);
double dR = (double)c.R / 255,
dG = (double)c.G / 255,
dB = (double)c.B / 255;
double dR = (double) c.R / 255,
dG = (double) c.G / 255,
dB = (double) c.B / 255;
var r = Process(dR);
var g = Process(dG);
var b = Process(dB);
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
}
/// <summary>
/// Get color contrast between two colors
/// </summary>
@@ -93,7 +97,8 @@ namespace Material.Colors.ColorManipulation {
/// <param name="color"></param>
/// <param name="other"></param>
/// <returns></returns>
public static double Difference(this Color color, Color other) {
public static double Difference(this Color color, Color other)
{
var lab1 = color.ToLab();
var lab2 = other.ToLab();
+6 -3
View File
@@ -1,10 +1,13 @@
namespace Material.Colors.ColorManipulation {
public struct Hsb {
namespace Material.Colors.ColorManipulation
{
public struct Hsb
{
public double Hue { get; }
public double Saturation { get; }
public double Brightness { get; }
public Hsb(double hue, double saturation, double brightness) {
public Hsb(double hue, double saturation, double brightness)
{
Hue = hue;
Saturation = saturation;
Brightness = brightness;
@@ -2,9 +2,12 @@
using System.Linq;
using Avalonia.Media;
namespace Material.Colors.ColorManipulation {
public static class HsbConverter {
public static Color ToColor(this Hsb hsv) {
namespace Material.Colors.ColorManipulation
{
public static class HsbConverter
{
public static Color ToColor(this Hsb hsv)
{
var h = hsv.Hue;
var s = hsv.Saturation;
var b = hsv.Brightness;
@@ -44,7 +47,8 @@ namespace Material.Colors.ColorManipulation {
}
}
public static Hsb ToHsb(this Color color) {
public static Hsb ToHsb(this Color color)
{
double r = color.R;
double g = color.G;
double b = color.B;
@@ -62,10 +66,12 @@ namespace Material.Colors.ColorManipulation {
var d = max - min;
var s = max.IsCloseTo(0) ? 0 : d / max;
if (max.IsCloseTo(min)) {
if (max.IsCloseTo(min))
{
h = 0; // achromatic
}
else {
else
{
if (max.IsCloseTo(r))
h = (g - b) / d + (g < b ? 6 : 0);
else if (max.IsCloseTo(g))
@@ -78,7 +84,8 @@ namespace Material.Colors.ColorManipulation {
return new Hsb(h, s, v);
}
private static bool IsCloseTo(this double value, double target, double tolerance = double.Epsilon) {
private static bool IsCloseTo(this double value, double target, double tolerance = double.Epsilon)
{
return Math.Abs(value - target) < tolerance;
}
}
+6 -3
View File
@@ -1,10 +1,13 @@
namespace Material.Colors.ColorManipulation {
internal struct Hsl {
namespace Material.Colors.ColorManipulation
{
internal struct Hsl
{
public double H { get; }
public double S { get; }
public double L { get; }
public Hsl(double h, double s, double l) {
public Hsl(double h, double s, double l)
{
H = h;
S = s;
L = l;
@@ -1,10 +1,14 @@
using System;
using Avalonia.Media;
namespace Material.Colors.ColorManipulation {
internal static class HslConverter {
public static Color ToColor(this Hsl hsl) {
double HsvRbg(double v1, double v2, double vH) {
namespace Material.Colors.ColorManipulation
{
internal static class HslConverter
{
public static Color ToColor(this Hsl hsl)
{
double HsvRbg(double v1, double v2, double vH)
{
if (vH < 0) vH += 1;
if (vH > 1) vH -= 1;
if (6 * vH < 1) return v1 + (v2 - v1) * 6 * vH;
@@ -18,12 +22,14 @@ namespace Material.Colors.ColorManipulation {
var l = hsl.L * (1.0 / 100);
double r, g, b;
if (s == 0) {
if (s == 0)
{
r = l * 255;
g = l * 255;
b = l * 255;
}
else {
else
{
double var2;
if (l < 0.5) var2 = l * (1 + s);
else var2 = l + s - s * l;
+8 -4
View File
@@ -1,19 +1,23 @@
using System;
namespace Material.Colors.ColorManipulation {
internal struct Lab {
namespace Material.Colors.ColorManipulation
{
internal struct Lab
{
public double L { get; }
public double A { get; }
public double B { get; }
public Lab(double l, double a, double b) {
public Lab(double l, double a, double b)
{
L = l;
A = a;
B = b;
}
}
internal class LabConstants {
internal class LabConstants
{
public const double Kn = 18;
public const double WhitePointX = 0.95047;
@@ -1,15 +1,20 @@
using System;
using Avalonia.Media;
namespace Material.Colors.ColorManipulation {
internal static class LabConverter {
public static Lab ToLab(this Color c) {
namespace Material.Colors.ColorManipulation
{
internal static class LabConverter
{
public static Lab ToLab(this Color c)
{
var xyz = c.ToXyz();
return xyz.ToLab();
}
public static Lab ToLab(this Xyz xyz) {
double XyzLab(double v) {
public static Lab ToLab(this Xyz xyz)
{
double XyzLab(double v)
{
if (v > LabConstants.E)
return Math.Pow(v, 1 / 3.0);
return (v * LabConstants.K + 16) / 116;
@@ -25,7 +30,8 @@ namespace Material.Colors.ColorManipulation {
return new Lab(l, a, b);
}
public static Color ToColor(this Lab lab) {
public static Color ToColor(this Lab lab)
{
var xyz = lab.ToXyz();
return xyz.ToColor();
+6 -3
View File
@@ -1,10 +1,13 @@
namespace Material.Colors.ColorManipulation {
internal struct Xyz {
namespace Material.Colors.ColorManipulation
{
internal struct Xyz
{
public double X { get; }
public double Y { get; }
public double Z { get; }
public Xyz(double x, double y, double z) {
public Xyz(double x, double y, double z)
{
X = x;
Y = y;
Z = z;
@@ -1,16 +1,21 @@
using System;
using Avalonia.Media;
namespace Material.Colors.ColorManipulation {
internal static class XyzConverter {
public static Color ToColor(this Xyz xyz) {
double XyzRgb(double d) {
namespace Material.Colors.ColorManipulation
{
internal static class XyzConverter
{
public static Color ToColor(this Xyz xyz)
{
double XyzRgb(double d)
{
if (d > 0.0031308)
return 255.0 * (1.055 * Math.Pow(d, 1.0 / 2.4) - 0.055);
return 255.0 * (12.92 * d);
}
byte Clip(double d) {
byte Clip(double d)
{
if (d < 0) return 0;
if (d > 255) return 255;
return (byte) Math.Round(d);
@@ -23,8 +28,10 @@ namespace Material.Colors.ColorManipulation {
return Color.FromRgb(Clip(r), Clip(g), Clip(b));
}
public static Xyz ToXyz(this Color c) {
double RgbXyz(double v) {
public static Xyz ToXyz(this Color c)
{
double RgbXyz(double v)
{
v /= 255;
if (v > 0.04045)
return Math.Pow((v + 0.055) / 1.055, 2.4);
@@ -41,8 +48,10 @@ namespace Material.Colors.ColorManipulation {
return new Xyz(x, y, z);
}
public static Xyz ToXyz(this Lab lab) {
double LabXyz(double d) {
public static Xyz ToXyz(this Lab lab)
{
double LabXyz(double d)
{
if (d > LabConstants.ECubedRoot)
return d * d * d;
return (116 * d - 16) / LabConstants.K;
+10 -5
View File
@@ -1,8 +1,10 @@
using Avalonia.Media;
using Material.Colors.ColorManipulation;
namespace Material.Colors {
public struct ColorPair {
namespace Material.Colors
{
public struct ColorPair
{
public Color Color { get; }
/// <summary>
@@ -11,16 +13,19 @@ namespace Material.Colors {
/// </summary>
public Color ForegroundColor { get; }
public static implicit operator ColorPair(Color color) {
public static implicit operator ColorPair(Color color)
{
return new ColorPair(color);
}
public ColorPair(Color color) {
public ColorPair(Color color)
{
Color = color;
ForegroundColor = color.PickContrastColor(4.5);
}
public ColorPair(Color color, Color foreground) {
public ColorPair(Color color, Color foreground)
{
Color = color;
ForegroundColor = foreground;
}
+4 -2
View File
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors {
public interface ISwatch {
namespace Material.Colors
{
public interface ISwatch
{
string Name { get; }
IEnumerable<Color> Hues { get; }
IDictionary<MaterialColor, Color> Lookup { get; }
+8 -4
View File
@@ -1,5 +1,7 @@
namespace Material.Colors {
public enum PrimaryColor {
namespace Material.Colors
{
public enum PrimaryColor
{
Red = MaterialColor.Red500,
Pink = MaterialColor.Pink500,
Purple = MaterialColor.Purple500,
@@ -21,7 +23,8 @@
BlueGrey = MaterialColor.BlueGrey500
}
public enum SecondaryColor {
public enum SecondaryColor
{
Red = MaterialColor.RedSecondary,
Pink = MaterialColor.PinkSecondary,
Purple = MaterialColor.PurpleSecondary,
@@ -40,7 +43,8 @@
DeepOrange = MaterialColor.DeepOrangeSecondary
}
public enum MaterialColor {
public enum MaterialColor
{
Red50,
Red100,
Red200,
+6 -3
View File
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class AmberSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class AmberSwatch : ISwatch
{
public static Color Amber50 { get; } = Color.Parse("#FFF8E1");
public static Color Amber100 { get; } = Color.Parse("#FFECB3");
public static Color Amber200 { get; } = Color.Parse("#FFE082");
@@ -20,7 +22,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Amber";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.Amber50, Amber50},
{MaterialColor.Amber100, Amber100},
{MaterialColor.Amber200, Amber200},
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class BlueGreySwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class BlueGreySwatch : ISwatch
{
public static Color BlueGrey50 { get; } = Color.Parse("#ECEFF1");
public static Color BlueGrey100 { get; } = Color.Parse("#CFD8DC");
public static Color BlueGrey200 { get; } = Color.Parse("#B0BEC5");
@@ -16,7 +18,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Blue Grey";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.BlueGrey50, BlueGrey50},
{MaterialColor.BlueGrey100, BlueGrey100},
{MaterialColor.BlueGrey200, BlueGrey200},
+6 -3
View File
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class BlueSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class BlueSwatch : ISwatch
{
public static Color Blue50 { get; } = Color.Parse("#E3F2FD");
public static Color Blue100 { get; } = Color.Parse("#BBDEFB");
public static Color Blue200 { get; } = Color.Parse("#90CAF9");
@@ -20,7 +22,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Blue";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.Blue50, Blue50},
{MaterialColor.Blue100, Blue100},
{MaterialColor.Blue200, Blue200},
+6 -3
View File
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class BrownSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class BrownSwatch : ISwatch
{
public static Color Brown50 { get; } = Color.Parse("#EFEBE9");
public static Color Brown100 { get; } = Color.Parse("#D7CCC8");
public static Color Brown200 { get; } = Color.Parse("#BCAAA4");
@@ -16,7 +18,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Brown";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.Brown50, Brown50},
{MaterialColor.Brown100, Brown100},
{MaterialColor.Brown200, Brown200},
+6 -3
View File
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class CyanSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class CyanSwatch : ISwatch
{
public static Color Cyan50 { get; } = Color.Parse("#E0F7FA");
public static Color Cyan100 { get; } = Color.Parse("#B2EBF2");
public static Color Cyan200 { get; } = Color.Parse("#80DEEA");
@@ -20,7 +22,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Cyan";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.Cyan50, Cyan50},
{MaterialColor.Cyan100, Cyan100},
{MaterialColor.Cyan200, Cyan200},
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class DeepOrangeSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class DeepOrangeSwatch : ISwatch
{
public static Color DeepOrange50 { get; } = Color.Parse("#FBE9E7");
public static Color DeepOrange100 { get; } = Color.Parse("#FFCCBC");
public static Color DeepOrange200 { get; } = Color.Parse("#FFAB91");
@@ -20,7 +22,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Deep Orange";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.DeepOrange50, DeepOrange50},
{MaterialColor.DeepOrange100, DeepOrange100},
{MaterialColor.DeepOrange200, DeepOrange200},
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class DeepPurpleSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class DeepPurpleSwatch : ISwatch
{
public static Color DeepPurple50 { get; } = Color.Parse("#EDE7F6");
public static Color DeepPurple100 { get; } = Color.Parse("#D1C4E9");
public static Color DeepPurple200 { get; } = Color.Parse("#B39DDB");
@@ -20,7 +22,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Deep Purple";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.DeepPurple50, DeepPurple50},
{MaterialColor.DeepPurple100, DeepPurple100},
{MaterialColor.DeepPurple200, DeepPurple200},
+6 -3
View File
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class GreenSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class GreenSwatch : ISwatch
{
public static Color Green50 { get; } = Color.Parse("#E8F5E9");
public static Color Green100 { get; } = Color.Parse("#C8E6C9");
public static Color Green200 { get; } = Color.Parse("#A5D6A7");
@@ -20,7 +22,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Green";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.Green50, Green50},
{MaterialColor.Green100, Green100},
{MaterialColor.Green200, Green200},
+6 -3
View File
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class GreySwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class GreySwatch : ISwatch
{
public static Color Grey50 { get; } = Color.Parse("#FAFAFA");
public static Color Grey100 { get; } = Color.Parse("#F5F5F5");
public static Color Grey200 { get; } = Color.Parse("#EEEEEE");
@@ -16,7 +18,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Grey";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.Grey50, Grey50},
{MaterialColor.Grey100, Grey100},
{MaterialColor.Grey200, Grey200},
+6 -3
View File
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class IndigoSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class IndigoSwatch : ISwatch
{
public static Color Indigo50 { get; } = Color.Parse("#E8EAF6");
public static Color Indigo100 { get; } = Color.Parse("#C5CAE9");
public static Color Indigo200 { get; } = Color.Parse("#9FA8DA");
@@ -20,7 +22,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Indigo";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.Indigo50, Indigo50},
{MaterialColor.Indigo100, Indigo100},
{MaterialColor.Indigo200, Indigo200},
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class LightBlueSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class LightBlueSwatch : ISwatch
{
public static Color LightBlue50 { get; } = Color.Parse("#E1F5FE");
public static Color LightBlue100 { get; } = Color.Parse("#B3E5FC");
public static Color LightBlue200 { get; } = Color.Parse("#81D4FA");
@@ -20,7 +22,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Light Blue";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.LightBlue50, LightBlue50},
{MaterialColor.LightBlue100, LightBlue100},
{MaterialColor.LightBlue200, LightBlue200},
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class LightGreenSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class LightGreenSwatch : ISwatch
{
public static Color LightGreen50 { get; } = Color.Parse("#F1F8E9");
public static Color LightGreen100 { get; } = Color.Parse("#DCEDC8");
public static Color LightGreen200 { get; } = Color.Parse("#C5E1A5");
@@ -20,7 +22,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Light Green";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.LightGreen50, LightGreen50},
{MaterialColor.LightGreen100, LightGreen100},
{MaterialColor.LightGreen200, LightGreen200},
+6 -3
View File
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class LimeSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class LimeSwatch : ISwatch
{
public static Color Lime50 { get; } = Color.Parse("#F9FBE7");
public static Color Lime100 { get; } = Color.Parse("#F0F4C3");
public static Color Lime200 { get; } = Color.Parse("#E6EE9C");
@@ -20,7 +22,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Lime";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.Lime50, Lime50},
{MaterialColor.Lime100, Lime100},
{MaterialColor.Lime200, Lime200},
+6 -3
View File
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class OrangeSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class OrangeSwatch : ISwatch
{
public static Color Orange50 { get; } = Color.Parse("#FFF3E0");
public static Color Orange100 { get; } = Color.Parse("#FFE0B2");
public static Color Orange200 { get; } = Color.Parse("#FFCC80");
@@ -20,7 +22,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Orange";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.Orange50, Orange50},
{MaterialColor.Orange100, Orange100},
{MaterialColor.Orange200, Orange200},
+6 -3
View File
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class PinkSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class PinkSwatch : ISwatch
{
public static Color Pink50 { get; } = Color.Parse("#FCE4EC");
public static Color Pink100 { get; } = Color.Parse("#F8BBD0");
public static Color Pink200 { get; } = Color.Parse("#F48FB1");
@@ -20,7 +22,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Pink";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.Pink50, Pink50},
{MaterialColor.Pink100, Pink100},
{MaterialColor.Pink200, Pink200},
+6 -3
View File
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class PurpleSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class PurpleSwatch : ISwatch
{
public static Color Purple50 { get; } = Color.Parse("#F3E5F5");
public static Color Purple100 { get; } = Color.Parse("#E1BEE7");
public static Color Purple200 { get; } = Color.Parse("#CE93D8");
@@ -20,7 +22,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Purple";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.Purple50, Purple50},
{MaterialColor.Purple100, Purple100},
{MaterialColor.Purple200, Purple200},
+6 -3
View File
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class RedSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class RedSwatch : ISwatch
{
public static Color Red50 { get; } = Color.Parse("#FFEBEE");
public static Color Red100 { get; } = Color.Parse("#FFCDD2");
public static Color Red200 { get; } = Color.Parse("#EF9A9A");
@@ -20,7 +22,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Red";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.Red50, Red50},
{MaterialColor.Red100, Red100},
{MaterialColor.Red200, Red200},
+6 -3
View File
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class TealSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class TealSwatch : ISwatch
{
public static Color Teal50 { get; } = Color.Parse("#E0F2F1");
public static Color Teal100 { get; } = Color.Parse("#B2DFDB");
public static Color Teal200 { get; } = Color.Parse("#80CBC4");
@@ -20,7 +22,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Teal";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.Teal50, Teal50},
{MaterialColor.Teal100, Teal100},
{MaterialColor.Teal200, Teal200},
+6 -3
View File
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using Avalonia.Media;
namespace Material.Colors.Recommended {
public class YellowSwatch : ISwatch {
namespace Material.Colors.Recommended
{
public class YellowSwatch : ISwatch
{
public static Color Yellow50 { get; } = Color.Parse("#FFFDE7");
public static Color Yellow100 { get; } = Color.Parse("#FFF9C4");
public static Color Yellow200 { get; } = Color.Parse("#FFF59D");
@@ -20,7 +22,8 @@ namespace Material.Colors.Recommended {
public string Name { get; } = "Yellow";
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color> {
public IDictionary<MaterialColor, Color> Lookup { get; } = new Dictionary<MaterialColor, Color>
{
{MaterialColor.Yellow50, Yellow50},
{MaterialColor.Yellow100, Yellow100},
{MaterialColor.Yellow200, Yellow200},
+8 -4
View File
@@ -3,9 +3,12 @@ using System.Linq;
using Avalonia.Media;
using Material.Colors.Recommended;
namespace Material.Colors {
public static class SwatchHelper {
public static IEnumerable<ISwatch> Swatches { get; } = new ISwatch[] {
namespace Material.Colors
{
public static class SwatchHelper
{
public static IEnumerable<ISwatch> Swatches { get; } = new ISwatch[]
{
new RedSwatch(),
new PinkSwatch(),
new PurpleSwatch(),
@@ -27,6 +30,7 @@ namespace Material.Colors {
new BlueGreySwatch()
};
public static IDictionary<MaterialColor, Color> Lookup { get; } = Swatches.SelectMany(o => o.Lookup).ToDictionary(o => o.Key, o => o.Value);
public static IDictionary<MaterialColor, Color> Lookup { get; } =
Swatches.SelectMany(o => o.Lookup).ToDictionary(o => o.Key, o => o.Value);
}
}
+6 -3
View File
@@ -1,9 +1,12 @@
using Avalonia;
using Avalonia.Markup.Xaml;
namespace Material.Demo {
public class App : Application {
public override void Initialize() {
namespace Material.Demo
{
public class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
}
@@ -16,7 +16,7 @@ namespace Material.Demo.Commands
{
if (parameter is not TextBox textBox)
return;
Application.Current?
.Clipboard?
.SetTextAsync(textBox.Text);
@@ -1,11 +1,9 @@
using Avalonia.Data.Converters;
using System;
using System.Collections.Generic;
using System;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
using Avalonia.Data.Converters;
namespace Material.Demo.Converters
{
@@ -15,10 +13,10 @@ namespace Material.Demo.Converters
{
FieldInfo fieldInfo = enumObj.GetType().GetField(enumObj.ToString());
var descriptionAttr = fieldInfo
.GetCustomAttributes(false)
.OfType<DescriptionAttribute>()
.Cast<DescriptionAttribute>()
.SingleOrDefault();
.GetCustomAttributes(false)
.OfType<DescriptionAttribute>()
.Cast<DescriptionAttribute>()
.SingleOrDefault();
if (descriptionAttr == null)
{
return enumObj.ToString();
@@ -31,7 +29,7 @@ namespace Material.Demo.Converters
object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Enum myEnum = (Enum)value;
Enum myEnum = (Enum) value;
string description = GetEnumDescription(myEnum);
return description;
}
@@ -41,4 +39,4 @@ namespace Material.Demo.Converters
return string.Empty;
}
}
}
}
@@ -5,16 +5,20 @@ using System.Globalization;
using System.Linq;
using Avalonia.Data.Converters;
namespace Material.Demo.Converters {
public class StringJoinConverter : IValueConverter {
namespace Material.Demo.Converters
{
public class StringJoinConverter : IValueConverter
{
public string? Separator { get; set; }
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) {
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
IEnumerable values = value as IEnumerable ?? Array.Empty<object>();
return string.Join(Separator ?? "", values.OfType<object>());
}
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) {
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
+15 -12
View File
@@ -1,23 +1,27 @@
using Material.Colors;
using System.Diagnostics;
using Avalonia;
using Material.Styles.Themes;
using Material.Styles.Themes.Base;
using System.Diagnostics;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
namespace Material.Demo
{
public static class GlobalCommand {
private static readonly MaterialTheme MaterialThemeStyles = Application.Current!.LocateMaterialTheme<MaterialTheme>();
public static void UseMaterialUIDarkTheme() {
public static class GlobalCommand
{
private static readonly MaterialTheme MaterialThemeStyles =
Application.Current!.LocateMaterialTheme<MaterialTheme>();
public static void UseMaterialUIDarkTheme()
{
MaterialThemeStyles.BaseTheme = BaseThemeMode.Dark;
}
public static void UseMaterialUILightTheme() {
public static void UseMaterialUILightTheme()
{
MaterialThemeStyles.BaseTheme = BaseThemeMode.Light;
}
public static void OpenProjectRepoLink() => OpenBrowserForVisitSite("https://github.com/AvaloniaUtils/material.avalonia");
public static void OpenProjectRepoLink() =>
OpenBrowserForVisitSite("https://github.com/AvaloniaUtils/material.avalonia");
public static void OpenBrowserForVisitSite(string link)
{
@@ -29,6 +33,5 @@ namespace Material.Demo
};
Process.Start(param);
}
}
}
}
+15 -9
View File
@@ -1,34 +1,39 @@
using System;
using System.Collections.Generic;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Material.Styles;
using Material.Styles.Controls;
using Material.Styles.Models;
namespace Material.Demo {
public class MainWindow : Window {
namespace Material.Demo
{
public class MainWindow : Window
{
#region Control fields
private ToggleButton NavDrawerSwitch;
private ListBox DrawerList;
private Carousel PageCarousel;
private ScrollViewer mainScroller;
#endregion
public MainWindow() {
public MainWindow()
{
InitializeComponent();
this.AttachDevTools(KeyGesture.Parse("Shift+F12"));
}
private void InitializeComponent() {
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
#region Control getter and event binding
NavDrawerSwitch = this.Get<ToggleButton>(nameof(NavDrawerSwitch));
DrawerList = this.Get<ListBox>(nameof(DrawerList));
@@ -38,6 +43,7 @@ namespace Material.Demo {
PageCarousel = this.Get<Carousel>(nameof(PageCarousel));
mainScroller = this.Get<ScrollViewer>(nameof(mainScroller));
#endregion
}
@@ -55,7 +61,7 @@ namespace Material.Demo {
if (!listBox.IsFocused && !listBox.IsKeyboardFocusWithin)
return;
try
{
{
PageCarousel.SelectedIndex = listBox.SelectedIndex;
mainScroller.Offset = Vector.Zero;
mainScroller.VerticalScrollBarVisibility =
@@ -89,7 +95,7 @@ namespace Material.Demo {
{
SnackbarHost.Remove(snackbarModel);
}
SnackbarHost.Post("See ya next time, user!");
}
}
+6 -10
View File
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.ComponentModel;
namespace Material.Demo.Models
{
@@ -9,15 +6,14 @@ namespace Material.Demo.Models
{
Yes,
No,
[Description("N/A")]
NA,
[Description("Not Fully")]
NotFully
[Description("N/A")] NA,
[Description("Not Fully")] NotFully
}
public class FeatureStatusModels
{
public string FeatureName { get; internal set; }
public StatusEnum IsReady { get; internal set; }
public StatusEnum IsAnimated { get; internal set; }
public StatusEnum IsAnimated { get; internal set; }
}
}
}
+8 -6
View File
@@ -2,19 +2,21 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Material.Icons;
using Material.Icons.Avalonia;
namespace Material.Demo.Models {
public class MaterialIconKindGroup {
public MaterialIconKindGroup(IEnumerable<string> kinds) {
namespace Material.Demo.Models
{
public class MaterialIconKindGroup
{
public MaterialIconKindGroup(IEnumerable<string> kinds)
{
if (kinds is null) throw new ArgumentNullException(nameof(kinds));
var allValues = kinds.ToList();
if (!allValues.Any()) throw new ArgumentException($"{nameof(kinds)} must contain at least one value");
Kind = allValues.First();
KindValue = Enum.Parse<MaterialIconKind>(Kind);
Aliases = allValues
.OrderBy(x => x, StringComparer.InvariantCultureIgnoreCase)
.ToArray();
.OrderBy(x => x, StringComparer.InvariantCultureIgnoreCase)
.ToArray();
}
public string Kind { get; }
+7 -3
View File
@@ -1,8 +1,12 @@
namespace Material.Demo.Models {
public class Sample2Model {
public Sample2Model(int number) {
namespace Material.Demo.Models
{
public class Sample2Model
{
public Sample2Model(int number)
{
Number = number;
}
public int Number { get; set; }
}
}
@@ -7,16 +7,17 @@
public string Header => _header;
public string ContentHeader { get; set; } = "What is Lorem Ipsum?";
public string ImportantInfos { get; set; } = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
public string ImportantInfos { get; set; } =
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
}
// Data context for SideSheet demo page
public class SideSheetDemoViewModel : ViewModelBase
{
private SideSheetData _information = new SideSheetData();
public SideSheetData Information => _information;
private bool _sideInfoOpened = false;
public bool SideInfoOpened
+2 -3
View File
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Material.Demo.Pages
@@ -16,4 +15,4 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
}
}
}
+2 -3
View File
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Material.Demo.Pages
@@ -16,4 +15,4 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
}
}
}
+2 -3
View File
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Material.Demo.Pages
@@ -16,4 +15,4 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
}
}
}
+2 -3
View File
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Material.Demo.Pages
@@ -16,4 +15,4 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
}
}
}
+10 -6
View File
@@ -15,24 +15,28 @@ namespace Material.Demo.Pages
InitializeComponent();
DataContext = new DialogDemoViewModel();
}
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private void OpenDialogWithView(object? sender, RoutedEventArgs e) {
private void OpenDialogWithView(object? sender, RoutedEventArgs e)
{
DialogHost.DialogHost.Show(this.Resources["Sample2View"]!, "MainDialogHost");
}
private void OpenDialogWithModel(object? sender, RoutedEventArgs e) {
private void OpenDialogWithModel(object? sender, RoutedEventArgs e)
{
// View that associated with this model defined at DialogContentTemplate in DialogDemo.axaml
DialogHost.DialogHost.Show(new Sample2Model(new Random().Next(0, 100)), "MainDialogHost");
}
private void OpenMoreDialogHostExamples(object? sender, RoutedEventArgs e) {
Process.Start(new ProcessStartInfo(){FileName = "https://github.com/AvaloniaUtils/DialogHost.Avalonia", UseShellExecute = true});
private void OpenMoreDialogHostExamples(object? sender, RoutedEventArgs e)
{
Process.Start(new ProcessStartInfo()
{FileName = "https://github.com/AvaloniaUtils/DialogHost.Avalonia", UseShellExecute = true});
}
}
}
}
+2 -3
View File
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Material.Demo.Pages
@@ -16,4 +15,4 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
}
}
}
+2 -3
View File
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Material.Demo.ViewModels;
@@ -19,4 +18,4 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
}
}
}
+3 -6
View File
@@ -1,16 +1,13 @@
using Avalonia.Controls;
using Avalonia.Dialogs;
using Avalonia.Markup.Xaml;
using Material.Demo.Models;
using Material.Styles.Assists;
using System.Collections.ObjectModel;
using Material.Dialog;
using static Material.Demo.Models.StatusEnum;
using Material.Styles.Assists;
namespace Material.Demo.Pages
{
public class Home : UserControl
{
{
public Home()
{
// Sadly I don't have much time to update this listing
@@ -76,4 +73,4 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
}
}
}
+14 -10
View File
@@ -1,32 +1,36 @@
#nullable enable
using System;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Markup.Xaml;
using Avalonia.Threading;
using Material.Demo.ViewModels;
namespace Material.Demo.Pages {
public class IconsDemo : UserControl {
public IconsDemo() {
namespace Material.Demo.Pages
{
public class IconsDemo : UserControl
{
public IconsDemo()
{
InitializeComponent();
DataContext = new IconsDemoViewModel();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private void Search_OnKeyDown(object? sender, KeyEventArgs e) {
var textBox = (TextBox)sender!;
private void Search_OnKeyDown(object? sender, KeyEventArgs e)
{
var textBox = (TextBox) sender!;
if (e.Key == Key.Enter)
this.Get<Button>("SearchButton").Command.Execute(textBox.Text);
}
private void TextBox_OnGotFocus(object? sender, GotFocusEventArgs e) {
var textBox = (TextBox)sender!;
private void TextBox_OnGotFocus(object? sender, GotFocusEventArgs e)
{
var textBox = (TextBox) sender!;
Dispatcher.UIThread.Post(textBox.SelectAll);
}
}
+2 -3
View File
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Material.Demo.Pages
@@ -16,4 +15,4 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
}
}
}
+2 -3
View File
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Material.Demo.Pages
@@ -16,4 +15,4 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
}
}
}
+8 -5
View File
@@ -1,14 +1,17 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Material.Demo.Pages {
public class PickersDemo : UserControl {
public PickersDemo() {
namespace Material.Demo.Pages
{
public class PickersDemo : UserControl
{
public PickersDemo()
{
InitializeComponent();
}
private void InitializeComponent() {
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
@@ -1,21 +1,20 @@
using Avalonia;
using System.ComponentModel;
using System.Timers;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Timers;
namespace Material.Demo.Pages
{
public class ProgressIndicatorDemo : UserControl
{
{
private Timer timer;
private int caseProgress;
public class Context : INotifyPropertyChanged
{
private double m_Progress = 0;
public double Progress
{
get => m_Progress;
@@ -34,7 +33,7 @@ namespace Material.Demo.Pages
public ProgressIndicatorDemo()
{
this.InitializeComponent();
timer = new Timer(1000);
timer.Elapsed += Timer_Elapsed;
@@ -45,7 +44,7 @@ namespace Material.Demo.Pages
private void ProgressIndicatorDemo_AttachedToVisualTree(object sender, VisualTreeAttachmentEventArgs e)
{
timer.Start();
timer.Start();
}
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
@@ -55,7 +54,7 @@ namespace Material.Demo.Pages
private double SwitchProgress()
{
switch(caseProgress)
switch (caseProgress)
{
case 0:
caseProgress++;
@@ -86,4 +85,4 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
}
}
}
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Material.Demo.Pages
@@ -16,4 +15,4 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
}
}
}
+2 -3
View File
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Material.Demo.Models;
@@ -36,4 +35,4 @@ namespace Material.Demo.Pages
vm.SideInfoOpened = true;
}
}
}
}
+2 -3
View File
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Material.Demo.Pages
@@ -16,4 +15,4 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
}
}
}
+2 -3
View File
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Material.Demo.Pages
@@ -16,4 +15,4 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
}
}
}
+2 -3
View File
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Material.Demo.Pages
@@ -16,4 +15,4 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
}
}
}
+2 -3
View File
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Material.Demo.Pages
@@ -16,4 +15,4 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
}
}
}
+2 -3
View File
@@ -1,5 +1,4 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Material.Demo.Pages
@@ -16,4 +15,4 @@ namespace Material.Demo.Pages
AvaloniaXamlLoader.Load(this);
}
}
}
}
+22 -21
View File
@@ -1,18 +1,17 @@
using System;
using Avalonia;
using Avalonia.Animation.Easings;
using Avalonia.Controls;
using ShowMeTheXaml;
namespace Material.Demo {
internal class Program {
namespace Material.Demo
{
internal class Program
{
public static MainWindow MainWindow { get; private set; }
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
// STA thread is required for IME system.
[STAThread]
public static void Main(string[] args)
@@ -21,26 +20,28 @@ namespace Material.Demo {
}
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp() {
public static AppBuilder BuildAvaloniaApp()
{
return AppBuilder.Configure<App>()
.UsePlatformDetect()
.With(new X11PlatformOptions
{
EnableMultiTouch = true,
UseDBusMenu = true,
EnableIme = true
})
.With(new Win32PlatformOptions
{
EnableMultitouch = true
})
.UseXamlDisplay()
.LogToTrace();
.UsePlatformDetect()
.With(new X11PlatformOptions
{
EnableMultiTouch = true,
UseDBusMenu = true,
EnableIme = true
})
.With(new Win32PlatformOptions
{
EnableMultitouch = true
})
.UseXamlDisplay()
.LogToTrace();
}
// Your application's entry point. Here you can initialize your MVVM framework, DI
// container, etc.
private static void AppMain(Application app, string[] args) {
private static void AppMain(Application app, string[] args)
{
MainWindow = new MainWindow();
app.Run(MainWindow);
}
+40 -21
View File
@@ -3,64 +3,83 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Metadata;
namespace Material.Demo {
namespace Material.Demo
{
[PseudoClasses("selectednow")]
public class SelectionWrapper : UserControl {
static SelectionWrapper() {
PointerPressedEvent.Raised.Subscribe(tuple => {
if (tuple.Item1 is SelectionWrapper selectionWrapper) {
public class SelectionWrapper : UserControl
{
static SelectionWrapper()
{
PointerPressedEvent.Raised.Subscribe(tuple =>
{
if (tuple.Item1 is SelectionWrapper selectionWrapper)
{
selectionWrapper.CurrentSelected = selectionWrapper.DataSource;
}
});
CurrentSelectedProperty.Changed.Subscribe(args => {
if (args.Sender is SelectionWrapper selectionWrapper) {
CurrentSelectedProperty.Changed.Subscribe(args =>
{
if (args.Sender is SelectionWrapper selectionWrapper)
{
selectionWrapper.UpdateSelectedNow();
}
});
SelectedNowProperty.Changed.Subscribe(args => {
if (args.Sender is SelectionWrapper selectionWrapper) {
if (args.NewValue.Value) {
SelectedNowProperty.Changed.Subscribe(args =>
{
if (args.Sender is SelectionWrapper selectionWrapper)
{
if (args.NewValue.Value)
{
selectionWrapper.PseudoClasses.Add(":selectednow");
}
else {
else
{
selectionWrapper.PseudoClasses.Remove(":selectednow");
}
}
});
}
protected override void OnDataContextEndUpdate() {
protected override void OnDataContextEndUpdate()
{
base.OnDataContextEndUpdate();
UpdateSelectedNow();
}
public void UpdateSelectedNow() {
public void UpdateSelectedNow()
{
SelectedNow = DataSource != null && DataSource == CurrentSelected;
}
public static readonly StyledProperty<object> DataSourceProperty = AvaloniaProperty.Register<SelectionWrapper, object>(nameof(DataSource));
public static readonly StyledProperty<object> DataSourceProperty =
AvaloniaProperty.Register<SelectionWrapper, object>(nameof(DataSource));
public object DataSource {
public object DataSource
{
get => GetValue(DataSourceProperty);
set => SetValue(DataSourceProperty, value);
}
public static readonly StyledProperty<object> CurrentSelectedProperty = AvaloniaProperty.Register<SelectionWrapper, object>(nameof(CurrentSelected));
public static readonly StyledProperty<object> CurrentSelectedProperty =
AvaloniaProperty.Register<SelectionWrapper, object>(nameof(CurrentSelected));
public object CurrentSelected {
public object CurrentSelected
{
get => GetValue(CurrentSelectedProperty);
set => SetValue(CurrentSelectedProperty, value);
}
public static readonly DirectProperty<SelectionWrapper, bool> SelectedNowProperty = AvaloniaProperty.RegisterDirect<SelectionWrapper, bool>(
nameof(SelectedNow),
wrapper => wrapper.CurrentSelected == wrapper.DataSource);
public static readonly DirectProperty<SelectionWrapper, bool> SelectedNowProperty =
AvaloniaProperty.RegisterDirect<SelectionWrapper, bool>(
nameof(SelectedNow),
wrapper => wrapper.CurrentSelected == wrapper.DataSource);
private bool _selectedNow;
public bool SelectedNow {
public bool SelectedNow
{
get => _selectedNow;
private set => SetAndRaise(SelectedNowProperty, ref _selectedNow, value);
}
@@ -14,7 +14,7 @@ namespace Material.Demo.ViewModels
_command = new RelayCommand(OnExecuteCommandHandler);
}
private readonly Func<IAsyncEnumerable<string>> _commandHandler;
private ICommand _command;
@@ -28,9 +28,9 @@ namespace Material.Demo.ViewModels
OnPropertyChanged();
}
}
private string _header;
public string Header
{
get => _header;
@@ -40,9 +40,9 @@ namespace Material.Demo.ViewModels
OnPropertyChanged();
}
}
private string? _result;
public string? Result
{
get => _result;
@@ -56,7 +56,7 @@ namespace Material.Demo.ViewModels
private async void OnExecuteCommandHandler(object arg)
{
Result = "Waiting result...";
var builder = new StringBuilder();
await foreach (var str in _commandHandler())
+59 -58
View File
@@ -1,10 +1,10 @@
using Material.Dialog;
using Avalonia.Controls;
using System;
using System;
using System.Collections.Generic;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Media.Imaging;
using Avalonia.Platform;
using Material.Dialog;
using Material.Dialog.Enums;
namespace Material.Demo.ViewModels
@@ -18,7 +18,7 @@ namespace Material.Demo.ViewModels
public DialogDemoViewModel()
{
StandaloneDialogItems = new []
StandaloneDialogItems = new[]
{
new DialogDemoItemViewModel("Simple Dialog", Dialog1),
new DialogDemoItemViewModel("Dialog with confirmation", Dialog2),
@@ -52,34 +52,7 @@ namespace Material.Demo.ViewModels
StartupLocation = WindowStartupLocation.CenterOwner,
NegativeResult = new DialogResult("cancel"),
DialogHeaderIcon = Dialog.Icons.DialogIconKind.Help,
DialogButtons = new []
{
new DialogButton
{
Content = "CANCEL",
Result = "cancel"
},
new DialogButton
{
Content = "DELETE",
Result = "delete"
}
}
}).ShowDialog(Program.MainWindow);
yield return $"Result: {result.GetResult}";
}
private async IAsyncEnumerable<string> Dialog3()
{
var result = await DialogHelper.CreateAlertDialog(new AlertDialogBuilderParams
{
ContentHeader = "Confirm action",
SupportingText = "Are you sure to DELETE 20 FILES?",
DialogHeaderIcon = Dialog.Icons.DialogIconKind.Help,
StartupLocation = WindowStartupLocation.CenterOwner,
NegativeResult = new DialogResult("cancel"),
Borderless = true,
DialogButtons = new []
DialogButtons = new[]
{
new DialogButton
{
@@ -93,10 +66,37 @@ namespace Material.Demo.ViewModels
}
}
}).ShowDialog(Program.MainWindow);
yield return $"Result: {result.GetResult}";
if(result.GetResult == "delete")
}
private async IAsyncEnumerable<string> Dialog3()
{
var result = await DialogHelper.CreateAlertDialog(new AlertDialogBuilderParams
{
ContentHeader = "Confirm action",
SupportingText = "Are you sure to DELETE 20 FILES?",
DialogHeaderIcon = Dialog.Icons.DialogIconKind.Help,
StartupLocation = WindowStartupLocation.CenterOwner,
NegativeResult = new DialogResult("cancel"),
Borderless = true,
DialogButtons = new[]
{
new DialogButton
{
Content = "CANCEL",
Result = "cancel"
},
new DialogButton
{
Content = "DELETE",
Result = "delete"
}
}
}).ShowDialog(Program.MainWindow);
yield return $"Result: {result.GetResult}";
if (result.GetResult == "delete")
{
await DialogHelper.CreateAlertDialog(new AlertDialogBuilderParams
{
@@ -108,24 +108,24 @@ namespace Material.Demo.ViewModels
}).ShowDialog(Program.MainWindow);
}
}
private async IAsyncEnumerable<string> Dialog4()
{
// Get AssetLoader service
var assets = AvaloniaLocator.Current.GetService<IAssetLoader>();
// Open asset stream using assets.Open method.
await using var icon = assets?.Open(new Uri("avares://Material.Demo/Assets/avalonia-logo.png"));
var dialog = DialogHelper.CreateAlertDialog(new AlertDialogBuilderParams
{
ContentHeader = "Welcome to use Material.Avalonia",
SupportingText = "Enjoy Material Design in AvaloniaUI!",
StartupLocation = WindowStartupLocation.CenterOwner,
StartupLocation = WindowStartupLocation.CenterOwner,
Borderless = true,
// Create Image control
DialogIcon = new Bitmap(icon),
NeutralDialogButtons = new []
NeutralDialogButtons = new[]
{
new DialogButton
{
@@ -135,7 +135,7 @@ namespace Material.Demo.ViewModels
}
});
var result = await dialog.ShowDialog(Program.MainWindow);
yield return $"Result: {result.GetResult}";
}
@@ -157,7 +157,7 @@ namespace Material.Demo.ViewModels
Classes = "outline",
Label = "Account",
MaxCountChars = 24,
Validater = ValidateAccount,
Validater = ValidateAccount,
},
new TextFieldBuilderParams
{
@@ -169,7 +169,7 @@ namespace Material.Demo.ViewModels
Validater = ValidatePassword
}
},
DialogButtons = new []
DialogButtons = new[]
{
new DialogButton
{
@@ -185,22 +185,23 @@ namespace Material.Demo.ViewModels
}
}
}).ShowDialog(Program.MainWindow);
yield return $"Result: {result.GetResult}";
if (result.GetResult != "login")
yield break;
yield return $"Account: {result.GetFieldsResult()[0].Text}";
yield return $"Password: {result.GetFieldsResult()[1].Text}";
}
private Tuple<bool,string> ValidateAccount(string text)
private Tuple<bool, string> ValidateAccount(string text)
{
var result = text.Length > 5;
return new Tuple<bool, string>(result, result ? "" : "Too few account name.");
}
private Tuple<bool, string> ValidatePassword(string text)
private Tuple<bool, string> ValidatePassword(string text)
{
var result = text.Length >= 1;
return new Tuple<bool, string>(result, result ? "" : "Field should be filled.");
@@ -217,7 +218,7 @@ namespace Material.Demo.ViewModels
Width = 400,
TextFields = new TextFieldBuilderParams[]
{
new ()
new()
{
Label = "Folder name",
MaxCountChars = 256,
@@ -226,7 +227,7 @@ namespace Material.Demo.ViewModels
HelperText = "* Required"
}
},
DialogButtons = new []
DialogButtons = new[]
{
new DialogButton
{
@@ -242,9 +243,9 @@ namespace Material.Demo.ViewModels
}
},
}).ShowDialog(Program.MainWindow);
yield return $"Result: {result.GetResult}";
if (result.GetResult == "rename")
{
yield return $"Folder name: {result.GetFieldsResult()[0].Text}";
@@ -268,17 +269,17 @@ namespace Material.Demo.ViewModels
}
}
}).ShowDialog(Program.MainWindow);
yield return $"Result: {result.GetResult}";
if (result.GetResult != "confirm")
yield break;
var r = result.GetTimeSpan();
yield return $"TimeSpan: {r.ToString()}";
_previousTimePickerResult = r;
}
private async IAsyncEnumerable<string> DatePickerDialog()
{
var result = await DialogHelper.CreateDatePicker(new DatePickerDialogBuilderParams
@@ -296,16 +297,16 @@ namespace Material.Demo.ViewModels
}
}
}).ShowDialog(Program.MainWindow);
yield return $"Result: {result.GetResult}";
if (result.GetResult != "confirm")
yield break;
var r = result.GetDate();
// ReSharper disable once SimplifyStringInterpolation
yield return $"TimeSpan: {r.ToString("d")}";
_previousDatePickerResult = r;
}
}
}
}
+27 -15
View File
@@ -2,58 +2,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Subjects;
using System.Threading.Tasks;
using Avalonia;
using Material.Demo.Models;
using Material.Icons;
namespace Material.Demo.ViewModels {
public class IconsDemoViewModel : ViewModelBase {
namespace Material.Demo.ViewModels
{
public class IconsDemoViewModel : ViewModelBase
{
private IEnumerable<MaterialIconKindGroup>? _kinds;
private Lazy<List<MaterialIconKindGroup>> _materialIconKinds;
private MaterialIconKindGroup? _selectedGroup;
private string? _searchText;
public IconsDemoViewModel() {
public IconsDemoViewModel()
{
_materialIconKinds = new Lazy<List<MaterialIconKindGroup>>(() =>
Enum.GetNames(typeof(MaterialIconKind))
.GroupBy(k => (MaterialIconKind) Enum.Parse(typeof(MaterialIconKind), k))
.Select(g => new MaterialIconKindGroup(g))
.OrderBy(x => x.Kind)
.ToList());
SearchCommand = new RelayCommand(async o => {
SearchCommand = new RelayCommand(async o =>
{
if (string.IsNullOrWhiteSpace(SearchText))
Kinds = _materialIconKinds.Value;
else {
else
{
Kinds = new List<MaterialIconKindGroup>();
Kinds = await Task.Run(() =>
_materialIconKinds.Value
.Where(x => x.Aliases.Any(a => a.IndexOf(SearchText, StringComparison.CurrentCultureIgnoreCase) >= 0))
.ToList());
.Where(x => x.Aliases.Any(a =>
a.IndexOf(SearchText, StringComparison.CurrentCultureIgnoreCase) >= 0))
.ToList());
}
});
}
public IEnumerable<MaterialIconKindGroup> Kinds {
public IEnumerable<MaterialIconKindGroup> Kinds
{
get => _kinds ?? _materialIconKinds.Value;
set {
set
{
_kinds = value;
OnPropertyChanged(nameof(Kinds));
}
}
public MaterialIconKindGroup? SelectedGroup {
public MaterialIconKindGroup? SelectedGroup
{
get => _selectedGroup;
set {
set
{
_selectedGroup = value;
OnPropertyChanged(nameof(SelectedGroup));
}
}
public string? SearchText {
public string? SearchText
{
get => _searchText;
set {
set
{
_searchText = value;
OnPropertyChanged(nameof(SearchText));
}
@@ -62,6 +73,7 @@ namespace Material.Demo.ViewModels {
public RelayCommand SearchCommand { get; set; }
public RelayCommand CopyToClipboardCommand { get; set; } =
new RelayCommand(o => Application.Current.Clipboard.SetTextAsync($"<avalonia:MaterialIcon Kind=\"{o}\" />"));
new RelayCommand(o =>
Application.Current.Clipboard.SetTextAsync($"<avalonia:MaterialIcon Kind=\"{o}\" />"));
}
}
+2 -5
View File
@@ -39,11 +39,8 @@ namespace Material.Demo.ViewModels
if (handler != null)
{
// Call CanExecute via Dispatcher.UIThread.Post to prevent CanExecute can't be called from other thread.
Dispatcher.UIThread.Post(delegate
{
handler?.Invoke(this, new EventArgs());
});
Dispatcher.UIThread.Post(delegate { handler?.Invoke(this, new EventArgs()); });
}
}
}
}
}
@@ -6,6 +6,7 @@ namespace Material.Demo.ViewModels
public class TextFieldsViewModel : ViewModelBase
{
private string _numerics;
public string Numerics
{
get => _numerics;
+2 -1
View File
@@ -1,5 +1,6 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Runtime.CompilerServices;
public class ViewModelBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
+2 -3
View File
@@ -1,9 +1,8 @@
using Material.Dialog.Bases;
using Material.Dialog.Bases;
namespace Material.Dialog
{
public class AlertDialogBuilderParams : DialogWindowBuilderParamsBase
{
}
}
}
+10 -11
View File
@@ -1,14 +1,16 @@
using Avalonia.Controls;
using Material.Dialog.Interfaces;
using System;
using System;
using System.Threading.Tasks;
using Avalonia.Controls;
using Material.Dialog.Interfaces;
using Material.Styles.Assists;
namespace Material.Dialog.Bases
{
internal class DialogWindowBase<TWindow, TResult> : IDialogWindow<TResult> where TWindow : Window, IDialogWindowResult<TResult>
internal class DialogWindowBase<TWindow, TResult> : IDialogWindow<TResult>
where TWindow : Window, IDialogWindowResult<TResult>
{
private readonly TWindow _window;
public DialogWindowBase(TWindow window)
{
_window = window;
@@ -25,7 +27,7 @@ namespace Material.Dialog.Bases
/// </summary>
/// <returns>The window.</returns>
public Window GetWindow() => _window;
/// <summary>
/// Shows the window.
/// </summary>
@@ -44,16 +46,13 @@ namespace Material.Dialog.Bases
/// </summary>
/// <param name="ownerWindow">The dialog's owner window.</param>
/// <returns>Result of dialog.</returns>
public Task<TResult> ShowDialog(Window ownerWindow) => Procedure(delegate
{
_window.ShowDialog(ownerWindow);
});
public Task<TResult> ShowDialog(Window ownerWindow) => Procedure(delegate { _window.ShowDialog(ownerWindow); });
private Task<TResult> Procedure(Action action)
{
var tcs = new TaskCompletionSource<TResult>();
void OnceHandler (object sender, EventArgs args)
void OnceHandler(object sender, EventArgs args)
{
tcs.TrySetResult(_window.GetResult());
_window.Closed -= OnceHandler;
@@ -65,4 +64,4 @@ namespace Material.Dialog.Bases
return tcs.Task;
}
}
}
}
@@ -1,6 +1,6 @@
using Avalonia.Controls;
using Material.Dialog.Icons;
using Avalonia.Layout;
using Material.Dialog.Icons;
namespace Material.Dialog.Bases
{
@@ -13,7 +13,7 @@ namespace Material.Dialog.Bases
public string SupportingText = null;
public bool Borderless = false;
public WindowStartupLocation StartupLocation = WindowStartupLocation.CenterScreen;
/// <summary>
/// Specify kind of internal dialog icon. <br/>
/// This property will not applied if <see cref="DialogIcon"/> had value already.
@@ -25,19 +25,19 @@ namespace Material.Dialog.Bases
/// Specify <see cref="Avalonia.Media.Imaging.Bitmap"/>, <see cref="Avalonia.Controls.Control"/> or <see cref="DialogIconKind"/> for dialog header icon.
/// </summary>
public object DialogIcon = null;
/// <summary>
/// Build dialog buttons stack (left side).
/// <br/>You can use <seealso cref="DialogHelper.CreateSimpleDialogButtons(Enums.DialogButtonsEnum)"/> for create buttons stack in easy way.
/// </summary>
public DialogButton[] NeutralDialogButtons;
/// <summary>
/// Build dialog buttons stack.
/// <br/>You can use <seealso cref="DialogHelper.CreateSimpleDialogButtons(Enums.DialogButtonsEnum)"/> for create buttons stack in easy way.
/// </summary>
public DialogButton[] DialogButtons;
/// <summary>
/// Define result after close the dialog not from buttons
/// <br/> (could be from Alt + F4 or window close button).
@@ -49,4 +49,4 @@ namespace Material.Dialog.Bases
/// </summary>
public Orientation ButtonsOrientation = Orientation.Horizontal;
}
}
}
@@ -8,13 +8,16 @@ namespace Material.Dialog.Bases
/// <summary>
/// Define a positive action button.
/// </summary>
[Obsolete("Please use DialogButton.IsPositive instead. This API will be deprecated and removed on future updates.")]
[Obsolete(
"Please use DialogButton.IsPositive instead. This API will be deprecated and removed on future updates.")]
public DialogButton PositiveButton = DialogHelper.CreateSimpleDialogButtons(Enums.DialogButtonsEnum.Ok)[0];
/// <summary>
/// Define a negative action button.
/// </summary>
[Obsolete("Please use DialogButton.IsPositive instead. This API will be deprecated and removed on future updates.")]
public DialogButton NegativeButton = DialogHelper.CreateSimpleDialogButtons(Enums.DialogButtonsEnum.OkCancel)[0];
[Obsolete(
"Please use DialogButton.IsPositive instead. This API will be deprecated and removed on future updates.")]
public DialogButton NegativeButton =
DialogHelper.CreateSimpleDialogButtons(Enums.DialogButtonsEnum.OkCancel)[0];
}
}
@@ -1,4 +1,4 @@
using System;
using System;
using System.Windows.Input;
using Avalonia.Threading;
@@ -39,11 +39,8 @@ namespace Material.Dialog.Commands
if (handler != null)
{
// Call CanExecute via Dispatcher.UIThread.Post to prevent CanExecute can't be called from other thread.
Dispatcher.UIThread.Post(delegate
{
handler?.Invoke(this, new EventArgs());
});
Dispatcher.UIThread.Post(delegate { handler?.Invoke(this, new EventArgs()); });
}
}
}
}
}
}
@@ -4,6 +4,5 @@ namespace Material.Dialog.Controls
{
public class EmbeddedDialogControl : ContentControl
{
}
}
@@ -12,12 +12,13 @@ namespace Material.Dialog.Converters
if (parameter is string s)
format = s;
if (value is DateTime)
{
var v = (DateTime)value;
var v = (DateTime) value;
return v.ToString(format);
}
return "";
}
@@ -1,6 +1,5 @@
using Avalonia.Layout;
using System;
using Material.Dialog.Bases;
using System;
namespace Material.Dialog
{
@@ -11,7 +10,7 @@ namespace Material.Dialog
/// </summary>
public DateTime ImplicitValue = DateTime.Now;
}
public class TimePickerDialogBuilderParams : TwoFeedbackDialogBuilderParamsBase
{
/// <summary>
@@ -19,4 +18,4 @@ namespace Material.Dialog
/// </summary>
public TimeSpan ImplicitValue = TimeSpan.Zero;
}
}
}
@@ -7,7 +7,6 @@ namespace Material.Dialog
{
public DateTimePickerDialogResult()
{
}
public DateTimePickerDialogResult(string result, TimeSpan time)
@@ -15,26 +14,26 @@ namespace Material.Dialog
this.Result = result;
this._timeSpan = time;
}
public DateTimePickerDialogResult(string result, DateTime date)
{
this.Result = result;
this._dateTime = date;
}
internal string Result;
public string GetResult => Result;
// ReSharper disable once InconsistentNaming
internal TimeSpan _timeSpan;
/// <summary>
/// Get results of TimePicker.
/// </summary>
public TimeSpan GetTimeSpan() => _timeSpan;
internal DateTime _dateTime;
/// <summary>
/// Get result of DatePicker.
/// </summary>
+2 -2
View File
@@ -2,9 +2,9 @@
{
public class DialogButton
{
public string Result= "None";
public string Result = "None";
public object Content = "Action";
public bool IsPositive = false;
public bool IsNegative = false;
}
}
}
+71 -57
View File
@@ -1,16 +1,16 @@
using System;
using System.Collections.ObjectModel;
using Avalonia.Controls;
using Avalonia.Media.Imaging;
using Material.Dialog.Bases;
using Material.Dialog.Enums;
using Material.Dialog.Icons;
using Material.Dialog.Interfaces;
using Material.Dialog.ViewModels;
using Material.Dialog.Views;
using System.Collections.ObjectModel;
using Avalonia.Media.Imaging;
using Material.Dialog.Icons;
using Material.Dialog.ViewModels.Elements;
using Material.Dialog.ViewModels.Elements.Header.Icons;
using Material.Dialog.ViewModels.Elements.TextField;
using Material.Dialog.Views;
namespace Material.Dialog
{
@@ -23,6 +23,7 @@ namespace Material.Dialog
public const string DIALOG_RESULT_ABORT = "abort";
private static bool _disableTransitions;
public static bool DisableTransitions
{
get => _disableTransitions;
@@ -41,53 +42,53 @@ namespace Material.Dialog
case DialogButtonsEnum.Ok:
return new[]
{
new DialogButton { Result = DIALOG_RESULT_OK, Content = "OK" }
new DialogButton {Result = DIALOG_RESULT_OK, Content = "OK"}
};
case DialogButtonsEnum.OkAbort:
return new[]
{
new DialogButton { Result = DIALOG_RESULT_ABORT, Content = "ABORT" },
new DialogButton { Result = DIALOG_RESULT_OK, Content = "OK" }
new DialogButton {Result = DIALOG_RESULT_ABORT, Content = "ABORT"},
new DialogButton {Result = DIALOG_RESULT_OK, Content = "OK"}
};
case DialogButtonsEnum.OkCancel:
return new[]
{
new DialogButton { Result = DIALOG_RESULT_CANCEL, Content = "CANCEL" },
new DialogButton { Result = DIALOG_RESULT_OK, Content = "OK" }
new DialogButton {Result = DIALOG_RESULT_CANCEL, Content = "CANCEL"},
new DialogButton {Result = DIALOG_RESULT_OK, Content = "OK"}
};
case DialogButtonsEnum.YesNo:
return new[]
{
new DialogButton { Result = DIALOG_RESULT_NO, Content = "NO" },
new DialogButton { Result = DIALOG_RESULT_YES, Content = "YES" }
new DialogButton {Result = DIALOG_RESULT_NO, Content = "NO"},
new DialogButton {Result = DIALOG_RESULT_YES, Content = "YES"}
};
case DialogButtonsEnum.YesNoAbort:
return new[]
{
new DialogButton { Result = DIALOG_RESULT_ABORT, Content = "ABORT" },
new DialogButton { Result = DIALOG_RESULT_NO, Content = "NO" },
new DialogButton { Result = DIALOG_RESULT_YES, Content = "YES" }
new DialogButton {Result = DIALOG_RESULT_ABORT, Content = "ABORT"},
new DialogButton {Result = DIALOG_RESULT_NO, Content = "NO"},
new DialogButton {Result = DIALOG_RESULT_YES, Content = "YES"}
};
case DialogButtonsEnum.YesNoCancel:
return new[]
{
new DialogButton { Result = DIALOG_RESULT_CANCEL, Content = "CANCEL" },
new DialogButton { Result = DIALOG_RESULT_NO, Content = "NO" },
new DialogButton { Result = DIALOG_RESULT_YES, Content = "YES" }
new DialogButton {Result = DIALOG_RESULT_CANCEL, Content = "CANCEL"},
new DialogButton {Result = DIALOG_RESULT_NO, Content = "NO"},
new DialogButton {Result = DIALOG_RESULT_YES, Content = "YES"}
};
}
}
public static IDialogWindow<DialogResult> CreateAlertDialog(AlertDialogBuilderParams @params)
{
{
var window = new AlertDialog();
var context = new AlertDialogViewModel(window);
ApplyBaseParams(context, @params);
context.DialogButtons ??= new ObservableCollection<DialogButtonViewModel>(
CreateObsoleteButtonArray(context, CreateSimpleDialogButtons(DialogButtonsEnum.Ok)));
window.DataContext = context;
SetupWindowParameters(window, @params);
return new DialogWindowBase<AlertDialog, DialogResult>(window);
@@ -100,36 +101,37 @@ namespace Material.Dialog
context.TextFields =
new ObservableCollection<TextFieldViewModel>(TextFieldsBuilder(context, @params.TextFields));
ApplyBaseParams(context, @params);
var positiveButtonApplied = false;
var buttons = CreateObsoleteButtonArray(context, @params.DialogButtons);
foreach (var button in buttons)
{
if (!button.IsPositiveButton)
continue;
button.Command = context.SubmitCommand;
positiveButtonApplied = true;
}
context.DialogButtons = new ObservableCollection<DialogButtonViewModel>(buttons);
// TODO: Remove compatibility API with PositiveButton and NegativeButton on future update.
if (!positiveButtonApplied)
{
var positiveButton = @params.PositiveButton;
if (positiveButton != null)
{
context.DialogButtons.Add(new ObsoleteDialogButtonViewModel(context, positiveButton.Content, positiveButton.Result)
{
Command = context.SubmitCommand
});
context.DialogButtons.Add(
new ObsoleteDialogButtonViewModel(context, positiveButton.Content, positiveButton.Result)
{
Command = context.SubmitCommand
});
}
}
context.BindValidateHandler();
window.DataContext = context;
SetupWindowParameters(window, @params);
@@ -148,23 +150,24 @@ namespace Material.Dialog
{
PositiveButton = @params.PositiveButton,
NegativeButton = @params.NegativeButton,
FirstField = (ushort)@params.ImplicitValue.Hours,
SecondField = (ushort)@params.ImplicitValue.Minutes,
FirstField = (ushort) @params.ImplicitValue.Hours,
SecondField = (ushort) @params.ImplicitValue.Minutes,
};
ApplyBaseParams(context, @params);
context.DialogButtons =
new ObservableCollection<DialogButtonViewModel>(CreateObsoleteButtonArray(context, @params.NegativeButton,
new ObservableCollection<DialogButtonViewModel>(CreateObsoleteButtonArray(context,
@params.NegativeButton,
@params.PositiveButton));
if (context.Width is null || context.Width < 320)
context.Width = 320;
window.AttachViewModel(context);
SetupWindowParameters(window, @params);
return new DialogWindowBase<TimePickerDialog, DateTimePickerDialogResult>(window);
}
/// <summary>
/// Create date picker dialog.
/// </summary>
@@ -183,12 +186,13 @@ namespace Material.Dialog
ApplyBaseParams(context, @params);
context.DialogButtons =
new ObservableCollection<DialogButtonViewModel>(CreateObsoleteButtonArray(context, @params.NegativeButton,
new ObservableCollection<DialogButtonViewModel>(CreateObsoleteButtonArray(context,
@params.NegativeButton,
@params.PositiveButton));
if (context.Width is null || context.Width < 320)
context.Width = 320;
window.AttachViewModel(context);
SetupWindowParameters(window, @params);
return new DialogWindowBase<DatePickerDialog, DateTimePickerDialogResult>(window);
@@ -209,13 +213,14 @@ namespace Material.Dialog
};
ApplyBaseParams(context, @params);
window.DataContext = context;
SetupWindowParameters(window, @params);
return new DialogWindowBase<CustomDialog, DialogResult>(window);
}
private static void ApplyBaseParams<T> (T input, DialogWindowBuilderParamsBase @params) where T : DialogWindowViewModel
private static void ApplyBaseParams<T>(T input, DialogWindowBuilderParamsBase @params)
where T : DialogWindowViewModel
{
input.MaxWidth = @params.MaxWidth;
input.WindowTitle = @params.WindowTitle;
@@ -233,11 +238,12 @@ namespace Material.Dialog
{
Bitmap = bitmap
};
} break;
}
break;
case Image _:
throw new ArgumentException("Do not wrap Bitmap object with Image control for now.");
case Control _:
throw new ArgumentException("Custom view icon feature is currently unavailable.");
@@ -250,11 +256,12 @@ namespace Material.Dialog
Kind = kind
};
}
} break;
}
break;
case null:
break;
default:
throw new ArgumentException($"{@params.DialogIcon.GetType()} is a unknown or unsupported type.");
}
@@ -272,11 +279,15 @@ namespace Material.Dialog
}
if (@params.DialogButtons != null)
input.DialogButtons = new ObservableCollection<DialogButtonViewModel>(CreateObsoleteButtonArray(input, @params.DialogButtons));
input.DialogButtons =
new ObservableCollection<DialogButtonViewModel>(
CreateObsoleteButtonArray(input, @params.DialogButtons));
if (@params.NeutralDialogButtons != null)
input.NeutralDialogButton = new ObservableCollection<DialogButtonViewModel>(CreateObsoleteButtonArray(input, @params.NeutralDialogButtons));
input.NeutralDialogButton =
new ObservableCollection<DialogButtonViewModel>(
CreateObsoleteButtonArray(input, @params.NeutralDialogButtons));
input.ButtonsStackOrientation = @params.ButtonsOrientation;
}
@@ -286,7 +297,8 @@ namespace Material.Dialog
(window as IHasNegativeResult)?.SetNegativeResult(@params.NegativeResult);
}
private static DialogButtonViewModel[] CreateObsoleteButtonArray(DialogWindowViewModel parent, params DialogButton[] buttons)
private static DialogButtonViewModel[] CreateObsoleteButtonArray(DialogWindowViewModel parent,
params DialogButton[] buttons)
{
var len = buttons.Length;
var result = new DialogButtonViewModel[buttons.Length];
@@ -294,7 +306,7 @@ namespace Material.Dialog
for (var i = 0; i < len; i++)
{
var button = buttons[i];
if (button is null)
continue;
@@ -303,18 +315,19 @@ namespace Material.Dialog
IsPositiveButton = button.IsPositive
};
}
return result;
}
private static TextFieldViewModel[] TextFieldsBuilder(TextFieldDialogViewModel parent, params TextFieldBuilderParams[] @params)
private static TextFieldViewModel[] TextFieldsBuilder(TextFieldDialogViewModel parent,
params TextFieldBuilderParams[] @params)
{
var len = @params.Length;
var result = new TextFieldViewModel[len];
for (var i = 0; i < len; i++)
{
var param = @params[i];
try
{
var model = new TextFieldViewModel(parent, param.DefaultText, param.Validater)
@@ -334,7 +347,7 @@ namespace Material.Dialog
model.MaskChar = param.MaskChar;
model.Classes += " revealPasswordButton";
break;
case TextFieldKind.WithClear:
case TextFieldKind.WithClear:
model.Classes += " clearButton";
break;
case TextFieldKind.Normal:
@@ -345,13 +358,14 @@ namespace Material.Dialog
result[i] = model;
}
catch(Exception e)
catch (Exception e)
{
Console.WriteLine(e.Message);
// ignored
}
}
return result;
}
}
}
}
+6 -6
View File
@@ -1,19 +1,19 @@
using Material.Dialog.Interfaces;
namespace Material.Dialog
{
{
public class DialogResult : IDialogResult
{
{
/// <summary>
/// Constant none result.
/// </summary>
public static DialogResult NoResult { get; private set; } = new DialogResult { result = "none" };
public static DialogResult NoResult { get; private set; } = new DialogResult {result = "none"};
public DialogResult()
{
}
public DialogResult(string result)
{
this.result = result;
@@ -23,4 +23,4 @@ namespace Material.Dialog
private string result;
public virtual string GetResult => result;
}
}
}
+1 -1
View File
@@ -11,4 +11,4 @@ namespace Material.Dialog.Enums
YesNoCancel,
YesNoAbort,
}
}
}
+4 -8
View File
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Material.Dialog.Enums
namespace Material.Dialog.Enums
{
public enum TextFieldKind
{
@@ -10,15 +6,15 @@ namespace Material.Dialog.Enums
/// Regular text field.
/// </summary>
Normal,
/// <summary>
/// Regular text field, but with clear button.
/// </summary>
WithClear,
/// <summary>
/// Masked text field, this kind is most used in password field.
/// </summary>
Masked,
}
}
}
+14 -17
View File
@@ -1,28 +1,23 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Controls.Templates;
using Avalonia.Media;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace Material.Dialog.Icons
{
public class DialogIcon : TemplatedControl
{
{
static DialogIcon()
{
{
}
public static readonly StyledProperty<DialogIconKind> KindProperty
= AvaloniaProperty.Register<DialogIcon, DialogIconKind>(nameof(Kind), notifying: KindPropertyChangedCallback);
= AvaloniaProperty.Register<DialogIcon, DialogIconKind>(nameof(Kind),
notifying: KindPropertyChangedCallback);
private static void KindPropertyChangedCallback(IAvaloniaObject sender, bool before)
{
((DialogIcon)sender).UpdateData();
((DialogIcon)sender).UpdateColor();
((DialogIcon) sender).UpdateData();
((DialogIcon) sender).UpdateColor();
}
/// <summary>
@@ -47,27 +42,29 @@ namespace Material.Dialog.Icons
}
public static readonly StyledProperty<bool> UseRecommendColorProperty
= AvaloniaProperty.Register<DialogIcon, bool>(nameof(UseRecommendColor), true, notifying: UseRecommendColorPropertyChangedCallback);
= AvaloniaProperty.Register<DialogIcon, bool>(nameof(UseRecommendColor), true,
notifying: UseRecommendColorPropertyChangedCallback);
public bool UseRecommendColor
{
get => GetValue(UseRecommendColorProperty);
set => SetValue(UseRecommendColorProperty, value);
}
private static void UseRecommendColorPropertyChangedCallback(IAvaloniaObject sender, bool before)
{
((DialogIcon)sender).UpdateColor();
((DialogIcon) sender).UpdateColor();
}
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
base.OnApplyTemplate(e);
UpdateData();
}
}
private void UpdateData()
{
string data = null;
string data = null;
DialogIconsDataFactory.DataIndex.Value?.TryGetValue(Kind, out data);
var g = StreamGeometry.Parse(data);
this.Data = g;
@@ -83,4 +80,4 @@ namespace Material.Dialog.Icons
}
}
}
}
}
+3 -7
View File
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Material.Dialog.Icons
namespace Material.Dialog.Icons
{
public enum DialogIconKind
{
@@ -13,6 +9,6 @@ namespace Material.Dialog.Icons
Help,
Issues,
Stop,
Blocked
Blocked
}
}
}
+47 -20
View File
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Material.Dialog.Icons
{
@@ -16,6 +15,7 @@ namespace Material.Dialog.Icons
{
DataIndex = new Lazy<IDictionary<DialogIconKind, string>>(Create);
}
if (RecommendColorIndex == null)
{
RecommendColorIndex = new Lazy<IDictionary<DialogIconKind, string>>(CreateColor);
@@ -24,29 +24,56 @@ namespace Material.Dialog.Icons
public static IDictionary<DialogIconKind, string> Create()
{
return new Dictionary<DialogIconKind, string>() {
{ DialogIconKind.Blocked, "M8 1C9.61948 1.00012 11.1888 1.56176 12.4406 2.58924C13.6924 3.61671 14.5492 5.04644 14.8651 6.63483C15.1809 8.22321 14.9362 9.87197 14.1727 11.3002C13.4092 12.7284 12.1741 13.8477 10.6779 14.4673C9.18163 15.087 7.51682 15.1687 5.9671 14.6985C4.41739 14.2283 3.07865 13.2353 2.17899 11.8887C1.27933 10.5421 0.874413 8.92518 1.03324 7.31351C1.19206 5.70183 1.90479 4.19509 3.05 3.05C3.70006 2.40001 4.47178 1.88442 5.32111 1.53268C6.17043 1.18094 7.08072 0.999934 8 1ZM2 8C2.00142 9.41722 2.50446 10.7882 3.42 11.87L11.87 3.42C10.9981 2.68012 9.93297 2.20479 8.8 2.05C7.95183 1.93589 7.08908 2.00455 6.26963 2.25136C5.45019 2.49817 4.69303 2.91742 4.04897 3.48097C3.40491 4.04452 2.88886 4.73933 2.53546 5.51876C2.18206 6.29818 1.99949 7.1442 2 8ZM14 8C13.9986 6.58278 13.4955 5.21181 12.58 4.13L4.13 12.58C4.99597 13.338 6.06166 13.8309 7.2 14C8.05235 14.1147 8.91941 14.0448 9.7424 13.7951C10.5654 13.5454 11.3251 13.1217 11.97 12.5526C12.6149 11.9836 13.1299 11.2826 13.4801 10.4971C13.8304 9.71162 14.0077 8.86001 14 8Z" },
{ DialogIconKind.Error, "M8.6 0.999985C10.2 1.09999 11.7 1.89999 12.8 2.99999C14.1 4.39999 14.8 6.09999 14.8 8.09999C14.8 9.69999 14.2 11.2 13.2 12.5C12.2 13.7 10.8 14.6 9.2 14.9C7.6 15.2 6 15 4.6 14.2C3.2 13.4 2.1 12.2 1.5 10.7C0.899997 9.19999 0.799997 7.49999 1.3 5.99999C1.8 4.39999 2.7 3.09999 4.1 2.19999C5.4 1.29999 7 0.899985 8.6 0.999985ZM9.1 13.9C10.4 13.6 11.6 12.9 12.5 11.8C13.3 10.7 13.8 9.39999 13.7 7.99999C13.7 6.39999 13.1 4.79999 12 3.69999C11 2.69999 9.8 2.09999 8.4 1.99999C7.1 1.89999 5.7 2.19999 4.6 2.99999C3.5 3.79999 2.7 4.89999 2.3 6.29999C1.9 7.59999 1.9 8.99999 2.5 10.3C3.1 11.6 4 12.6 5.2 13.3C6.4 14 7.8 14.2 9.1 13.9ZM7.89999 7.5L10.3 5L11 5.7L8.59999 8.2L11 10.7L10.3 11.4L7.89999 8.9L5.49999 11.4L4.79999 10.7L7.19999 8.2L4.79999 5.7L5.49999 5L7.89999 7.5Z" },
{ DialogIconKind.Success, "M5.2900313,9.8848149 L6.0000313,9.8848149 10.559941,5.3249749 9.8499413,4.6149749 5.6500313,8.8248649 3.7301413,6.9049549 3.0201413,7.6149549 5.2900313,9.8848149 z M7.6201413,0.014999887 C9.2201413,0.11500489 10.720141,0.91500489 11.820141,2.0150049 13.120141,3.4150049 13.820141,5.1150049 13.820141,7.1150049 13.820141,8.7150049 13.220141,10.215015 12.220141,11.515015 11.220141,12.715015 9.8201413,13.615015 8.2201413,13.915015 6.6201413,14.215015 5.0201413,14.015015 3.6201413,13.215015 2.2201413,12.415015 1.1201413,11.215015 0.5201413,9.7150149 -0.079861696,8.2150049 -0.1798617,6.5150049 0.3201413,5.0150049 0.8201413,3.4150049 1.7201413,2.1150049 3.1201413,1.2150049 4.4201413,0.31500489 6.0201413,-0.085000113 7.6201413,0.014999887 z M8.1201413,12.915015 C9.4201413,12.615015 10.620141,11.915015 11.520141,10.815015 12.320141,9.7150149 12.820141,8.4150049 12.720141,7.0150049 12.720141,5.4150049 12.120141,3.8150049 11.020141,2.7150049 10.020141,1.7150049 8.8201413,1.1150049 7.4201413,1.0150049 6.1201413,0.91500489 4.7201413,1.2150049 3.6201413,2.0150049 2.5201413,2.8150049 1.7201413,3.9150049 1.3201413,5.3150049 0.9201413,6.6150049 0.9201413,8.0150049 1.5201413,9.3150149 2.1201413,10.615015 3.0201413,11.615015 4.2201413,12.315015 5.4201413,13.015015 6.8201413,13.215015 8.1201413,12.915015 z" },
{ DialogIconKind.Warning, "M8.44 1H7.56L1 13.26L1.44 14H14.54L14.98 13.26L8.44 1ZM2.28 13L8 2.28L13.7 13H2.28ZM7.5 6H8.5V10H7.5V6ZM7.5 11H8.5V12H7.5V11Z" },
{ DialogIconKind.Info, "M8.56838 1.03128C10.1595 1.19039 11.6436 1.90518 12.76 3.04996C13.9763 4.28555 14.6955 5.92552 14.7803 7.65726C14.8651 9.38899 14.3098 11.0913 13.2201 12.4398C12.2178 13.6857 10.8113 14.5416 9.24429 14.8594C7.67727 15.1772 6.04844 14.9369 4.64004 14.18C3.22861 13.4066 2.12677 12.1706 1.52004 10.68C0.910598 9.18166 0.829469 7.52043 1.29003 5.96988C1.7496 4.42537 2.72797 3.0868 4.06002 2.17996C5.38101 1.27892 6.97729 0.87217 8.56838 1.03128ZM9.04006 13.8799C10.3829 13.6075 11.5887 12.8756 12.45 11.81C13.3826 10.6509 13.8571 9.18961 13.7834 7.70376C13.7097 6.21792 13.0928 4.81093 12.05 3.74991C11.0949 2.77492 9.82747 2.16667 8.46932 2.0314C7.11117 1.89613 5.74869 2.24247 4.62002 3.00992C3.77045 3.59531 3.08444 4.38792 2.62691 5.31265C2.16939 6.23738 1.95553 7.26359 2.00561 8.2941C2.05568 9.3246 2.36803 10.3253 2.91305 11.2013C3.45807 12.0773 4.2177 12.7997 5.12002 13.3C6.31834 13.9467 7.7058 14.1519 9.04006 13.8799ZM8.51002 6.99997L7.51002 6.99997L7.51002 11L8.51002 11L8.51002 6.99997ZM8.51002 4.99997L7.51002 4.99997L7.51002 5.99997L8.51002 5.99997L8.51002 4.99997Z" },
{ DialogIconKind.Help, "M3.88999 2.10001C4.64422 1.60008 5.49452 1.26313 6.38647 1.11073C7.27842 0.958334 8.19236 0.993849 9.0698 1.215C9.94723 1.43616 10.7688 1.83808 11.482 2.39503C12.1951 2.95199 12.7842 3.65172 13.2113 4.44942C13.6385 5.24712 13.8944 6.12523 13.9627 7.02752C14.0309 7.92982 13.91 8.83643 13.6078 9.68932C13.3055 10.5422 12.8284 11.3226 12.2072 11.9805C11.5859 12.6384 10.8342 13.1594 9.99999 13.51C8.50784 14.1372 6.83537 14.1852 5.30975 13.6445C3.78413 13.1037 2.51514 12.0132 1.75104 10.5863C0.98694 9.15944 0.782709 7.49879 1.1783 5.92927C1.57389 4.35974 2.54084 2.99428 3.88999 2.10001ZM4.43999 12.1C5.07944 12.5048 5.79556 12.7732 6.54353 12.8886C7.29149 13.0039 8.05521 12.9636 8.7869 12.7703C9.51859 12.5769 10.2025 12.2346 10.7958 11.7648C11.3892 11.2951 11.8792 10.7079 12.2352 10.04C12.5912 9.37217 12.8055 8.63804 12.8648 7.88355C12.9241 7.12907 12.827 6.37048 12.5796 5.65523C12.3323 4.93999 11.94 4.28349 11.4273 3.72681C10.9146 3.17013 10.2925 2.72525 9.59999 2.42001C8.59883 1.99909 7.49372 1.89102 6.42999 2.11001C5.36185 2.31864 4.38023 2.84114 3.61067 3.6107C2.84111 4.38026 2.31861 5.36188 2.10999 6.43001C1.89817 7.49512 2.00641 8.5991 2.42105 9.60279C2.8357 10.6065 3.53819 11.465 4.43999 12.07V12.1ZM8.40999 4.00001C8.14028 3.88903 7.85163 3.8313 7.55999 3.83001C7.26789 3.82666 6.97832 3.88457 6.70999 4.00001C6.45001 4.11281 6.2128 4.27208 6.00999 4.47001C5.81313 4.66782 5.65686 4.90222 5.54999 5.16001C5.43108 5.42373 5.37298 5.71081 5.37999 6.00001H6.24999C6.248 5.74166 6.32304 5.48858 6.46553 5.27306C6.60802 5.05755 6.8115 4.88938 7.04999 4.79001C7.21081 4.71926 7.3843 4.68184 7.55999 4.68001C7.7389 4.68186 7.91565 4.71925 8.07999 4.79001C8.3947 4.92458 8.64542 5.1753 8.77999 5.49001C8.84376 5.6526 8.87764 5.82538 8.87999 6.00001C8.87711 6.18102 8.83263 6.35895 8.74999 6.52001C8.65701 6.67565 8.54627 6.81995 8.41999 6.95001L7.99999 7.32001C7.84981 7.46019 7.70948 7.61054 7.57999 7.77001C7.44651 7.93638 7.33865 8.12176 7.25999 8.32001C7.16659 8.53418 7.12218 8.7665 7.12999 9.00001V9.44001H7.99999V9.00001C7.99806 8.81841 8.04282 8.63935 8.12999 8.48001C8.22217 8.32385 8.33299 8.17946 8.45999 8.05001C8.59275 7.90928 8.73295 7.77576 8.87999 7.65001C9.03016 7.50984 9.17049 7.35949 9.29999 7.20001C9.43347 7.03365 9.54132 6.84827 9.61999 6.65001C9.70505 6.44383 9.74921 6.22306 9.74999 6.00001C9.7487 5.70837 9.69097 5.41972 9.57999 5.15001C9.3446 4.63589 8.92809 4.2265 8.40999 4.00001ZM7.99999 11.22V10.34H7.12999V11.22H7.99999Z" },
{ DialogIconKind.Issues, "M3.88882 3.09546C4.95774 2.38123 6.21445 2 7.50002 2C9.22393 2 10.8772 2.68482 12.0962 3.90381C13.3152 5.1228 14 6.77609 14 8.5C14 9.78558 13.6188 11.0423 12.9046 12.1112C12.1903 13.1801 11.1752 14.0133 9.98745 14.5052C8.79973 14.9972 7.49283 15.1259 6.23196 14.8751C4.97108 14.6243 3.81287 14.0052 2.90383 13.0962C1.99479 12.1872 1.37571 11.0289 1.1249 9.76807C0.874098 8.50719 1.00281 7.20029 1.49478 6.01257C1.98674 4.82485 2.8199 3.80969 3.88882 3.09546ZM4.44436 13.0731C5.34883 13.6775 6.41223 14 7.50002 14C8.95871 14 10.3576 13.4205 11.3891 12.389C12.4205 11.3576 13 9.95869 13 8.5C13 7.4122 12.6775 6.34881 12.0731 5.44434C11.4688 4.53987 10.6098 3.83498 9.60476 3.4187C8.59977 3.00242 7.49392 2.89349 6.42703 3.10571C5.36013 3.31793 4.38018 3.84177 3.61099 4.61096C2.8418 5.38015 2.31796 6.36011 2.10574 7.427C1.89352 8.4939 2.00244 9.59974 2.41873 10.6047C2.83501 11.6097 3.53989 12.4688 4.44436 13.0731ZM8 5H7V10H8V5ZM8 11H7V12H8V11Z" },
{ DialogIconKind.Stop, "M11.820141,2.0150049 C10.720141,0.91500489 9.2201413,0.11500489 7.6201413,0.014999887 6.0201413,-0.085000113 4.4201413,0.31500489 3.1201413,1.2150049 1.7201413,2.1150049 0.8201413,3.4150049 0.3201413,5.0150049 -0.1798617,6.5150049 -0.079861696,8.2150049 0.5201413,9.7150149 1.1201413,11.215015 2.2201413,12.415015 3.6201413,13.215015 5.0201413,14.015015 6.6201413,14.215015 8.2201413,13.915015 9.8201413,13.615015 11.220141,12.715015 12.220141,11.515015 13.220141,10.215015 13.820141,8.7150049 13.820141,7.1150049 13.820141,5.1150049 13.120141,3.4150049 11.820141,2.0150049 z M11.520141,10.815015 C10.620141,11.915015 9.4201413,12.615015 8.1201413,12.915015 6.8201413,13.215015 5.4201413,13.015015 4.2201413,12.315015 3.0201413,11.615015 2.1201413,10.615015 1.5201413,9.3150149 0.9201413,8.0150049 0.9201413,6.6150049 1.3201413,5.3150049 1.7201413,3.9150049 2.5201413,2.8150049 3.6201413,2.0150049 4.7201413,1.2150049 6.1201413,0.91500489 7.4201413,1.0150049 8.8201413,1.1150049 10.020141,1.7150049 11.020141,2.7150049 12.120141,3.8150049 12.720141,5.4150049 12.720141,7.0150049 12.820141,8.4150049 12.320141,9.7150149 11.520141,10.815015 z M5.0201413,5.0150149 L9.0201413,5.0150149 9.0201413,9.0150149 5.0201413,9.0150149 5.0201413,5.0150149 z" },
return new Dictionary<DialogIconKind, string>()
{
{
DialogIconKind.Blocked,
"M8 1C9.61948 1.00012 11.1888 1.56176 12.4406 2.58924C13.6924 3.61671 14.5492 5.04644 14.8651 6.63483C15.1809 8.22321 14.9362 9.87197 14.1727 11.3002C13.4092 12.7284 12.1741 13.8477 10.6779 14.4673C9.18163 15.087 7.51682 15.1687 5.9671 14.6985C4.41739 14.2283 3.07865 13.2353 2.17899 11.8887C1.27933 10.5421 0.874413 8.92518 1.03324 7.31351C1.19206 5.70183 1.90479 4.19509 3.05 3.05C3.70006 2.40001 4.47178 1.88442 5.32111 1.53268C6.17043 1.18094 7.08072 0.999934 8 1ZM2 8C2.00142 9.41722 2.50446 10.7882 3.42 11.87L11.87 3.42C10.9981 2.68012 9.93297 2.20479 8.8 2.05C7.95183 1.93589 7.08908 2.00455 6.26963 2.25136C5.45019 2.49817 4.69303 2.91742 4.04897 3.48097C3.40491 4.04452 2.88886 4.73933 2.53546 5.51876C2.18206 6.29818 1.99949 7.1442 2 8ZM14 8C13.9986 6.58278 13.4955 5.21181 12.58 4.13L4.13 12.58C4.99597 13.338 6.06166 13.8309 7.2 14C8.05235 14.1147 8.91941 14.0448 9.7424 13.7951C10.5654 13.5454 11.3251 13.1217 11.97 12.5526C12.6149 11.9836 13.1299 11.2826 13.4801 10.4971C13.8304 9.71162 14.0077 8.86001 14 8Z"
},
{
DialogIconKind.Error,
"M8.6 0.999985C10.2 1.09999 11.7 1.89999 12.8 2.99999C14.1 4.39999 14.8 6.09999 14.8 8.09999C14.8 9.69999 14.2 11.2 13.2 12.5C12.2 13.7 10.8 14.6 9.2 14.9C7.6 15.2 6 15 4.6 14.2C3.2 13.4 2.1 12.2 1.5 10.7C0.899997 9.19999 0.799997 7.49999 1.3 5.99999C1.8 4.39999 2.7 3.09999 4.1 2.19999C5.4 1.29999 7 0.899985 8.6 0.999985ZM9.1 13.9C10.4 13.6 11.6 12.9 12.5 11.8C13.3 10.7 13.8 9.39999 13.7 7.99999C13.7 6.39999 13.1 4.79999 12 3.69999C11 2.69999 9.8 2.09999 8.4 1.99999C7.1 1.89999 5.7 2.19999 4.6 2.99999C3.5 3.79999 2.7 4.89999 2.3 6.29999C1.9 7.59999 1.9 8.99999 2.5 10.3C3.1 11.6 4 12.6 5.2 13.3C6.4 14 7.8 14.2 9.1 13.9ZM7.89999 7.5L10.3 5L11 5.7L8.59999 8.2L11 10.7L10.3 11.4L7.89999 8.9L5.49999 11.4L4.79999 10.7L7.19999 8.2L4.79999 5.7L5.49999 5L7.89999 7.5Z"
},
{
DialogIconKind.Success,
"M5.2900313,9.8848149 L6.0000313,9.8848149 10.559941,5.3249749 9.8499413,4.6149749 5.6500313,8.8248649 3.7301413,6.9049549 3.0201413,7.6149549 5.2900313,9.8848149 z M7.6201413,0.014999887 C9.2201413,0.11500489 10.720141,0.91500489 11.820141,2.0150049 13.120141,3.4150049 13.820141,5.1150049 13.820141,7.1150049 13.820141,8.7150049 13.220141,10.215015 12.220141,11.515015 11.220141,12.715015 9.8201413,13.615015 8.2201413,13.915015 6.6201413,14.215015 5.0201413,14.015015 3.6201413,13.215015 2.2201413,12.415015 1.1201413,11.215015 0.5201413,9.7150149 -0.079861696,8.2150049 -0.1798617,6.5150049 0.3201413,5.0150049 0.8201413,3.4150049 1.7201413,2.1150049 3.1201413,1.2150049 4.4201413,0.31500489 6.0201413,-0.085000113 7.6201413,0.014999887 z M8.1201413,12.915015 C9.4201413,12.615015 10.620141,11.915015 11.520141,10.815015 12.320141,9.7150149 12.820141,8.4150049 12.720141,7.0150049 12.720141,5.4150049 12.120141,3.8150049 11.020141,2.7150049 10.020141,1.7150049 8.8201413,1.1150049 7.4201413,1.0150049 6.1201413,0.91500489 4.7201413,1.2150049 3.6201413,2.0150049 2.5201413,2.8150049 1.7201413,3.9150049 1.3201413,5.3150049 0.9201413,6.6150049 0.9201413,8.0150049 1.5201413,9.3150149 2.1201413,10.615015 3.0201413,11.615015 4.2201413,12.315015 5.4201413,13.015015 6.8201413,13.215015 8.1201413,12.915015 z"
},
{
DialogIconKind.Warning,
"M8.44 1H7.56L1 13.26L1.44 14H14.54L14.98 13.26L8.44 1ZM2.28 13L8 2.28L13.7 13H2.28ZM7.5 6H8.5V10H7.5V6ZM7.5 11H8.5V12H7.5V11Z"
},
{
DialogIconKind.Info,
"M8.56838 1.03128C10.1595 1.19039 11.6436 1.90518 12.76 3.04996C13.9763 4.28555 14.6955 5.92552 14.7803 7.65726C14.8651 9.38899 14.3098 11.0913 13.2201 12.4398C12.2178 13.6857 10.8113 14.5416 9.24429 14.8594C7.67727 15.1772 6.04844 14.9369 4.64004 14.18C3.22861 13.4066 2.12677 12.1706 1.52004 10.68C0.910598 9.18166 0.829469 7.52043 1.29003 5.96988C1.7496 4.42537 2.72797 3.0868 4.06002 2.17996C5.38101 1.27892 6.97729 0.87217 8.56838 1.03128ZM9.04006 13.8799C10.3829 13.6075 11.5887 12.8756 12.45 11.81C13.3826 10.6509 13.8571 9.18961 13.7834 7.70376C13.7097 6.21792 13.0928 4.81093 12.05 3.74991C11.0949 2.77492 9.82747 2.16667 8.46932 2.0314C7.11117 1.89613 5.74869 2.24247 4.62002 3.00992C3.77045 3.59531 3.08444 4.38792 2.62691 5.31265C2.16939 6.23738 1.95553 7.26359 2.00561 8.2941C2.05568 9.3246 2.36803 10.3253 2.91305 11.2013C3.45807 12.0773 4.2177 12.7997 5.12002 13.3C6.31834 13.9467 7.7058 14.1519 9.04006 13.8799ZM8.51002 6.99997L7.51002 6.99997L7.51002 11L8.51002 11L8.51002 6.99997ZM8.51002 4.99997L7.51002 4.99997L7.51002 5.99997L8.51002 5.99997L8.51002 4.99997Z"
},
{
DialogIconKind.Help,
"M3.88999 2.10001C4.64422 1.60008 5.49452 1.26313 6.38647 1.11073C7.27842 0.958334 8.19236 0.993849 9.0698 1.215C9.94723 1.43616 10.7688 1.83808 11.482 2.39503C12.1951 2.95199 12.7842 3.65172 13.2113 4.44942C13.6385 5.24712 13.8944 6.12523 13.9627 7.02752C14.0309 7.92982 13.91 8.83643 13.6078 9.68932C13.3055 10.5422 12.8284 11.3226 12.2072 11.9805C11.5859 12.6384 10.8342 13.1594 9.99999 13.51C8.50784 14.1372 6.83537 14.1852 5.30975 13.6445C3.78413 13.1037 2.51514 12.0132 1.75104 10.5863C0.98694 9.15944 0.782709 7.49879 1.1783 5.92927C1.57389 4.35974 2.54084 2.99428 3.88999 2.10001ZM4.43999 12.1C5.07944 12.5048 5.79556 12.7732 6.54353 12.8886C7.29149 13.0039 8.05521 12.9636 8.7869 12.7703C9.51859 12.5769 10.2025 12.2346 10.7958 11.7648C11.3892 11.2951 11.8792 10.7079 12.2352 10.04C12.5912 9.37217 12.8055 8.63804 12.8648 7.88355C12.9241 7.12907 12.827 6.37048 12.5796 5.65523C12.3323 4.93999 11.94 4.28349 11.4273 3.72681C10.9146 3.17013 10.2925 2.72525 9.59999 2.42001C8.59883 1.99909 7.49372 1.89102 6.42999 2.11001C5.36185 2.31864 4.38023 2.84114 3.61067 3.6107C2.84111 4.38026 2.31861 5.36188 2.10999 6.43001C1.89817 7.49512 2.00641 8.5991 2.42105 9.60279C2.8357 10.6065 3.53819 11.465 4.43999 12.07V12.1ZM8.40999 4.00001C8.14028 3.88903 7.85163 3.8313 7.55999 3.83001C7.26789 3.82666 6.97832 3.88457 6.70999 4.00001C6.45001 4.11281 6.2128 4.27208 6.00999 4.47001C5.81313 4.66782 5.65686 4.90222 5.54999 5.16001C5.43108 5.42373 5.37298 5.71081 5.37999 6.00001H6.24999C6.248 5.74166 6.32304 5.48858 6.46553 5.27306C6.60802 5.05755 6.8115 4.88938 7.04999 4.79001C7.21081 4.71926 7.3843 4.68184 7.55999 4.68001C7.7389 4.68186 7.91565 4.71925 8.07999 4.79001C8.3947 4.92458 8.64542 5.1753 8.77999 5.49001C8.84376 5.6526 8.87764 5.82538 8.87999 6.00001C8.87711 6.18102 8.83263 6.35895 8.74999 6.52001C8.65701 6.67565 8.54627 6.81995 8.41999 6.95001L7.99999 7.32001C7.84981 7.46019 7.70948 7.61054 7.57999 7.77001C7.44651 7.93638 7.33865 8.12176 7.25999 8.32001C7.16659 8.53418 7.12218 8.7665 7.12999 9.00001V9.44001H7.99999V9.00001C7.99806 8.81841 8.04282 8.63935 8.12999 8.48001C8.22217 8.32385 8.33299 8.17946 8.45999 8.05001C8.59275 7.90928 8.73295 7.77576 8.87999 7.65001C9.03016 7.50984 9.17049 7.35949 9.29999 7.20001C9.43347 7.03365 9.54132 6.84827 9.61999 6.65001C9.70505 6.44383 9.74921 6.22306 9.74999 6.00001C9.7487 5.70837 9.69097 5.41972 9.57999 5.15001C9.3446 4.63589 8.92809 4.2265 8.40999 4.00001ZM7.99999 11.22V10.34H7.12999V11.22H7.99999Z"
},
{
DialogIconKind.Issues,
"M3.88882 3.09546C4.95774 2.38123 6.21445 2 7.50002 2C9.22393 2 10.8772 2.68482 12.0962 3.90381C13.3152 5.1228 14 6.77609 14 8.5C14 9.78558 13.6188 11.0423 12.9046 12.1112C12.1903 13.1801 11.1752 14.0133 9.98745 14.5052C8.79973 14.9972 7.49283 15.1259 6.23196 14.8751C4.97108 14.6243 3.81287 14.0052 2.90383 13.0962C1.99479 12.1872 1.37571 11.0289 1.1249 9.76807C0.874098 8.50719 1.00281 7.20029 1.49478 6.01257C1.98674 4.82485 2.8199 3.80969 3.88882 3.09546ZM4.44436 13.0731C5.34883 13.6775 6.41223 14 7.50002 14C8.95871 14 10.3576 13.4205 11.3891 12.389C12.4205 11.3576 13 9.95869 13 8.5C13 7.4122 12.6775 6.34881 12.0731 5.44434C11.4688 4.53987 10.6098 3.83498 9.60476 3.4187C8.59977 3.00242 7.49392 2.89349 6.42703 3.10571C5.36013 3.31793 4.38018 3.84177 3.61099 4.61096C2.8418 5.38015 2.31796 6.36011 2.10574 7.427C1.89352 8.4939 2.00244 9.59974 2.41873 10.6047C2.83501 11.6097 3.53989 12.4688 4.44436 13.0731ZM8 5H7V10H8V5ZM8 11H7V12H8V11Z"
},
{
DialogIconKind.Stop,
"M11.820141,2.0150049 C10.720141,0.91500489 9.2201413,0.11500489 7.6201413,0.014999887 6.0201413,-0.085000113 4.4201413,0.31500489 3.1201413,1.2150049 1.7201413,2.1150049 0.8201413,3.4150049 0.3201413,5.0150049 -0.1798617,6.5150049 -0.079861696,8.2150049 0.5201413,9.7150149 1.1201413,11.215015 2.2201413,12.415015 3.6201413,13.215015 5.0201413,14.015015 6.6201413,14.215015 8.2201413,13.915015 9.8201413,13.615015 11.220141,12.715015 12.220141,11.515015 13.220141,10.215015 13.820141,8.7150049 13.820141,7.1150049 13.820141,5.1150049 13.120141,3.4150049 11.820141,2.0150049 z M11.520141,10.815015 C10.620141,11.915015 9.4201413,12.615015 8.1201413,12.915015 6.8201413,13.215015 5.4201413,13.015015 4.2201413,12.315015 3.0201413,11.615015 2.1201413,10.615015 1.5201413,9.3150149 0.9201413,8.0150049 0.9201413,6.6150049 1.3201413,5.3150049 1.7201413,3.9150049 2.5201413,2.8150049 3.6201413,2.0150049 4.7201413,1.2150049 6.1201413,0.91500489 7.4201413,1.0150049 8.8201413,1.1150049 10.020141,1.7150049 11.020141,2.7150049 12.120141,3.8150049 12.720141,5.4150049 12.720141,7.0150049 12.820141,8.4150049 12.320141,9.7150149 11.520141,10.815015 z M5.0201413,5.0150149 L9.0201413,5.0150149 9.0201413,9.0150149 5.0201413,9.0150149 5.0201413,5.0150149 z"
},
};
}
public static IDictionary<DialogIconKind, string> CreateColor()
{
return new Dictionary<DialogIconKind, string>() {
{ DialogIconKind.Blocked, "#C5C5C5" },
{ DialogIconKind.Error, "#F48771" },
{ DialogIconKind.Success, "#89D185" },
{ DialogIconKind.Warning, "#FFCC00" },
{ DialogIconKind.Info, "#75BEFF" },
{ DialogIconKind.Help, "#C5C5C5" },
{ DialogIconKind.Issues, "#C5C5C5" },
{ DialogIconKind.Stop, "#F48771" },
return new Dictionary<DialogIconKind, string>()
{
{DialogIconKind.Blocked, "#C5C5C5"},
{DialogIconKind.Error, "#F48771"},
{DialogIconKind.Success, "#89D185"},
{DialogIconKind.Warning, "#FFCC00"},
{DialogIconKind.Info, "#75BEFF"},
{DialogIconKind.Help, "#C5C5C5"},
{DialogIconKind.Issues, "#C5C5C5"},
{DialogIconKind.Stop, "#F48771"},
};
}
}
}
}
+2 -6
View File
@@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Material.Dialog.Interfaces
namespace Material.Dialog.Interfaces
{
public interface IDialogResult
{
string GetResult { get; }
}
}
}
+3 -3
View File
@@ -1,17 +1,17 @@
// This is clone of code IMsBoxWindow<T>
// https://github.com/AvaloniaUtils/MessageBox.Avalonia/blob/master/src/MessageBox.Avalonia/BaseWindows/Base/IMsBoxWindow.cs
using Avalonia.Controls;
using System.Threading.Tasks;
using Avalonia.Controls;
namespace Material.Dialog.Interfaces
{
public interface IDialogWindow<T>
{
Window GetWindow();
Task<T> ShowDialog(Window ownerWindow);
Task<T> Show();
Task<T> Show(Window window);
}
}
}
@@ -3,8 +3,8 @@
namespace Material.Dialog.Interfaces
{
public interface IDialogWindowResult <T>
public interface IDialogWindowResult<T>
{
T GetResult();
}
}
}
+10 -10
View File
@@ -3,31 +3,31 @@
public static class PartNames
{
public static string PartRootBorder => "PART_RootBorder";
public static string PartRootPanel => "PART_RootPanel";
public static string PartScrollViewer => "PART_ScrollViewer";
public static string PartContentPanel => "PART_ContentPanel";
public static string PartSupportingText => "PART_SupportingText";
public static string PartContentPresenter => "PART_ContentPresenter";
public static string PartTextFieldsContainer => "PART_TextFields";
public static string PartHeaderPanel => "PART_HeaderPanel";
public static string PartHeaderIcon => "PART_HeaderIcon";
public static string PartHeaderText => "PART_HeaderText";
public static string PartButtonsPanel => "PART_ButtonsPanel";
public static string PartButtonPlacement => "PART_ButtonPlacement";
public static string PartNeutralButtonPlacement => "PART_NeutralButtonPlacement";
}
}
@@ -28,7 +28,7 @@ namespace Material.Dialog.Resources
_ => throw new ArgumentOutOfRangeException()
};
}
// ReSharper restore UnusedMember.Local
}
}
+16 -16
View File
@@ -1,7 +1,5 @@
using Material.Dialog.Enums;
using System;
using System.Collections.Generic;
using System.Text;
using System;
using Material.Dialog.Enums;
namespace Material.Dialog
{
@@ -10,14 +8,14 @@ namespace Material.Dialog
/// <summary>
/// Constant normal text field.
/// </summary>
public static TextFieldBuilderParams[] OneRegularTextField =
{
new TextFieldBuilderParams
{
Label = "Text field",
FieldKind = TextFieldKind.Normal,
}
};
public static TextFieldBuilderParams[] OneRegularTextField =
{
new TextFieldBuilderParams
{
Label = "Text field",
FieldKind = TextFieldKind.Normal,
}
};
/// <summary>
/// Define an data validate function, result using <see cref="Tuple{Boolean,String}"/>
@@ -27,9 +25,10 @@ namespace Material.Dialog
/// </list>
/// </summary>
public Func<string, Tuple<bool, string>> Validater;
public string PlaceholderText = null;
public string DefaultText = "";
/// <summary>
/// <p>Helper text conveys additional guidance about the input field, such as how it will be used. It should only take up a single line, being persistently visible or visible only on focus.</p>
/// Read <a href="https://material.io/components/text-fields#anatomy">Material Design documentations. Text fields anatomy. Assistive elements</a> for more information.
@@ -38,17 +37,18 @@ namespace Material.Dialog
//[Obsolete("Currently AvaloniaUI are not supported to binding classes, do not use this before they fixed this.")]
public string Classes;
/// <summary>
/// Floating label text
/// </summary>
public string Label;
/// <summary>
/// Text field kind
/// </summary>
public TextFieldKind FieldKind;
public char MaskChar = '*';
public int MaxCountChars;
}
}
}
@@ -10,4 +10,4 @@ namespace Material.Dialog
public TextFieldBuilderParams[] TextFields = TextFieldBuilderParams.OneRegularTextField;
//public DialogResult NegativeResult = new DialogResult(DialogHelper.DIALOG_RESULT_CANCEL);
}
}
}
+4 -4
View File
@@ -1,11 +1,11 @@
namespace Material.Dialog
{
{
public class TextFieldDialogResult : DialogResult
{
public TextFieldDialogResult()
{
}
public TextFieldDialogResult(string result, TextFieldResult[] fieldsResult)
{
this.result = result;
@@ -14,8 +14,8 @@
internal string result;
public string GetResult => result;
internal TextFieldResult[] fieldsResult;
public TextFieldResult[] GetFieldsResult() => fieldsResult;
}
}
}
+1 -1
View File
@@ -4,4 +4,4 @@
{
public string Text { get; set; }
}
}
}
@@ -6,7 +6,6 @@ namespace Material.Dialog.ViewModels
{
public AlertDialogViewModel(AlertDialog dialog) : base(dialog)
{
}
}
}
}
@@ -7,7 +7,8 @@ namespace Material.Dialog.ViewModels
{
private object _content;
public object Content {
public object Content
{
get => _content;
set
{
@@ -15,10 +16,11 @@ namespace Material.Dialog.ViewModels
OnPropertyChanged();
}
}
private IDataTemplate _contentTemplate;
public IDataTemplate ContentTemplate {
public IDataTemplate ContentTemplate
{
get => _contentTemplate;
set
{
@@ -29,7 +31,6 @@ namespace Material.Dialog.ViewModels
public CustomDialogViewModel(CustomDialog dialog) : base(dialog)
{
}
}
}
@@ -14,6 +14,7 @@ namespace Material.Dialog.ViewModels
public DialogButton NegativeButton { get; internal set; }
private DateTime _dateTime;
public DateTime DateTime
{
get => _dateTime;
@@ -33,6 +34,7 @@ namespace Material.Dialog.ViewModels
{
return true;
}
public async void OnPressButton(object args)
{
var button = args as DialogButton;

Some files were not shown because too many files have changed in this diff Show More