feat - 添加管理界面(功能未开发

master
SoulStar 5 days ago
parent c277180645
commit bc0f53cdb5

@ -45,6 +45,7 @@
<Button Content="首 页" x:Name="Index" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=Index}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="10,0,10,0"/>
<Button Content="代码生成" x:Name="Generate" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Generate}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>
<Button Content="键 盘" Command="{Binding OpenSystemKeyboardCommand}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>
<Button Content="管 理" x:Name="Manage" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=Manage}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#009999" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>
<Button Content="控 制" x:Name="Control" Command="{Binding ControlOnClickCommand}" CommandParameter="{Binding Name,ElementName=Control}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="Green" BorderBrush="#FF36B5C1" Margin="0,0,10,0"/>
<Button Content="最小化" x:Name="Minimized" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Minimized}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#FF9900" BorderBrush="#FF9900" Margin="0,0,10,0"/>
<Button Content="退 出" x:Name="Exit" Command="{Binding FormControlCommand}" CommandParameter="{Binding Name,ElementName=Exit}" Style="{StaticResource BUTTON_AGREE}" Width="100" Height="30" Background="#FF0033" BorderBrush="#FF0033" Margin="0,0,10,0"/>

@ -0,0 +1,26 @@
<UserControl x:Class="SlnMesnac.WPF.Page.ManagePage.AGVManagePage"
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:SlnMesnac.WPF.Page.ManagePage"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="13*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" BorderBrush="#1254AB" BorderThickness="2">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Vertical">
<TextBlock Text="AGV配置管理" FontSize="24" Foreground="White" Margin="20,0,0,0"/>
</StackPanel>
</Border>
<Border Grid.Row="1" BorderBrush="#1254AB" BorderThickness="2" Margin="0,10,0,0">
</Border>
</Grid>
</Grid>
</UserControl>

@ -0,0 +1,28 @@
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 SlnMesnac.WPF.Page.ManagePage
{
/// <summary>
/// AGVManagePage.xaml 的交互逻辑
/// </summary>
public partial class AGVManagePage : UserControl
{
public AGVManagePage()
{
InitializeComponent();
}
}
}

@ -0,0 +1,75 @@
<UserControl x:Class="SlnMesnac.WPF.Page.ManagePage.BaseManagePage"
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:SlnMesnac.WPF.Page.ManagePage"
mc:Ignorable="d"
d:DesignHeight="841" d:DesignWidth="1906">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="9*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0">
<ListBox Background="Transparent"
Foreground="White"
BorderThickness="0"
FontSize="16"
ItemsSource="{Binding MenuItems}"
DisplayMemberPath="DisplayName"
SelectedValue="{Binding SelectedMenuItem, Mode=TwoWay}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<StackPanel Height="35" Orientation="Horizontal" Background="Transparent" Name="Container" Cursor="Hand">
<Rectangle Fill="Blue" VerticalAlignment="Stretch" Width="5" Visibility="Hidden" Name="LeftSideRectangle"></Rectangle>
<ContentPresenter VerticalAlignment="Center" Margin="15 0 0 0"></ContentPresenter>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Visibility" Value="Visible" TargetName="LeftSideRectangle"></Setter>
<Setter Property="Background" Value="#FF0077FB" TargetName="Container"/>
</Trigger>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Visibility" Value="Visible" TargetName="LeftSideRectangle"></Setter>
<Setter Property="Background" Value="#FF004CE2" TargetName="Container"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<!--<ListBoxItem Content="任务管理" IsSelected="True"/>
<ListBoxItem Content="AGV管理"/>
<ListBoxItem Content="任务模板管理"/>
<ListBoxItem Content="视觉管理"/>
<ListBoxItem Content="地图点位管理"/>-->
</ListBox>
</Border>
<Border Grid.Column="1">
<ContentControl Content="{Binding UserContent}">
<!--<ContentControl.Resources>
<DataTemplate DataType="{x:Type local:TaskManagePage}">
<local:TaskManagePage/>
</DataTemplate>
<DataTemplate DataType="{x:Type local:AGVManagePage}">
<local:AGVManagePage/>
</DataTemplate>
<DataTemplate DataType="{x:Type local:ModelManagePage}">
<local:ModelManagePage/>
</DataTemplate>
<DataTemplate DataType="{x:Type local:PositionManagePage}">
<local:PositionManagePage/>
</DataTemplate>
<DataTemplate DataType="{x:Type local:VisionManagePage}">
<local:VisionManagePage/>
</DataTemplate>
</ContentControl.Resources>-->
</ContentControl>
</Border>
</Grid>
</UserControl>

@ -0,0 +1,31 @@
using SlnMesnac.WPF.ViewModel.ManagePage;
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 SlnMesnac.WPF.Page.ManagePage
{
/// <summary>
/// BaseManagePage.xaml 的交互逻辑
/// </summary>
public partial class BaseManagePage : UserControl
{
public BaseManagePage()
{
InitializeComponent();
this.DataContext = new BaseManagePageViewModel();
}
}
}

@ -0,0 +1,12 @@
<UserControl x:Class="SlnMesnac.WPF.Page.ManagePage.ModelManagePage"
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:SlnMesnac.WPF.Page.ManagePage"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<TextBlock FontSize="40">ModelManagePage</TextBlock>
</Grid>
</UserControl>

@ -0,0 +1,28 @@
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 SlnMesnac.WPF.Page.ManagePage
{
/// <summary>
/// ModelManagePage.xaml 的交互逻辑
/// </summary>
public partial class ModelManagePage : UserControl
{
public ModelManagePage()
{
InitializeComponent();
}
}
}

@ -0,0 +1,13 @@
<UserControl x:Class="SlnMesnac.WPF.Page.ManagePage.PositionManagePage"
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:SlnMesnac.WPF.Page.ManagePage"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<TextBlock FontSize="40">PositionManagePage</TextBlock>
</Grid>
</UserControl>

@ -0,0 +1,28 @@
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 SlnMesnac.WPF.Page.ManagePage
{
/// <summary>
/// PositionManagePage.xaml 的交互逻辑
/// </summary>
public partial class PositionManagePage : UserControl
{
public PositionManagePage()
{
InitializeComponent();
}
}
}

@ -0,0 +1,13 @@
<UserControl x:Class="SlnMesnac.WPF.Page.ManagePage.TaskManagePage"
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:SlnMesnac.WPF.Page.ManagePage"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<TextBlock FontSize="40">TaskManagePage</TextBlock>
</Grid>
</UserControl>

@ -0,0 +1,28 @@
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 SlnMesnac.WPF.Page.ManagePage
{
/// <summary>
/// TaskManagePage.xaml 的交互逻辑
/// </summary>
public partial class TaskManagePage : UserControl
{
public TaskManagePage()
{
InitializeComponent();
}
}
}

@ -0,0 +1,12 @@
<UserControl x:Class="SlnMesnac.WPF.Page.ManagePage.VisionManagePage"
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:SlnMesnac.WPF.Page.ManagePage"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<TextBlock FontSize="40">VisionManagePage</TextBlock>
</Grid>
</UserControl>

@ -0,0 +1,28 @@
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 SlnMesnac.WPF.Page.ManagePage
{
/// <summary>
/// VisionManagePage.xaml 的交互逻辑
/// </summary>
public partial class VisionManagePage : UserControl
{
public VisionManagePage()
{
InitializeComponent();
}
}
}

@ -14,6 +14,7 @@ using SlnMesnac.TouchSocket;
using SlnMesnac.WPF.Page.ControlPage;
using SlnMesnac.WPF.Page.Generate;
using SlnMesnac.WPF.Page.IndexPage;
using SlnMesnac.WPF.Page.ManagePage;
using System;
using System.Collections.Generic;
using System.Linq;
@ -43,6 +44,7 @@ namespace SlnMesnac.WPF.ViewModel
private readonly GenerateControl generateControl = new GenerateControl();
private IndexContent indexContent = new IndexContent();
private UserTaskControl taskControl = new UserTaskControl();
private BaseManagePage managePage = new BaseManagePage();
private AppConfig _appConfig;
private AirPorthttpClient _airPorthttpClient;
private BaseTaskInfoBusiness _baseTaskInfoBusiness;
@ -131,7 +133,7 @@ namespace SlnMesnac.WPF.ViewModel
ControlOnClickCommand = new RelayCommand<object>(obj => ControlOnClick(obj));
FormControlCommand = new RelayCommand<object>(x => FormControl(x));
StopAllTaskActionInvoke();
StopAllTaskActionInit();
UserContent = indexContent;
@ -221,7 +223,7 @@ namespace SlnMesnac.WPF.ViewModel
/// <summary>
/// 停止所有任务和事件
/// </summary>
public void StopAllTaskActionInvoke()
public void StopAllTaskActionInit()
{
taskControl.StopTaskAction = () =>
{
@ -245,6 +247,9 @@ namespace SlnMesnac.WPF.ViewModel
case "Control":
UserContent = taskControl;
break;
case "Manage":
UserContent = managePage;
break;
default: break;
}
}

@ -0,0 +1,108 @@
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using SlnMesnac.WPF.Page.ControlPage;
using SlnMesnac.WPF.Page.IndexPage;
using SlnMesnac.WPF.Page.ManagePage;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
namespace SlnMesnac.WPF.ViewModel.ManagePage
{
public class BaseManagePageViewModel : ViewModelBase
{
public BaseManagePageViewModel()
{
_logger = App.ServiceProvider.GetService<ILogger<BaseManagePageViewModel>>();
SelectedMenuItem = MenuItems[0];
}
private readonly ILogger<BaseManagePageViewModel> _logger;
private AGVManagePage agvManagePage = new AGVManagePage();
private TaskManagePage taskManagePage = new TaskManagePage();
private ModelManagePage modelManagePage = new ModelManagePage();
private PositionManagePage positionManagePage = new PositionManagePage();
private VisionManagePage visionManagePage = new VisionManagePage();
// 菜单项集合
public MenuItem[] MenuItems { get; } =
{
new MenuItem("任务管理", "task"),
new MenuItem("AGV管理", "agv"),
new MenuItem("任务模板管理", "model"),
new MenuItem("视觉管理", "vision"),
new MenuItem("地图点位管理", "position")
};
// 当前选中的内容
private object _userContent;
public object UserContent
{
get => _userContent;
set => Set(ref _userContent, value);
}
// 当前选中的菜单项
private MenuItem _selectedMenuItem;
public MenuItem SelectedMenuItem
{
get => _selectedMenuItem;
set
{
Set(ref _selectedMenuItem, value);
ControlOnClick();
}
}
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
private void ControlOnClick()
{
switch (SelectedMenuItem?.Key)
{
case "agv":
UserContent = agvManagePage;
break;
case "task":
UserContent = taskManagePage;
break;
case "model":
UserContent = modelManagePage;
break;
case "position":
UserContent = positionManagePage;
break;
case "vision":
UserContent = visionManagePage;
break;
default:
UserContent = null!;
break;
}
}
// 菜单项模型
public class MenuItem
{
public MenuItem(string displayName, string key)
{
DisplayName = displayName;
Key = key;
}
public string DisplayName { get; }
public string Key { get; }
}
}
}
Loading…
Cancel
Save