Ver a proveniência

自定义控件修改

master
pry há 2 anos
ascendente
cometimento
a4daff9800
8 ficheiros alterados com 171 adições e 14 eliminações
  1. +1
    -1
      HBLConsole.Business/HeartbeatReport.cs
  2. +1
    -2
      HBLConsole.MainConsole/Main.cs
  3. +31
    -0
      HBLConsole.PryUserControl/IcoButton.xaml
  4. +48
    -0
      HBLConsole.PryUserControl/IcoButton.xaml.cs
  5. +9
    -9
      HBLConsole.Service/ThreadManage.cs
  6. +1
    -1
      HBLConsole/App.config
  7. +79
    -0
      HBLConsole/Resources/ResourceDictionarys/BasicStyle.xaml
  8. +1
    -1
      HBLConsole/View/BatchingAddView.xaml

+ 1
- 1
HBLConsole.Business/HeartbeatReport.cs Ver ficheiro

@@ -47,7 +47,7 @@ namespace HBLConsole.Business
MessagePackage.Message = deviceStatus;//GetMessage == null ? deviceStatus : GetMessage();
MqttHelper.GetInstance.MqttPublishAsync(Topic, MessagePackage.Serialize());
Thread.Sleep(1000);
}), "设备心跳上报");
}), "设备心跳上报", true);

}
}


+ 1
- 2
HBLConsole.MainConsole/Main.cs Ver ficheiro

@@ -46,7 +46,6 @@ namespace HBLConsole.MainConsole
Json<KeepDataBase>.Save();
Sqlite<Alarm>.GetInstance.Save();
TextHelper.GetInstance.SaveLogInfo(MessageLog.GetInstance.LogInfo, "LogInfo", "OrderInfoLog");

}

public void BusinessInit()
@@ -54,7 +53,7 @@ namespace HBLConsole.MainConsole
ThreadManage.GetInstance.Start(new Action(() =>
{
InternetInfo.ConfigInit();//从 consul 获取配置数据
//IotReport.GetInstance.Initialize();
IotReport.GetInstance.Initialize();
Topics.Clear();
Topics.Add(TOPIC.GetInstance.GetOrderPushTopic(GeneralConfig.DeviceType, InternetInfo.ClientId));
Topics.Add(TOPIC.GetInstance.GetBusinessTopic(GeneralConfig.DeviceType, InternetInfo.ClientId));


+ 31
- 0
HBLConsole.PryUserControl/IcoButton.xaml Ver ficheiro

@@ -0,0 +1,31 @@
<UserControl x:Class="HBLConsole.PryUserControl.IcoButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:HBLConsole.PryUserControl"
mc:Ignorable="d"
d:DesignHeight="30" d:DesignWidth="130">

<UserControl.Resources>
<ControlTemplate TargetType="Button" x:Key="iconButtonTemp">
<Border x:Name="br" BorderThickness="2" >

</Border>
<ControlTemplate.Triggers>

</ControlTemplate.Triggers>
</ControlTemplate>
</UserControl.Resources>

<Grid>
<Button>

</Button>
<!--<Canvas Width="auto" Height="auto">
<Button>
</Button>
</Canvas>-->
</Grid>
</UserControl>

+ 48
- 0
HBLConsole.PryUserControl/IcoButton.xaml.cs Ver ficheiro

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace HBLConsole.PryUserControl
{
/// <summary>
/// IcoButton.xaml 的交互逻辑
/// </summary>
public partial class IcoButton : UserControl
{
public IcoButton()
{
InitializeComponent();
}

public static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as IcoButton).Refresh();
}

private void Refresh()
{

}

public int BorderThickness
{
get { return (int)GetValue(BorderThicknessProperty); }
set { SetValue(BorderThicknessProperty, value); }
}
public static readonly DependencyProperty BorderThicknessProperty =
DependencyProperty.Register("BorderThickness", typeof(int), typeof(IcoButton),
new PropertyMetadata(2, new PropertyChangedCallback(OnPropertyChanged)));

}
}

+ 9
- 9
HBLConsole.Service/ThreadManage.cs Ver ficheiro

@@ -46,28 +46,28 @@ namespace HBLConsole.Service
CancellationTokenSources.TryAdd(guid + key, new CancellationTokenSource());
bool result = Threads.TryAdd(guid + key, Task.Factory.StartNew(new Action(() =>
{
ccc:
ReStart:
try
{
while (!CancellationTokenSources[guid + key].IsCancellationRequested)
{
if (action != null)
{
action();
}
if (action != null) action();
}
}
catch (Exception ex)
{

MessageLog.GetInstance.Show(ex.ToString());

if (IsRestart) goto ccc;
if (IsRestart)
{
Thread.Sleep(2000);
MessageLog.GetInstance.Show($"线程 【{key}】运行发生异常,已重启");
goto ReStart;
}
else
{
CancellationTokenSources.TryRemove(guid + key, out CancellationTokenSource temp);
Threads.TryRemove(guid + key, out Task temp1);
MessageLog.GetInstance.Show($"线程 【{key}】运行发生异常,已重启");
MessageLog.GetInstance.Show($"线程 【{key}】运行发生异常,已退出");
}
}
}), CancellationTokenSources[guid + key].Token).ContinueWith(new Action<Task, object>((t, o) =>


+ 1
- 1
HBLConsole/App.config Ver ficheiro

@@ -11,7 +11,7 @@

<!--客户端ID-->
<!--MorkD = 2,MorkS 且时且多 = 8,MorkS 珠海 = 9,冰淇淋 = 4,咖啡机 = 13-->
<add key="ClientId" value="9"/>
<add key="ClientId" value="4"/>

<add key="COM_Coffee" value="COM8"/>
<add key="BAUD_Coffee" value="115200"/>


+ 79
- 0
HBLConsole/Resources/ResourceDictionarys/BasicStyle.xaml Ver ficheiro

@@ -474,6 +474,85 @@
</Style>
<!--#endregion-->

<!--#region 图标按钮-->
<Style x:Key="IcoButtonStyle" TargetType="Button">
<Setter Property="FontFamily" Value="../Fonts/#iconfont" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
x:Name="br"
Background="Transparent"
BorderBrush="#FF19B7EC"
BorderThickness="2">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{Binding}"
Text="{Binding ElementName=br}" />
<ContentControl
Margin="10,0,5,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

<Trigger Property="IsPressed" Value="true">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<ControlTemplate x:Key="IcoButtonTemp" TargetType="Button">
<Border
x:Name="br"
Background="Transparent"
BorderBrush="#FF19B7EC"
BorderThickness="2">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../Fonts/#iconfont"
Text="{Binding Path=Content, RelativeSource={RelativeSource AncestorType=Button, Mode=TemplatedParent}}" />
<ContentControl
Margin="10,0,5,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

<Trigger Property="IsPressed" Value="true">
<Setter TargetName="br" Property="Background" Value="#2219B7EC" />
</Trigger>

</ControlTemplate.Triggers>
</ControlTemplate>
<!--#endregion-->

<!--#region 新建按钮-->
<ControlTemplate x:Key="NewButtonTemp" TargetType="Button">
<Border


+ 1
- 1
HBLConsole/View/BatchingAddView.xaml Ver ficheiro

@@ -14,6 +14,6 @@
Name="webView"
Width="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=ActualWidth}"
Height="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=ActualHeight}"
Source="http://162.14.105.138:8804/welcome" />
Source="http://1.14.74.54:8808/welcome" />
</Grid>
</UserControl>

Carregando…
Cancelar
Guardar