返回提交历史
Renamed
SpaceEngineersBlueprintEditor/Implements/Services/ItemsViewDisplayService.cs
+5
-9
Added
SpaceEngineersBlueprintEditor/Implements/Services/ListViewDisplayService.cs
+26
-0
Modified
SpaceEngineersBlueprintEditor/Implements/Services/LoadingService.cs
+47
-16
Added
SpaceEngineersBlueprintEditor/Interface/Services/ICollectionDisplayService.cs
+18
-0
Renamed
SpaceEngineersBlueprintEditor/Interface/Services/IItemsViewDisplayService.cs
+4
-14
Added
SpaceEngineersBlueprintEditor/Interface/Services/IListViewDisplayService.cs
+19
-0
Modified
SpaceEngineersBlueprintEditor/Model/BlueprintPropertyViewData.cs
+176
-30
Modified
SpaceEngineersBlueprintEditor/SpaceEngineersBlueprintEditor.csproj
+18
-0
Modified
SpaceEngineersBlueprintEditor/Styles/Controls.xaml
+0
-1
Modified
SpaceEngineersBlueprintEditor/Utilities/Helpers/SpaceEngineersHelper.cs
+12
-5
Modified
SpaceEngineersBlueprintEditor/Utilities/Selector/ShipBlueprintItemTemplateSelector.cs
+3
-28
Modified
SpaceEngineersBlueprintEditor/ViewModels/BlueprintDetailPageViewModel.cs
+2
-1
Modified
SpaceEngineersBlueprintEditor/ViewModels/BlueprintEditSubPageViewModel.cs
+85
-9
Modified
SpaceEngineersBlueprintEditor/ViewModels/BlueprintsViewPageViewModel.cs
+6
-1
Modified
SpaceEngineersBlueprintEditor/ViewModels/GameDefinitionsViewPageViewModel.cs
+5
-5
Modified
SpaceEngineersBlueprintEditor/Views/AppShellPage.xaml
+0
-11
Modified
SpaceEngineersBlueprintEditor/Views/BlueprintEditSubPage.xaml
+31
-95
Modified
SpaceEngineersBlueprintEditor/Views/BlueprintEditSubPage.xaml.cs
+3
-20
Modified
SpaceEngineersBlueprintEditor/Views/GameDefinitionsViewPage.xaml
+1
-1
Modified
SpaceEngineersBlueprintEditor/Views/GameDefinitionsViewPage.xaml.cs
+1
-1
SpaceEngineersModDev/SpaceEngineersBlueprintEditorInWinUI
完善部分编组查看功能
ce2ea4e
代码差异
20 个文件
+462
-247
@@ -1,13 +1,12 @@
1
1
using SpaceEngineersBlueprintEditor.Interface.Services;
2
using SpaceEngineersBlueprintEditor.Model;
3
2
using System.Collections.ObjectModel;
4
3
using System.Diagnostics.CodeAnalysis;
5
4
using Windows.Foundation;
6
5
7
6
namespace SpaceEngineersBlueprintEditor.Implements.Services;
8
7
9
/// <inheritdoc cref="IDefinitionPropertiesDisplayService{T}"/>
10
internal class DefinitionPropertiesDisplayService<T> : IDefinitionPropertiesDisplayService<T> where T : DefinitionViewData
8
/// <inheritdoc cref="IItemsViewDisplayService{T}"/>
9
internal class ItemsViewDisplayService<T> : IItemsViewDisplayService<T> where T : class
11
10
{
12
11
private ItemsView? _itemsView;
13
12
private Page? _page;
@@ -22,12 +21,9 @@ internal class DefinitionPropertiesDisplayService<T> : IDefinitionPropertiesDisp
22
21
_itemsView.SelectionChanged += (sender, args) => SelectionChanged?.Invoke(sender, args);
23
22
}
24
23
25
public void Select(T item)
24
public void Select(T? item)
26
25
{
27
if (_itemsView is not null && _page is not null && _itemsView.ItemsSource is ObservableCollection<T> itemSource)
28
if (_page.IsLoaded)
29
{
30
_itemsView.Select(itemSource.IndexOf(item));
31
}
26
if (_itemsView is not null && _page is not null && _itemsView.ItemsSource is ObservableCollection<T> itemSource && _page.IsLoaded)
27
_itemsView.Select(item is not null ? itemSource.IndexOf(item) : 0);
32
28
}
33
29
}
@@ -0,0 +1,26 @@
1
using SpaceEngineersBlueprintEditor.Interface.Services;
2
using System.Diagnostics.CodeAnalysis;
3
4
namespace SpaceEngineersBlueprintEditor.Implements.Services;
5
6
internal class ListViewDisplayService<T> : IListViewDisplayService<T> where T : class
7
{
8
private ListView? _listView;
9
private Page? _page;
10
public bool IsPageLoaded => _page is not null && _page.IsLoaded;
11
public event SelectionChangedEventHandler? SelectionChanged;
12
13
[MemberNotNull(nameof(_page), nameof(_listView))]
14
public void Initialize(Page page, ListView listView)
15
{
16
_page = page;
17
_listView = listView;
18
_listView.SelectionChanged += (sender, e) => SelectionChanged?.Invoke(sender, e);
19
}
20
21
public void Select(T? item)
22
{
23
if (_listView is not null && _page is not null && _page.IsLoaded)
24
_listView.SelectedItem = item;
25
}
26
}
@@ -32,32 +32,63 @@ internal class LoadingService : GlobalServiceBase, ILoadingService
32
32
33
33
public bool StartLoading<T>(string showText = "Loading...") where T : Page
34
34
{
35
if (pageGridDictionary.TryGetValue(typeof(T), out var grid) && grid.FindName("loadingTextBlock") is TextBlock textBlock)
35
try
36
36
{
37
_dispatcherQueue?.TryEnqueue(() => textBlock.Text = showText);
38
return true;
39
}
40
else
41
{
42
_dispatcherQueue?.TryEnqueue(() =>
37
if (pageGridDictionary.TryGetValue(typeof(T), out var grid) && grid.FindName("loadingTextBlock") is TextBlock textBlock)
38
{
39
textBlock.Text = showText;
40
return true;
41
}
42
else
43
43
{
44
44
var newGrid = CreateLoadingGrid(showText);
45
pageGridDictionary.Add(typeof(T), newGrid);
46
45
_loadingGrid?.Children.Add(newGrid);
47
});
48
return false;
46
pageGridDictionary.Add(typeof(T), newGrid);
47
return false;
48
}
49
}
50
catch
51
{
52
if (pageGridDictionary.TryGetValue(typeof(T), out var grid) && grid.FindName("loadingTextBlock") is TextBlock textBlock)
53
{
54
_dispatcherQueue?.TryEnqueue(() => textBlock.Text = showText);
55
return true;
56
}
57
else
58
{
59
_dispatcherQueue?.TryEnqueue(() =>
60
{
61
var newGrid = CreateLoadingGrid(showText);
62
_loadingGrid?.Children.Add(newGrid);
63
pageGridDictionary.Add(typeof(T), newGrid);
64
});
65
return false;
66
}
49
67
}
50
68
}
51
69
52
70
public bool StopLoading<T>() where T : Page
53
71
{
54
if (pageGridDictionary.TryGetValue(typeof(T), out var grid) && _loadingGrid is not null)
55
return _dispatcherQueue?.TryEnqueue(() =>
72
try
73
{
74
if (pageGridDictionary.TryGetValue(typeof(T), out var grid) && _loadingGrid is not null)
56
75
{
57
_loadingGrid.Children.Remove(grid);
58
pageGridDictionary.Remove(typeof(T));
59
}) ?? false;
60
return false;
76
return _loadingGrid.Children.Remove(grid) && pageGridDictionary.Remove(typeof(T));
77
}
78
return false;
79
}
80
catch
81
{
82
if (pageGridDictionary.TryGetValue(typeof(T), out var grid) && _loadingGrid is not null)
83
{
84
return _dispatcherQueue?.TryEnqueue(() =>
85
{
86
_loadingGrid.Children.Remove(grid);
87
pageGridDictionary.Remove(typeof(T));
88
}) ?? false;
89
}
90
return false;
91
}
61
92
}
62
93
63
94
private static Grid CreateLoadingGrid(string loadingText)
@@ -0,0 +1,18 @@
1
namespace SpaceEngineersBlueprintEditor.Interface.Services;
2
3
/// <summary>
4
/// 集合显示服务
5
/// </summary>
6
/// <typeparam name="T">项泛型</typeparam>
7
public interface ICollectionDisplayService<T> where T : class
8
{
9
/// <summary>
10
/// 页面是否已经加载
11
/// </summary>
12
bool IsPageLoaded { get; }
13
/// <summary>
14
/// 选择指定的项
15
/// </summary>
16
/// <param name="item">指定的项</param>
17
void Select(T? item);
18
}
@@ -1,18 +1,13 @@
1
using SpaceEngineersBlueprintEditor.Model;
2
using Windows.Foundation;
1
using Windows.Foundation;
3
2
4
3
namespace SpaceEngineersBlueprintEditor.Interface.Services;
5
4
6
5
/// <summary>
7
/// 定义属性显示服务
6
/// ItemsView显示服务
8
7
/// </summary>
9
/// <typeparam name="T"></typeparam>
10
public interface IDefinitionPropertiesDisplayService<T> where T : DefinitionViewData
8
/// <typeparam name="T">项泛型</typeparam>
9
public interface IItemsViewDisplayService<T> : ICollectionDisplayService<T> where T : class
11
10
{
12
/// <summary>
13
/// 页面是否已经加载
14
/// </summary>
15
bool IsPageLoaded { get; }
16
11
/// <summary>
17
12
/// 选择的定义改变时触发
18
13
/// </summary>
@@ -23,9 +18,4 @@ public interface IDefinitionPropertiesDisplayService<T> where T : DefinitionView
23
18
/// <param name="page">显示页面</param>
24
19
/// <param name="itemsView">显示源</param>
25
20
void Initialize(Page page, ItemsView itemsView);
26
/// <summary>
27
/// 选择指定的项
28
/// </summary>
29
/// <param name="item">指定的项</param>
30
void Select(T item);
31
21
}
@@ -0,0 +1,19 @@
1
namespace SpaceEngineersBlueprintEditor.Interface.Services;
2
3
/// <summary>
4
/// ListView显示服务
5
/// </summary>
6
/// <typeparam name="T">项泛型</typeparam>
7
public interface IListViewDisplayService<T> : ICollectionDisplayService<T> where T : class
8
{
9
/// <summary>
10
/// 选择项改变事件
11
/// </summary>
12
event SelectionChangedEventHandler SelectionChanged;
13
/// <summary>
14
/// 初始化ListView显示服务
15
/// </summary>
16
/// <param name="page">页面</param>
17
/// <param name="listView">ListView控件</param>
18
void Initialize(Page page, ListView listView);
19
}
@@ -1,8 +1,9 @@
1
using CommunityToolkit.Mvvm.ComponentModel;
2
using Microsoft.UI.Xaml.Media;
3
using SpaceEngineersBlueprintEditor.ViewModels;
1
using Microsoft.UI.Xaml.Media;
2
using SpaceEngineersBlueprintEditor.Interface.Services;
3
using SpaceEngineersBlueprintEditor.Utilities;
4
4
using System.Collections;
5
5
using System.Reflection;
6
using VRage.Game;
6
7
using XFEExtension.NetCore.XFETransform;
7
8
8
9
namespace SpaceEngineersBlueprintEditor.Model;
@@ -10,23 +11,20 @@ namespace SpaceEngineersBlueprintEditor.Model;
10
11
/// <summary>
11
12
/// 蓝图属性视图数据
12
13
/// </summary>
13
public partial class BlueprintPropertyViewData : ViewModelBase
14
public partial class BlueprintPropertyViewData
14
15
{
15
16
/// <summary>
16
17
/// 属性值
17
18
/// </summary>
18
[ObservableProperty]
19
private object? value;
19
public object? Value { get; set; }
20
20
/// <summary>
21
21
/// 属性值的字符串形式
22
22
/// </summary>
23
[ObservableProperty]
24
private string? valueInString;
23
public string? ValueString => Value?.ToString();
25
24
/// <summary>
26
25
/// 自定义数据
27
26
/// </summary>
28
[ObservableProperty]
29
private object? customData;
27
public object? CustomData { get; set; }
30
28
/// <summary>
31
29
/// 属性类型
32
30
/// </summary>
@@ -35,6 +33,7 @@ public partial class BlueprintPropertyViewData : ViewModelBase
35
33
/// 属性名称
36
34
/// </summary>
37
35
public string? Name { get; set; }
36
public string NameTypeString => $"{Name}[{Type?.Name}]";
38
37
/// <summary>
39
38
/// 属性枚举值
40
39
/// </summary>
@@ -48,6 +47,147 @@ public partial class BlueprintPropertyViewData : ViewModelBase
48
47
/// </summary>
49
48
public ImageSource? CubeImage { get; set; }
50
49
/// <summary>
50
/// 字符串控件
51
/// </summary>
52
public TextBox StringControl
53
{
54
get
55
{
56
var textBox = new TextBox
57
{
58
Text = ValueString
59
};
60
textBox.TextChanged += (sender, e) =>
61
{
62
if (sender is TextBox currentTextBox && Type is not null)
63
SetValue(Convert.ChangeType(currentTextBox.Text, Type));
64
};
65
return textBox;
66
}
67
}
68
/// <summary>
69
/// 数字控件
70
/// </summary>
71
public NumberBox NumberControl
72
{
73
get
74
{
75
var numberBox = new NumberBox
76
{
77
SpinButtonPlacementMode = NumberBoxSpinButtonPlacementMode.Compact,
78
Value = ValueString is not null ? double.Parse(ValueString) : 0
79
};
80
numberBox.ValueChanged += (sender, args) =>
81
{
82
if (Type is not null)
83
SetValue(Convert.ChangeType(sender.Value, Type));
84
};
85
return numberBox;
86
}
87
}
88
/// <summary>
89
/// 枚举控件
90
/// </summary>
91
public ComboBox EnumControl
92
{
93
get
94
{
95
var comboBox = new ComboBox
96
{
97
ItemsSource = EnumValues,
98
SelectedItem = ValueString
99
};
100
comboBox.SelectionChanged += (sender, e) =>
101
{
102
if (e.AddedItems.FirstOrDefault() is string value && Type is not null)
103
SetValue(Enum.Parse(Type, value));
104
};
105
return comboBox;
106
}
107
}
108
/// <summary>
109
/// 复合枚举控件
110
/// </summary>
111
public SplitButton MultiEnumControl
112
{
113
get
114
{
115
var stackPanel = new StackPanel();
116
foreach (var enumItem in EnumValues)
117
{
118
stackPanel.Children.Add(new CheckBox
119
{
120
Content = enumItem,
121
IsChecked = ValueString?.Contains(enumItem)
122
});
123
}
124
var splitButton = new SplitButton
125
{
126
Content = ValueString,
127
Flyout = new Flyout
128
{
129
Content = stackPanel
130
}
131
};
132
splitButton.Flyout.Closed += (sender, e) =>
133
{
134
if (sender is Flyout flyout && Type is not null)
135
{
136
var targetValue = string.Join(", ", stackPanel.Children.Where(child => child is CheckBox checkBox && checkBox.IsChecked is not null && checkBox.IsChecked.Value).Cast<CheckBox>().Select(checkBox => checkBox.Content.ToString()));
137
SetValue(Enum.Parse(Type, targetValue));
138
splitButton.Content = targetValue;
139
}
140
};
141
return splitButton;
142
}
143
}
144
/// <summary>
145
/// 布尔值控件
146
/// </summary>
147
public ComboBox BoolControl
148
{
149
get
150
{
151
var comboBox = new ComboBox
152
{
153
ItemsSource = EnumValues,
154
SelectedItem = Value?.ToString()
155
};
156
comboBox.SelectionChanged += (sender, e) =>
157
{
158
if (e.AddedItems.FirstOrDefault() is string value && Type is not null)
159
SetValue(Convert.ChangeType(value, Type));
160
};
161
return comboBox;
162
}
163
}
164
/// <summary>
165
/// 自动选择最合适的控件
166
/// </summary>
167
public object? BestControl
168
{
169
get
170
{
171
if (IsBasicType)
172
{
173
if (IsMultiEnum)
174
return MultiEnumControl;
175
else if (Type is not null && Type.IsEnum)
176
return EnumControl;
177
else if (Type == typeof(int) || Type == typeof(double) || Type == typeof(float) || Type == typeof(short) || Type == typeof(byte) || Type == typeof(uint) || Type == typeof(ushort))
178
return NumberControl;
179
else if (Type == typeof(bool))
180
return BoolControl;
181
else
182
return StringControl;
183
}
184
else
185
{
186
return null;
187
}
188
}
189
}
190
/// <summary>
51
191
/// 属性的子属性
52
192
/// </summary>
53
193
public List<BlueprintPropertyViewData> Children { get; set; } = [];
@@ -64,37 +204,43 @@ public partial class BlueprintPropertyViewData : ViewModelBase
64
204
/// </summary>
65
205
public bool IsBasicType => Type is not null && (XFEConverter.IsBasicType(Type) || Type.IsEnum);
66
206
67
partial void OnValueChanged(object? value)
207
/// <summary>
208
/// 设置值
209
/// </summary>
210
/// <param name="targetValue">目标值</param>
211
public void SetValue(object? targetValue)
68
212
{
69
213
try
70
214
{
71
ValueInString = Value?.ToString();
72
if (Type is null || value is null)
73
return;
74
if (Type.IsEnum && ValueInString is not null)
75
SetValue(this, Enum.Parse(Type, ValueInString));
76
else
77
SetValue(this, Convert.ChangeType(value, Type));
78
}
79
catch { }
80
}
81
82
private static void SetValue(BlueprintPropertyViewData blueprintPropertyViewData, object? targetValue)
83
{
84
if (blueprintPropertyViewData.Parent is not null && blueprintPropertyViewData.Name is not null && blueprintPropertyViewData.Parent.Type is not null)
85
{
86
var memberInfoList = blueprintPropertyViewData.Parent.Type.GetMember(blueprintPropertyViewData.Name);
87
foreach (var memberInfo in memberInfoList)
215
if (Parent is BlueprintPropertyViewData parentBlueprintPropertyViewData && Name is not null && parentBlueprintPropertyViewData.Type is not null)
88
216
{
217
var memberInfo = parentBlueprintPropertyViewData.Type.GetMember(Name).Where(memberInfo => memberInfo is FieldInfo || memberInfo is PropertyInfo).FirstOrDefault();
89
218
if (memberInfo is FieldInfo fieldInfo)
90
219
{
91
fieldInfo.SetValue(blueprintPropertyViewData.Parent.Value, targetValue);
220
fieldInfo.SetValue(Parent.Value, targetValue);
92
221
}
93
222
else if (memberInfo is PropertyInfo propertyInfo)
94
223
{
95
propertyInfo.SetValue(blueprintPropertyViewData.Parent.Value, targetValue);
224
propertyInfo.SetValue(Parent.Value, targetValue);
96
225
}
226
Value = targetValue;
227
if (parentBlueprintPropertyViewData.Type.IsValueType)
228
SetValueType(parentBlueprintPropertyViewData);
97
229
}
98
230
}
231
catch (Exception ex)
232
{
233
GlobalServiceManager.GetService<IMessageService>()?.ShowMessage($"无法设置属性{Name}({Type?.Name})的值为{targetValue}:{ex.Message}", "错误", InfoBarSeverity.Error);
234
}
235
}
236
237
private static void SetValueType(BlueprintPropertyViewData blueprintPropertyViewData)
238
{
239
if (blueprintPropertyViewData.Parent is BlueprintPropertyViewData parentBlueprintViewData)
240
{
241
if (blueprintPropertyViewData.Type is not null && blueprintPropertyViewData.Type.IsValueType)
242
blueprintPropertyViewData.SetValue(blueprintPropertyViewData.Value);
243
SetValueType(parentBlueprintViewData);
244
}
99
245
}
100
246
}
@@ -17,6 +17,24 @@
17
17
<ApplicationIcon>Assets\Icons\EditorIcon.ico</ApplicationIcon>
18
18
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
19
19
</PropertyGroup>
20
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
21
<NoWarn>MSB3270</NoWarn>
22
</PropertyGroup>
23
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
24
<NoWarn>MSB3270</NoWarn>
25
</PropertyGroup>
26
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
27
<NoWarn>MSB3270</NoWarn>
28
</PropertyGroup>
29
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
30
<NoWarn>MSB3270</NoWarn>
31
</PropertyGroup>
32
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
33
<NoWarn>MSB3270</NoWarn>
34
</PropertyGroup>
35
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
36
<NoWarn>MSB3270</NoWarn>
37
</PropertyGroup>
20
38
<ItemGroup>
21
39
<Content Include="Styles\Controls.xaml">
22
40
<Generator>MSBuild:Compile</Generator>
@@ -14,7 +14,6 @@
14
14
</Grid>
15
15
</ItemContainer>
16
16
</DataTemplate>
17
18
17
<DataTemplate x:Key="BlueprintDataTemplate">
19
18
<TreeViewItem ItemsSource="{Binding Children}">
20
19
<Grid Padding="0,0,5,0">
@@ -222,12 +222,19 @@ public static class SpaceEngineersHelper
222
222
}
223
223
blueprintPropertyViewData.CustomData = stackPanel;
224
224
}
225
else if (value is not null && value.GetType().IsAssignableTo(typeof(IEnumerable)))
225
else if (blueprintPropertyViewData.Type is not null && blueprintPropertyViewData.Type.IsAssignableTo(typeof(IEnumerable)))
226
226
{
227
var count = 0;
228
foreach (var item in (IEnumerable)value)
229
count++;
230
blueprintPropertyViewData.CustomData = $"数量:{count}";
227
if (value is null)
228
{
229
blueprintPropertyViewData.CustomData = "空列表";
230
}
231
else
232
{
233
var count = 0;
234
foreach (var item in (IEnumerable)value)
235
count++;
236
blueprintPropertyViewData.CustomData = $"数量:{count}";
237
}
231
238
}
232
239
else
233
240
{
@@ -29,25 +29,9 @@ public partial class ShipBlueprintItemTemplateSelector : DataTemplateSelector
29
29
/// </summary>
30
30
public DataTemplate? EnumerableTemplate { get; set; }
31
31
/// <summary>
32
/// 字符串模板项
32
/// 值类型模板项
33
33
/// </summary>
34
public DataTemplate? StringValueItemTemplate { get; set; }
35
/// <summary>
36
/// 数字模板项
37
/// </summary>
38
public DataTemplate? NumberValueItemTemplate { get; set; }
39
/// <summary>
40
/// 枚举模板项
41
/// </summary>
42
public DataTemplate? EnumValueItemTemplate { get; set; }
43
/// <summary>
44
/// 复合枚举模板项
45
/// </summary>
46
public DataTemplate? MultiEnumValueItemTemplate { get; set; }
47
/// <summary>
48
/// 布尔模板项
49
/// </summary>
50
public DataTemplate? BooleanValueItemTemplate { get; set; }
34
public DataTemplate? ValueItemTemplate { get; set; }
51
35
52
36
///<inheritdoc/>
53
37
protected override DataTemplate? SelectTemplateCore(object item)
@@ -56,16 +40,7 @@ public partial class ShipBlueprintItemTemplateSelector : DataTemplateSelector
56
40
{
57
41
if (blueprintPropertyViewData.IsBasicType)
58
42
{
59
if (blueprintPropertyViewData.IsMultiEnum)
60
return MultiEnumValueItemTemplate;
61
else if (blueprintPropertyViewData.Type is not null && blueprintPropertyViewData.Type.IsEnum)
62
return EnumValueItemTemplate;
63
else if (blueprintPropertyViewData.Type == typeof(int) || blueprintPropertyViewData.Type == typeof(double) || blueprintPropertyViewData.Type == typeof(float) || blueprintPropertyViewData.Type == typeof(short) || blueprintPropertyViewData.Type == typeof(byte) || blueprintPropertyViewData.Type == typeof(uint) || blueprintPropertyViewData.Type == typeof(ushort))
64
return NumberValueItemTemplate;
65
else if (blueprintPropertyViewData.Type == typeof(bool))
66
return BooleanValueItemTemplate;
67
else
68
return StringValueItemTemplate;
43
return ValueItemTemplate;
69
44
}
70
45
else if (blueprintPropertyViewData.IsEnumerable)
71
46
return EnumerableTemplate;
@@ -50,7 +50,6 @@ public partial class BlueprintDetailPageViewModel : ViewModelBase
50
50
if (e is null) return;
51
51
if (navigationViewService is not null) navigationViewService.Header = e.Name;
52
52
BackgroundImageService?.SetBackgroundImage(e.BlueprintImage);
53
await Helper.Wait(() => SpaceEngineersHelper.IsLoadComplete);
54
53
AuthorName = "蓝图作者:加载中...";
55
54
BlueprintFileSize = "蓝图大小:加载中...";
56
55
BlueprintPath = "蓝图路径:加载中...";
@@ -66,6 +65,7 @@ public partial class BlueprintDetailPageViewModel : ViewModelBase
66
65
IsLoadingInProgress = true;
67
66
loadingService?.StartLoading<BlueprintDetailPage>("Loading blueprint...");
68
67
currentBlueprintInfoViewData = e;
68
await Helper.Wait(() => SpaceEngineersHelper.IsLoadComplete);
69
69
currentDefinitions = await SpaceEngineersHelper.LoadBlueprintAsync(currentBlueprintInfoViewData.FilePath);
70
70
if (currentDefinitions is not null && currentDefinitions.ShipBlueprints is not null && currentDefinitions.ShipBlueprints.Length > 0)
71
71
currentBlueprint = currentDefinitions.ShipBlueprints[0];
@@ -80,6 +80,7 @@ public partial class BlueprintDetailPageViewModel : ViewModelBase
80
80
messageService?.ShowMessage("该蓝图不包含蓝图文件(bp.sbc)", "警告", InfoBarSeverity.Warning);
81
81
BlueprintFileSize = $"蓝图大小:{currentBlueprintInfoViewData!.FileSize}";
82
82
BlueprintPath = $"蓝图路径:{currentBlueprintInfoViewData!.FilePath}";
83
loadingService?.StopLoading<BlueprintDetailPage>();
83
84
return;
84
85
}
85
86
if (currentBlueprint is not null)