diff --git a/UI/App.xaml.cs b/UI/App.xaml.cs
index dc92359097451c344f030d3cbe349e03db6be08e..dafb8be11aed96a8c3c21e6d8ad4cf8af85dd1e3 100644
--- a/UI/App.xaml.cs
+++ b/UI/App.xaml.cs
@@ -66,7 +66,7 @@ namespace UI
base.OnExit(e);
- appData.SaveAppChanges();
+ //appData.SaveAppChanges();
Logger.Save(true);
@@ -74,7 +74,7 @@ namespace UI
}
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
- appData.SaveAppChanges();
+ //appData.SaveAppChanges();
// 记录崩溃错误
Logger.Error("[程序崩溃异常] " + e.Exception.Message);
diff --git a/UI/Base/Color/Colors.cs b/UI/Base/Color/Colors.cs
index 9086dfb7a61e3e24d630942dcdbac0d20fe3747e..49632f287ca222acd7fb7d3cbcfe625521aca1ac 100644
--- a/UI/Base/Color/Colors.cs
+++ b/UI/Base/Color/Colors.cs
@@ -35,7 +35,7 @@ namespace UI.Base.Color
};
- public static string[] MainColors = { "#15C38E", "#A761FF", "#FFE6E6", "#00FFAB", "#B8F1B0", "#DAEAF1", "#1464DF", "#FF5C01", "#9EB23C", "#FF9999", "#998CEB", "#77E4D4", "#FD5E5E", "#B4FF9F", "#07FF01", "#FFE162", "#C70B80", "#590696", "#97DBAE" };
+ public static string[] MainColors = { "#00FFAB", "#A761FF", "#ff587f", "#ff1801", "#f7fd05", "#DAEAF1", "#2B20D9", "#FF5C01", "#9EB23C", "#FF9999", "#998CEB", "#77E4D4", "#FD5E5E", "#B4FF9F", "#07FF01", "#FFE162", "#C70B80", "#590696", "#97DBAE" };
public static IColor Get(ColorTypes color)
{
diff --git a/UI/Controls/Base/Img.cs b/UI/Controls/Base/Img.cs
index 3df6b0471597fc72591aeea22bcf54597a54cd4c..260d69340243774850d334defaba670bfc3905ce 100644
--- a/UI/Controls/Base/Img.cs
+++ b/UI/Controls/Base/Img.cs
@@ -1,6 +1,8 @@
using Core.Librarys.Image;
using System;
using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -18,6 +20,17 @@ namespace UI.Controls.Base
{
public class Img : Control
{
+ public CornerRadius Radius
+ {
+ get { return (CornerRadius)GetValue(RadiusProperty); }
+ set { SetValue(RadiusProperty, value); }
+ }
+ public static readonly DependencyProperty RadiusProperty =
+ DependencyProperty.Register("Radius",
+ typeof(CornerRadius),
+ typeof(Img));
+
+
///
/// 图片链接
///
@@ -36,30 +49,93 @@ namespace UI.Controls.Base
var control = (d as Img);
if (e.Property == URLProperty && e.OldValue != e.NewValue)
{
- control.Render();
+ control.Handle();
}
}
-
- private ImageBrush _image;
+ //private bool isRendered = false;
+ //private Image _image;
+ //Page page;
+ //private ImageBrush _image;
public Img()
{
DefaultStyleKey = typeof(Img);
+
+ //Loaded += Img_Loaded;
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
- _image = GetTemplateChild("image") as ImageBrush;
- Render();
+ //_image = GetTemplateChild("image") as ImageBrush;
+ //_image = GetTemplateChild("image") as Image;
+
+ //new Border().CornerRadius
}
- private void Render()
+ private void Handle()
{
- if (_image == null)
+ if (!File.Exists(URL))
{
- return;
+ URL = "pack://application:,,,/Tai;component/Resources/Icons/defaultIcon.png";
}
- _image.ImageSource = Imager.Load(URL);
}
+
+
+
+ //private void Page_LayoutUpdated(object sender, EventArgs e)
+ //{
+ // if (!isRendered)
+ // {
+ // Rect bounds = this.TransformToAncestor(page).TransformBounds(new Rect(0.0, 0.0, this.ActualWidth, this.ActualHeight));
+ // Rect rect = new Rect(0.0, 0.0, page.ActualWidth, page.ActualHeight);
+
+ // if (rect.Contains(bounds))
+ // {
+ // Debug.WriteLine("渲染!");
+
+ // isRendered = true;
+
+ // Render();
+ // }
+ // }
+ //}
+
+ //private void Img_Loaded(object sender, RoutedEventArgs e)
+ //{
+ // var parent = VisualTreeHelper.GetParent(this);
+ // while (!(parent is Page))
+ // {
+ // parent = VisualTreeHelper.GetParent(parent);
+ // }
+ // page = (parent as Page);
+
+ // page.LayoutUpdated += Page_LayoutUpdated;
+ //}
+
+ //private async void Render()
+ //{
+ // if (_image == null)
+ // {
+ // return;
+ // }
+
+ // //_image.Source = Imager.Load(URL);
+
+
+
+ // //_image.ImageSource = Imager.Load(URL);
+ // //BitmapImage bitimg = null;
+
+ // string img = URL != null ? URL.ToString() : "";
+
+ // var res = Task.Run(() =>
+ // {
+
+ // Debug.WriteLine("load:" + img);
+ // return Imager.Load(img);
+ // });
+
+ // _image.Source = await res;
+ //}
}
}
diff --git a/UI/Controls/Base/View.cs b/UI/Controls/Base/View.cs
index dd79c8e0e07125ffffe5ea995cb40aaeadb187bc..b3727f34d885e774e74f76b497927aba89ab5179 100644
--- a/UI/Controls/Base/View.cs
+++ b/UI/Controls/Base/View.cs
@@ -38,8 +38,14 @@ namespace UI.Controls.Base
public View()
{
DefaultStyleKey = typeof(View);
+
+ Loaded += View_Loaded;
}
+ private void View_Loaded(object sender, RoutedEventArgs e)
+ {
+ Handle();
+ }
private void Handle()
{
@@ -65,6 +71,28 @@ namespace UI.Controls.Base
string val = Condition.Substring(Condition.IndexOf("=") + 1);
isShow = val == Value.ToString();
}
+ else if (Condition.IndexOf("not null") != -1)
+ {
+
+ isShow = Value != null;
+ }
+ else if (Condition.IndexOf("null") != -1)
+ {
+
+ isShow = Value == null;
+ }
+ else if (Condition.IndexOf("empty") != -1)
+ {
+ if (Value == null)
+ {
+ isShow = true;
+ }
+ else
+ {
+ var data = Value as IEnumerable