Skip to content

Commit 125ff62

Browse files
committed
增加了逻辑判断项(无法使用),仅作为外观参考
1 parent 3a2cff8 commit 125ff62

18 files changed

Lines changed: 202 additions & 50 deletions

File tree

Round.NET.AvaloniaApp.EncodeCalculator/Models/Mange/ItemManage/ItemMange.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Avalonia.Threading;
55
using FluentAvalonia.UI.Controls;
66
using Round.NET.AvaloniaApp.EncodeCalculator.Views.Controls;
7+
using Round.NET.AvaloniaApp.EncodeCalculator.Views.Controls.Items.ItemControls;
78

89
namespace Round.NET.AvaloniaApp.EncodeCalculator.Models.ItemManage;
910

@@ -52,11 +53,11 @@ public string Note
5253
}
5354
public UnitItem Item { get; set; } = new UnitItem();
5455
public string UUID { get; set; }
55-
public int Type { get; set; } = 0;
56+
public Type.Type.NodeType Type { get; set; } = Models.Type.Type.NodeType.Function;
5657
public bool IsMain { get; set; } = false;
5758
}
5859

59-
public static void AddItem(RootConfig config)
60+
public static void AddFuncItem(RootConfig config)
6061
{
6162
if (!Deduplication.DeduplicationItem(config.Name))
6263
{
@@ -84,6 +85,10 @@ public static void AddItem(RootConfig config)
8485
});
8586
}
8687
}
88+
public static void AddCompItem() // 未完成!!!!!!!!!!!!!!!!!!!!!!!
89+
{
90+
ItemListBox.Items.Add(new ComparisonItem());
91+
}
8792

8893
public static void ClearItems()
8994
{

Round.NET.AvaloniaApp.EncodeCalculator/Models/Mange/ProjectMange/Project.cs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public class ItemListClass
2626
public string ClassicValue { get; set; }
2727
public string Note { get; set; } = "无备注";
2828
public bool IsMain { get; set; } = false;
29+
public Type.Type.NodeType Type { get; set; } = Models.Type.Type.NodeType.Function;
2930
}
3031
public class SaveProject
3132
{
@@ -47,7 +48,8 @@ public static Root GetNowRoot()
4748
Value = item.Value.Replace("\n","").Replace("\r",""),
4849
ClassicValue = item.ClassicValue.Replace("\n","\\n").Replace("\r","\\r"),
4950
IsMain = item.IsMain,
50-
Note = item.Note
51+
Note = item.Note,
52+
Type = item.Type
5153
});
5254
}
5355
return root;
@@ -69,14 +71,17 @@ public static void OpenProjectCore(Root root)
6971

7072
foreach (var item in root.Items)
7173
{
72-
ItemMange.AddItem(new ItemMange.RootConfig()
74+
if (item.Type == Models.Type.Type.NodeType.Function)
7375
{
74-
Name = item.Name,
75-
Value = item.Value,
76-
ClassicValue = item.ClassicValue,
77-
IsMain = item.IsMain,
78-
Note = item.Note
79-
});
76+
ItemMange.AddFuncItem(new ItemMange.RootConfig()
77+
{
78+
Name = item.Name,
79+
Value = item.Value,
80+
ClassicValue = item.ClassicValue,
81+
IsMain = item.IsMain,
82+
Note = item.Note
83+
});
84+
}
8085
}
8186
}
8287
}
@@ -87,7 +92,7 @@ public static void NewProjectCore()
8792
{
8893
Edit.Edit.EditMode = true;
8994
ItemMange.ClearItems();
90-
ItemMange.AddItem(new ItemMange.RootConfig()
95+
ItemMange.AddFuncItem(new ItemMange.RootConfig()
9196
{
9297
Value = "1+1",
9398
Name = "Main",

Round.NET.AvaloniaApp.EncodeCalculator/Models/Type/Type.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public class Type
44
{
55
public enum NodeType
66
{
7-
Function,
8-
Variable
7+
Function, // 函数
8+
Comparison // 比较
99
}
1010
}

Round.NET.AvaloniaApp.EncodeCalculator/Round.NET.AvaloniaApp.EncodeCalculator.csproj

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,24 @@
2424
</ItemGroup>
2525

2626
<ItemGroup>
27+
<Compile Update="Views\Controls\Items\ItemControls\UnitItem.axaml.cs">
28+
<DependentUpon>UnitItem.axaml</DependentUpon>
29+
<SubType>Code</SubType>
30+
</Compile>
2731
<Compile Update="Views\Controls\Items\ItemsView.axaml.cs">
2832
<DependentUpon>ItemsView.axaml</DependentUpon>
2933
<SubType>Code</SubType>
3034
</Compile>
31-
<Compile Update="Views\Controls\Items\UnitItem.axaml.cs">
32-
<DependentUpon>UnitItem.axaml</DependentUpon>
35+
<Compile Update="Views\Controls\Items\EditItem\FunItems\AddItem.axaml.cs">
36+
<DependentUpon>AddItem.axaml</DependentUpon>
3337
<SubType>Code</SubType>
3438
</Compile>
35-
<Compile Update="Views\Controls\Items\EditItem\EditItem.axaml.cs">
36-
<DependentUpon>EditItem.axaml</DependentUpon>
39+
<Compile Update="Views\Controls\Items\EditItem\FunItems\DeepEditItem.axaml.cs">
40+
<DependentUpon>DeepEditItem.axaml</DependentUpon>
3741
<SubType>Code</SubType>
3842
</Compile>
39-
<Compile Update="Views\Controls\Items\EditItem\AddItem.axaml.cs">
40-
<DependentUpon>AddItem.axaml</DependentUpon>
43+
<Compile Update="Views\Controls\Items\EditItem\FunItems\EditItem.axaml.cs">
44+
<DependentUpon>EditItem.axaml</DependentUpon>
4145
<SubType>Code</SubType>
4246
</Compile>
4347
</ItemGroup>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<UserControl xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
6+
x:Class="Round.NET.AvaloniaApp.EncodeCalculator.Views.Controls.Items.EditItem.CompItems.AddCompItem">
7+
<Grid>
8+
<StackPanel>
9+
<DockPanel Margin="5">
10+
<Label Width="90" VerticalAlignment="Center">名称:</Label>
11+
<TextBox Name="NameBox">NewComparisonItem</TextBox>
12+
</DockPanel>
13+
<DockPanel Margin="5">
14+
<Label Width="90" VerticalAlignment="Center">备注:</Label>
15+
<TextBox Name="NoteBox">无备注</TextBox>
16+
</DockPanel>
17+
<DockPanel Margin="5">
18+
<Label Width="90" VerticalAlignment="Center">表达式 1:</Label>
19+
<TextBox Name="ValueBox1" IsReadOnly="False" Height="32"></TextBox>
20+
</DockPanel>
21+
<DockPanel Margin="5">
22+
<Label Width="90" VerticalAlignment="Center">表达式 2:</Label>
23+
<TextBox Name="ValueBox2" IsReadOnly="False" Height="32"></TextBox>
24+
</DockPanel>
25+
<DockPanel Margin="5">
26+
<Label Width="90" VerticalAlignment="Center">条件判断:</Label>
27+
<ComboBox Name="ValueBox3" Height="32" HorizontalAlignment="Stretch" SelectedIndex="0">
28+
<ComboBoxItem>==</ComboBoxItem>
29+
<ComboBoxItem>!=</ComboBoxItem>
30+
<ComboBoxItem>&gt;=</ComboBoxItem>
31+
<ComboBoxItem>&lt;=</ComboBoxItem>
32+
<ComboBoxItem>&gt;</ComboBoxItem>
33+
<ComboBoxItem>&lt;</ComboBoxItem>
34+
</ComboBox>
35+
</DockPanel>
36+
<Label Foreground="Gray" HorizontalAlignment="Center">值为true返回 表达式1 ; 反之为 表达式2.</Label>
37+
</StackPanel>
38+
</Grid>
39+
</UserControl>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Avalonia;
2+
using Avalonia.Controls;
3+
using Avalonia.Markup.Xaml;
4+
5+
namespace Round.NET.AvaloniaApp.EncodeCalculator.Views.Controls.Items.EditItem.CompItems;
6+
7+
public partial class AddCompItem : UserControl
8+
{
9+
public AddCompItem()
10+
{
11+
InitializeComponent();
12+
}
13+
}

Round.NET.AvaloniaApp.EncodeCalculator/Views/Controls/Items/EditItem/AddItem.axaml renamed to Round.NET.AvaloniaApp.EncodeCalculator/Views/Controls/Items/EditItem/FunItems/AddItem.axaml

File renamed without changes.

Round.NET.AvaloniaApp.EncodeCalculator/Views/Controls/Items/EditItem/AddItem.axaml.cs renamed to Round.NET.AvaloniaApp.EncodeCalculator/Views/Controls/Items/EditItem/FunItems/AddItem.axaml.cs

File renamed without changes.

Round.NET.AvaloniaApp.EncodeCalculator/Views/Controls/Items/EditItem/DeepEditItem.axaml renamed to Round.NET.AvaloniaApp.EncodeCalculator/Views/Controls/Items/EditItem/FunItems/DeepEditItem.axaml

File renamed without changes.

Round.NET.AvaloniaApp.EncodeCalculator/Views/Controls/Items/EditItem/DeepEditItem.axaml.cs renamed to Round.NET.AvaloniaApp.EncodeCalculator/Views/Controls/Items/EditItem/FunItems/DeepEditItem.axaml.cs

File renamed without changes.

0 commit comments

Comments
 (0)