Skip to content

Commit

Permalink
稍微优化了下UI
Browse files Browse the repository at this point in the history
  • Loading branch information
MLAcookie committed Feb 26, 2024
1 parent 6b1339b commit dc061c8
Show file tree
Hide file tree
Showing 9 changed files with 271 additions and 260 deletions.
30 changes: 30 additions & 0 deletions Control/OptionTemplete.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<UserControl
x:Class="M9AWPF.Control.OptionTemplete"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:M9AWPF.Control"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.modernwpf.com/2019"
d:Background="White"
d:DesignHeight="150"
d:DesignWidth="400"
mc:Ignorable="d">
<Grid Margin="0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Margin="10,0,0,0"
VerticalAlignment="Center"
d:Text="ForDesign"
Text="{Binding OptionName, TargetNullValue=Null, FallbackValue=BindingFail}" />
<ComboBox
Name="LocalComboBox"
Grid.Column="1"
MinWidth="250"
VerticalAlignment="Center"
ItemsSource="{Binding OptionValues}" />
</Grid>
</UserControl>
33 changes: 33 additions & 0 deletions Control/OptionTemplete.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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 M9AWPF.Control
{
/// <summary>
/// OptionTemplete.xaml 的交互逻辑
/// </summary>
public partial class OptionTemplete : UserControl
{
public string OptionName { get; set; }
public string[] OptionValues { get; set; }
public OptionTemplete(string optionName, string[] optionValues)
{
InitializeComponent();
OptionName = optionName;
OptionValues = optionValues;
DataContext = this;
}
}
}
2 changes: 0 additions & 2 deletions Model/ConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public static class ConfigManager
/// </summary>
private static readonly ConfigObject configObject = new();



/// <summary>
/// 按路径初始化
/// </summary>
Expand Down
17 changes: 0 additions & 17 deletions Model/MAAConfigObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace M9AWPF.Model;


/// <summary>
/// 应用启动时读取interface文件,指示配置中可选的字段及其value
/// </summary>
Expand Down Expand Up @@ -100,22 +99,6 @@ static ConfigInterface()
}
}

















/// <summary>
/// 该类指示MAA config json文件内容
/// </summary>
Expand Down
110 changes: 46 additions & 64 deletions View/EasyUI.xaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
<UserControl

x:Class="M9AWPF.View.EasyUI"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:M9AWPF.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:vm="clr-namespace:M9AWPF.ViewModel"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
d:DesignHeight="800"
d:DesignWidth="1000"
d:Background="White"
d:DesignHeight="600"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:EasyUIViewModel />
</UserControl.DataContext>


<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.4*" />
Expand All @@ -28,8 +23,7 @@
<RowDefinition Height="60" />
<RowDefinition />
</Grid.RowDefinitions>

<!-- 启动 -->
<!-- 启动 -->
<Grid
Width="Auto"
Height="Auto"
Expand All @@ -53,7 +47,6 @@
FontSize="16"
Text="← 按下这个就启动了" />
</Grid>

<StackPanel Grid.Row="1">
<Grid Margin="0,5,0,0">
<Grid.ColumnDefinitions>
Expand All @@ -74,7 +67,6 @@
SpinButtonPlacementMode="Hidden"
Value="{Binding ADBPort}" />
</Grid>

<Grid Margin="0,5,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
Expand All @@ -85,105 +77,95 @@
Grid.Column="1"
Width="100"
ItemsSource="{Binding AllResources}"
SelectedValue="{Binding Client}"/>
SelectedValue="{Binding Client}" />
</Grid>

<Separator Margin="5" />

<TextBlock
Margin="0,5,0,0"
FontSize="14"
Text=" + 新的任务" />

<Grid Margin="0,5,0,0">
<Grid Margin="0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition Width="120" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Margin="10,0,0,0"
VerticalAlignment="Center"
><Run Text="任务"/><Run Language="zh-cn" Text="名称"/></TextBlock>
Text="任务类型" />
<ComboBox
Name="ComboBox_TaskName"
Grid.Column="1"
MinWidth="250"
ItemsSource="{Binding AllTaskTypes}"
SelectionChanged="OnTaskNameSelectionChanged"
Name="ComboBox_TaskName">
</ComboBox>
SelectedIndex="0"
SelectionChanged="OnTaskNameSelectionChanged" />
</Grid>

<TextBlock
FontSize="14">
<Run Language="zh-cn" Text=" "/><Run Text="任务选项"/>
</TextBlock>
<StackPanel Name="StackPanel_TaskSettings"></StackPanel>
<StackPanel Name="StackPanel_TaskSettings" />
<Button
Margin="10,5,0,0"
Content="Add"
Click="Button_Add_Click"/>
Click="Button_Add_Click"
Content="Add" />
</StackPanel>
</Grid>

<ui:ScrollViewerEx Grid.Column="1">
<StackPanel Margin="20,0">
<TextBlock
Margin="0,10"
FontSize="16"
Text="任务列表:" />
Text="任务列表(右键可更改任务位置):" />
<ItemsControl Name="TaskList_ItemControl" ItemsSource="{Binding AllMAATasks}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="vm:BoxedMAATask">
<StackPanel>
<Grid>

<!-- 任务名称 -->
<!-- 任务名称 -->
<TextBlock
Name="Header_TextBlock"
Margin="10,7,0,7"
Text="{Binding Name}"
Visibility="Visible">

<!-- 菜单提供移动和删除操作 -->
<TextBlock.ContextMenu>
<ContextMenu>
<MenuItem Click="MoveUp_MenuItem_Click" Header="MoveUp">
<MenuItem.Icon>
<TextBlock FontFamily="/M9AWPF;component/Font/#Font Awesome 6 Free Solid" Text="&#xf062;" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Click="MoveDown_MenuItem_Click" Header="MoveDown">
<MenuItem.Icon>
<TextBlock FontFamily="/M9AWPF;component/Font/#Font Awesome 6 Free Solid" Text="&#xf063;" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Click="Delete_MenuItem_Click" Header="Delete">
<MenuItem.Icon>
<TextBlock FontFamily="/M9AWPF;component/Font/#Font Awesome 6 Free Solid" Text="&#xf2ed;" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</TextBlock.ContextMenu>
</TextBlock>
Visibility="Visible" />
</Grid>

<!-- 用来展示任务选项的部分 -->
<!-- 用来展示任务选项的部分 -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ItemsControl ItemsSource="{Binding Options}" Grid.Column="0" Margin="15,0,0,0" />
<ItemsControl ItemsSource="{Binding OptionVals}" Grid.Column="1" />
<ItemsControl
Grid.Column="0"
Margin="20,0,0,0"
ItemsSource="{Binding Options}" />
<ItemsControl Grid.Column="1" ItemsSource="{Binding OptionVals}" />
</Grid>
<Separator Margin="0,5,0,5" />
<!-- ===================== -->

<Separator Margin="0,10" />
<!-- ===================== -->
<StackPanel.ContextMenu>
<!-- 菜单提供移动和删除操作 -->
<ContextMenu>
<MenuItem Click="MoveUp_MenuItem_Click" Header="MoveUp">
<MenuItem.Icon>
<TextBlock FontFamily="/M9AWPF;component/Font/#Font Awesome 6 Free Solid" Text="&#xf062;" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Click="MoveDown_MenuItem_Click" Header="MoveDown">
<MenuItem.Icon>
<TextBlock FontFamily="/M9AWPF;component/Font/#Font Awesome 6 Free Solid" Text="&#xf063;" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Click="Delete_MenuItem_Click" Header="Delete">
<MenuItem.Icon>
<TextBlock FontFamily="/M9AWPF;component/Font/#Font Awesome 6 Free Solid" Text="&#xf2ed;" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</StackPanel.ContextMenu>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</ui:ScrollViewerEx>
</Grid>

</UserControl>
Loading

0 comments on commit dc061c8

Please sign in to comment.