Skip to content

Commit 8728f27

Browse files
committed
添加项备注功能
1 parent b42dca6 commit 8728f27

8 files changed

Lines changed: 50 additions & 4 deletions

File tree

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ public string Name
3939
Item.NameBox.Content = value;
4040
}
4141
}
42+
public string Note
43+
{
44+
get
45+
{
46+
return Item.Note;
47+
}
48+
set
49+
{
50+
Item.Note = value;
51+
}
52+
}
4253
public UnitItem Item { get; set; } = new UnitItem();
4354
public string UUID { get; set; }
4455
public int Type { get; set; } = 0;
@@ -57,6 +68,7 @@ public static void AddItem(RootConfig config)
5768
config.Item.IsMain = config.IsMain;
5869
config.Item.ValueBox.Text = config.Value;
5970
config.Item.ClassicValue = config.ClassicValue;
71+
config.Item.Note = config.Note;
6072
ItemListBox.Items.Add(config.Item);
6173
}
6274
else

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class ItemListClass
2424
public string Name { get; set; }
2525
public string Value { get; set; }
2626
public string ClassicValue { get; set; }
27+
public string Note { get; set; } = "无备注";
2728
public bool IsMain { get; set; } = false;
2829
}
2930
public class SaveProject
@@ -45,7 +46,8 @@ public static Root GetNowRoot()
4546
Name = item.Name,
4647
Value = item.Value.Replace("\n","").Replace("\r",""),
4748
ClassicValue = item.ClassicValue.Replace("\n","\\n").Replace("\r","\\r"),
48-
IsMain = item.IsMain
49+
IsMain = item.IsMain,
50+
Note = item.Note
4951
});
5052
}
5153
return root;
@@ -72,7 +74,8 @@ public static void OpenProjectCore(Root root)
7274
Name = item.Name,
7375
Value = item.Value,
7476
ClassicValue = item.ClassicValue,
75-
IsMain = item.IsMain
77+
IsMain = item.IsMain,
78+
Note = item.Note
7679
});
7780
}
7881
}
@@ -90,6 +93,7 @@ public static void NewProjectCore()
9093
Name = "Main",
9194
ClassicValue = "1+1",
9295
IsMain = true,
96+
Note = "程序计算主入口"
9397
});
9498

9599
Core.ProjectPath = String.Empty;

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@
1515
<Label Width="90">名称:</Label>
1616
<TextBox Name="NameBox">NewItem</TextBox>
1717
</DockPanel>
18+
<DockPanel Margin="5">
19+
<Label Width="90">备注:</Label>
20+
<TextBox Name="NoteBox">无备注</TextBox>
21+
</DockPanel>
1822
<DockPanel Margin="5">
1923
<Label Width="90">值:</Label>
20-
<TextBox Name="ValueBox"></TextBox>
24+
<TextBox Name="ValueBox">0</TextBox>
2125
</DockPanel>
2226
</StackPanel>
2327
</Grid>

Round.NET.AvaloniaApp.EncodeCalculator/Views/Controls/Items/EditItem/EditItem.axaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
<Label Width="90">项名称:</Label>
1111
<TextBox Name="NameBox" TextChanging="NameBox_OnTextChanging">Name</TextBox>
1212
</DockPanel>
13+
<DockPanel Margin="5">
14+
<Label Width="90">项备注:</Label>
15+
<TextBox Name="NoteBox" TextChanging="NoteBox_OnTextChanging">无备注</TextBox>
16+
</DockPanel>
1317
<DockPanel Margin="5">
1418
<Label Width="90">项值:</Label>
1519
<TextBox Name="ValueBox" TextChanging="ValueBox_OnTextChanging">Value</TextBox>

Round.NET.AvaloniaApp.EncodeCalculator/Views/Controls/Items/EditItem/EditItem.axaml.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public EditItem(string uuid)
2828
this.UUID = uuid;
2929
NameBox.Text = this.UnitItem.Name;
3030
ValueBox.Text = this.UnitItem.Value;
31+
NoteBox.Text = this.UnitItem.Note;
3132
Chang = true;
3233
}
3334

@@ -76,4 +77,9 @@ private void DeepEditButton_OnClick(object? sender, RoutedEventArgs e)
7677
};
7778
ContentDialog.ShowAsync(Core.MainWindow);
7879
}
80+
81+
private void NoteBox_OnTextChanging(object? sender, TextChangingEventArgs e)
82+
{
83+
84+
}
7985
}

Round.NET.AvaloniaApp.EncodeCalculator/Views/Controls/Items/ItemsView.axaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ private void AddNewItemButton_OnClick(object? sender, RoutedEventArgs e)
4444
{
4545
Value = AddItems.ValueBox.Text,
4646
Name = AddItems.NameBox.Text,
47+
Note = AddItems.NoteBox.Text,
4748
ClassicValue = AddItems.ValueBox.Text
4849
});
4950

Round.NET.AvaloniaApp.EncodeCalculator/Views/Controls/Items/UnitItem.axaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
mc:Ignorable="d"
66
x:Class="Round.NET.AvaloniaApp.EncodeCalculator.Views.Controls.UnitItem"
77
Width="300"
8-
Height="90">
8+
Height="100">
99
<Grid>
10+
<Label Name="NoteBox" HorizontalAlignment="Left" Margin="5,30" Foreground="Gray" FontStyle="Oblique">Note</Label>
1011
<Label Name="NameBox" Margin="5" FontSize="20">Name</Label>
1112
<TextBox Name="ValueBox" TextChanging="ValueBox_OnTextChanging" IsReadOnly="False" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Margin="10,0,55,10" Height="32" VerticalContentAlignment="Center"></TextBox>
1213
<Button Name="MoreButton" Click="MoreButton_OnClick" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10" Width="35" Height="32" FontSize="17">...</Button>

Round.NET.AvaloniaApp.EncodeCalculator/Views/Controls/Items/UnitItem.axaml.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public partial class UnitItem : UserControl
1515
{
1616
public string uuid { get; set; }
1717
public string _value;
18+
public string _note = "无备注";
1819

1920
public string Name
2021
{
@@ -27,6 +28,18 @@ public string Name
2728
NameBox.Content = value;
2829
}
2930
}
31+
public string Note
32+
{
33+
get
34+
{
35+
return _note;
36+
}
37+
set
38+
{
39+
_note = value;
40+
NoteBox.Content = value;
41+
}
42+
}
3043
public string Value
3144
{
3245
get
@@ -65,6 +78,7 @@ private void MoreButton_OnClick(object? sender, RoutedEventArgs e)
6578
{
6679
ValueBox.Text = Edit.ValueBox.Text;
6780
NameBox.Content = Edit.NameBox.Text;
81+
Note = Edit.NoteBox.Text;
6882

6983
Core.SetNowModifyTheStatus(true);
7084
};

0 commit comments

Comments
 (0)