首次上传

This commit is contained in:
hanqiangqiang
2026-06-15 10:56:30 +08:00
commit b0213b94d6
4160 changed files with 736101 additions and 0 deletions
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
namespace Aitex.Core.UI.Dialog
{
public class MessageBoxEx
{
/// <summary>
/// show information dialog
/// </summary>
/// <param name="infoTitle">information title string</param>
/// <param name="infoContent">information content string</param>
public static void ShowInfo(string infoTitle, string infoContent)
{
NotificationDialog dlg = new NotificationDialog() { MessageTitle = infoTitle, MessageContent = infoContent, BannerColor = Brushes.DodgerBlue };
dlg.Show();
}
/// <summary>
/// show warning dialog
/// </summary>
/// <param name="infoTitle">information title string</param>
/// <param name="infoContent">information content string</param>
public static void ShowWarning(string infoTitle, string infoContent)
{
NotificationDialog dlg = new NotificationDialog() { MessageTitle = infoTitle, MessageContent = infoContent, BannerColor = Brushes.Gold };
dlg.Show();
}
/// <summary>
/// show error dialog
/// </summary>
/// <param name="infoTitle">information title string</param>
/// <param name="infoContent">information content string</param>
public static void ShowError(string infoTitle, string infoContent)
{
NotificationDialog dlg = new NotificationDialog() { MessageTitle = infoTitle, MessageContent = infoContent, BannerColor = Brushes.Red };
dlg.Show();
}
}
}
@@ -0,0 +1,32 @@
<Window x:Class="Aitex.Core.UI.Dialog.NotificationDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
BorderThickness="0"
Title="{DynamicResource GlobalLableMsgboxTitle}" Height="266" Width="495" ShowInTaskbar="False" Topmost="True"
WindowStartupLocation="CenterOwner" WindowStyle="ToolWindow" ResizeMode="NoResize" FontFamily="Arial,SimSun"
>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="46" />
<RowDefinition Height="150" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Background="DodgerBlue" Name="topGrid">
<TextBlock Height="31" HorizontalAlignment="Left" Margin="45,9,0,0" Name="_msgTitle" Text=" " VerticalAlignment="Top" Width="437" FontFamily="Arial,SimSun" FontSize="22" Foreground="White" />
<Image Height="37" HorizontalAlignment="Left" Margin="3,5,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="37" Source="/MECF.Framework.Common;component/Resources/CustomDialogInformation.png" />
</Grid>
<Grid Grid.Row="1">
<ScrollViewer>
<ScrollViewer.Content>
<Border BorderThickness="0,1" BorderBrush="Gray">
<TextBlock Grid.Row="1" Height="Auto" HorizontalAlignment="Left" Margin="12,10,0,0" Name="_msgContent" Text=" " VerticalAlignment="Top" Width="450" TextWrapping="Wrap" FontSize="16" FontFamily="Arial,SimSun" />
</Border>
</ScrollViewer.Content>
</ScrollViewer>
</Grid>
<Grid Grid.Row="2">
<Button Content="OK" Height="30" HorizontalAlignment="Left" Margin="355,4,0,0" Name="buttonOK" VerticalAlignment="Top" Width="111" FontSize="18" FontFamily="Arial,SimSun" Click="buttonOK_Click" IsDefault="True" IsCancel="True" />
<Label Content="00:00:00" Height="35" HorizontalAlignment="Left" Margin="12,3,0,0" Name="labelElapsedTime" VerticalAlignment="Top" Width="181" FontSize="18" Foreground="Goldenrod" />
</Grid>
</Grid>
</Window>
@@ -0,0 +1,118 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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 Aitex.Core.UI.Dialog
{
/// <summary>
/// Interaction logic for NotificationDialog.xaml
/// </summary>
public partial class NotificationDialog : Window
{
public NotificationDialog()
{
InitializeComponent();
Closing += new System.ComponentModel.CancelEventHandler(NotificationDialog_Closing);
_tm.Elapsed += new System.Timers.ElapsedEventHandler(_tm_Elapsed);
_tm.Start();
BannerColor = Brushes.DodgerBlue;
}
private TimeSpan _autoCloseTime = new TimeSpan(0, 1, 0);
void NotificationDialog_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
_tm.Stop();
}
DateTime _startTime = DateTime.Now;
System.Timers.Timer _tm = new System.Timers.Timer(500);
void _tm_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (DateTime.Now - _startTime > _autoCloseTime)
{
//延迟1min后,自动关闭提示对话框
Dispatcher.Invoke(new Action(() =>
{
Close();
}));
}
else
{
//显示对话框弹出显示至今的时间
labelElapsedTime.Dispatcher.BeginInvoke(new Action(() =>
{
labelElapsedTime.Content = (_startTime + new TimeSpan(0, 1, 0) - DateTime.Now).ToString(@"hh\:mm\:ss");
}));
}
}
/// <summary>
/// close current window
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
_tm.Stop();
Close();
}
/// <summary>
/// Message title
/// </summary>
public string MessageTitle
{
get
{
return _msgTitle.Text;
}
set
{
_msgTitle.Text = value;
}
}
/// <summary>
/// Message content
/// </summary>
public string MessageContent
{
get
{
return _msgContent.Text;
}
set
{
_msgContent.Text = value;
}
}
/// <summary>
/// Banner color
/// </summary>
public Brush BannerColor
{
get
{
return topGrid.Background;
}
set
{
topGrid.Background = value;
}
}
}
}
@@ -0,0 +1,32 @@
<Window x:Class="Aitex.Core.UI.Dialog.RecipeAlarmedDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
BorderThickness="0"
Title="{DynamicResource GlobalLableRecipeAlarmedTitle}" Height="360" Width="550" ShowInTaskbar="False" Topmost="True"
WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow" ResizeMode="NoResize" FontFamily="Arial,SimSun"
Background="{StaticResource viewBackgroundColor}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="46" />
<RowDefinition Height="230" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Background="Red" Name="topGrid">
<TextBlock Height="31" HorizontalAlignment="Left" Margin="45,9,0,0" Name="_msgTitle" Text=" " VerticalAlignment="Top" Width="489" FontFamily="Arial,SimSun" FontSize="20" Foreground="White" />
<Image Height="37" HorizontalAlignment="Left" Margin="3,5,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="37" Source="/MECF.Framework.Common;component/Resources/CustomDialogInformation.png" />
</Grid>
<Grid Grid.Row="1">
<ScrollViewer>
<ScrollViewer.Content>
<Border BorderThickness="0,1" BorderBrush="Gray">
<TextBlock Grid.Row="1" Height="Auto" HorizontalAlignment="Left" Margin="12,10,0,0" Name="_msgContent" Text=" " VerticalAlignment="Top" Width="450" TextWrapping="Wrap" FontSize="16" FontFamily="Arial,SimSun" />
</Border>
</ScrollViewer.Content>
</ScrollViewer>
</Grid>
<Grid Grid.Row="2" VerticalAlignment="Center">
<Button Content="{DynamicResource GlobalLableButtonContinue}" Height="30" HorizontalAlignment="Left" Margin="187,2,0,0" Name="buttonContinue" VerticalAlignment="Top" Width="111" FontSize="18" FontFamily="Arial,SimSun" IsDefault="True" IsCancel="True" Click="buttonContinue_Click" />
<Button Content="{DynamicResource GlobalLableButtonAbort}" Height="30" HorizontalAlignment="Left" Margin="337,2,0,0" Name="buttonAbort" VerticalAlignment="Top" Width="111" FontSize="18" FontFamily="Arial,SimSun" IsDefault="True" IsCancel="True" Click="buttonAbort_Click" />
</Grid>
</Grid>
</Window>
@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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 Aitex.Core.UI.Dialog
{
/// <summary>
/// Interaction logic for RecipeAlarmedDialog.xaml
/// </summary>
public partial class RecipeAlarmedDialog : Window
{
public RecipeAlarmedDialog()
{
InitializeComponent();
BannerColor = Brushes.Red;
}
public string MessageTitle
{
get
{
return _msgTitle.Text;
}
set
{
_msgTitle.Text = value;
}
}
public string MessageContent
{
get
{
return _msgContent.Text;
}
set
{
_msgContent.Text = value;
}
}
public Brush BannerColor
{
get
{
return topGrid.Background;
}
set
{
topGrid.Background = value;
}
}
public Action ResumeRecipe;
public Action AbortRecipe;
private void buttonContinue_Click(object sender, RoutedEventArgs e)
{
if (ResumeRecipe != null)
ResumeRecipe();
//Close();
Hide();
}
private void buttonAbort_Click(object sender, RoutedEventArgs e)
{
if (AbortRecipe != null)
AbortRecipe();
Hide();
}
}
}
@@ -0,0 +1,20 @@
<Window x:Class="Aitex.Core.UI.Dialog.RecipeSelectDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Select Recipe" Height="431" Width="328" FontSize="12" FontFamily="Arial,SimSun"
WindowStartupLocation="CenterOwner" ResizeMode="NoResize" Topmost="True" ShowInTaskbar="False"
>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="145" />
<RowDefinition Height="20*" />
</Grid.RowDefinitions>
<Grid Margin="0,0,0,33" Grid.RowSpan="2">
<TreeView Name="treeView1" Margin="0,-1,0,6" MouseDoubleClick="TreeView1_MouseDoubleClick" />
</Grid>
<Grid Grid.Row="1" Margin="0,222,0,0">
<Button Content="Select" Margin="0,0,87,3" Name="btnOK" Click="btnOK_Click" Height="23" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="75" />
<Button Content="Close" Margin="0,0,7,3" Name="btnCancel" Click="btnCancel_Click" HorizontalAlignment="Right" Width="75" Height="23" VerticalAlignment="Bottom" />
</Grid>
</Grid>
</Window>
@@ -0,0 +1,108 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Xml;
using Aitex.Core.UI.View.Common;
namespace Aitex.Core.UI.Dialog
{
/// <summary>
/// Interaction logic for RecipeSelectDialog.xaml
/// </summary>
public partial class RecipeSelectDialog : Window
{
private string _recipeList;
public RecipeSelectDialog(string recipeList)
{
_recipeList = recipeList;
InitializeComponent();
Loaded += new RoutedEventHandler(RecipeSelectDialog_Loaded);
}
/// <summary>
/// load recipe file list
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void RecipeSelectDialog_Loaded(object sender, RoutedEventArgs e)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(_recipeList);
CreateTreeViewItems(doc.DocumentElement, this.treeView1);
}
/// <summary>
/// Create TreeViewItems
/// </summary>
/// <param name="curElementNode"></param>
void CreateTreeViewItems(XmlElement curElementNode, ItemsControl itemsControl)
{
foreach (XmlElement ele in curElementNode.ChildNodes)
{
if (ele.Name == "File")
{
string fileName = ele.Attributes["Name"].Value;
fileName = fileName.Substring(fileName.LastIndexOf('\\') + 1);
TreeViewFileItem item = new TreeViewFileItem(ele.Attributes["Name"].Value);
item.Tag = ele.Attributes["Name"].Value;
item.ToolTip = ele.Attributes["Name"].Value;
itemsControl.Items.Add(item);
}
else if (ele.Name == "Folder")
{
string folderName = ele.Attributes["Name"].Value;
folderName = folderName.Substring(folderName.LastIndexOf('\\') + 1);
TreeViewFolderItem item = new TreeViewFolderItem(folderName);
item.Tag = ele.Attributes["Name"].Value;
CreateTreeViewItems(ele, item);
item.IsExpanded = false;
itemsControl.Items.Add(item);
}
}
}
/// <summary>
/// Selected recipe file
/// </summary>
public string SelectedRecipe
{
get
{
var file = treeView1.SelectedItem as TreeViewFileItem;
if (file != null)
return file.FileName;
return string.Empty;
}
}
/// <summary>
/// On click cancel button
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnCancel_Click(object sender, RoutedEventArgs e)
{
DialogResult = false;
Hide();
}
/// <summary>
/// On click ok button
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnOK_Click(object sender, RoutedEventArgs e)
{
DialogResult = true;
Close();
}
private void TreeView1_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
btnOK_Click(sender, e);
}
}
}
@@ -0,0 +1,63 @@
<Window x:Class="Aitex.Core.UI.Dialog.TerminalDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
BorderThickness="0"
Title="Terminal Message" Height="370" Width="500" ShowInTaskbar="True" Topmost="True"
WindowStartupLocation="CenterOwner" WindowStyle="SingleBorderWindow" ResizeMode="NoResize" FontFamily="Arial,SimSun"
Background="{StaticResource viewBackgroundColor}">
<Window.Resources>
<Style TargetType="{x:Type ListViewItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding MessageSource}" Value="E">
<Setter Property="Foreground" Value="Blue" />
<Setter Property="FontSize" Value="Blue" />
</DataTrigger>
<DataTrigger Binding="{Binding HasErrors}" Value="False">
<Setter Property="Background" Value="Green" />
</DataTrigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="250" />
<RowDefinition Height="70" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<ItemsControl Width="380" Margin="10" Background="#FFDCF7F6" ItemsSource="{Binding TerminalMessageList}" Name="itemsControl">
<ItemsControl.Template>
<ControlTemplate TargetType="{x:Type ItemsControl}">
<Border CornerRadius="5">
<ScrollViewer VerticalScrollBarVisibility="Auto" >
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical" Name="wp" Margin="0" Background="#FFDCF7F6"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel >
<TextBox Text="{Binding Title, Mode=OneWay }" Margin="0" IsReadOnly="True" IsEnabled="False" TextWrapping="Wrap" FontSize="12"/>
<TextBox Text="{Binding Content, Mode=OneWay }" Margin="0" IsReadOnly="True" IsEnabled="False" TextWrapping="Wrap" FontSize="12"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Width="80" Height="50" Margin="0" Content="Clear" VerticalAlignment="Top" HorizontalAlignment="Left" Command="{Binding TerminalClearCommand}"></Button>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal">
<TextBox Text="{Binding TerminalMessageSetPoint}" Width="380" Height="60" Margin="10,0,10,0" AcceptsReturn="True"></TextBox>
<Button Width="80" Height="50" Margin="0" Content="Send" VerticalAlignment="Center" HorizontalAlignment="Left" Command="{Binding TerminalSendCommand}"></Button>
</StackPanel>
</Grid>
</Window>
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
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 Aitex.Core.UI.Dialog
{
/// <summary>
/// Interaction logic for NotificationDialog.xaml
/// </summary>
public partial class TerminalDialog : Window
{
public TerminalDialog()
{
InitializeComponent();
}
}
}