@@ -14,6 +14,7 @@ using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Forms; | |||
namespace BPASmart.ConfigurationSoftware | |||
{ | |||
@@ -190,7 +191,7 @@ namespace BPASmart.ConfigurationSoftware | |||
{ | |||
} | |||
} | |||
/// <summary> | |||
@@ -304,6 +305,10 @@ namespace BPASmart.ConfigurationSoftware | |||
MessageLog.GetInstance.Show("项目保存成功"); | |||
} | |||
/// <summary> | |||
/// 运行项目 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task RunProjectAsync() | |||
{ | |||
MessageLog.GetInstance.Show("启动中...."); | |||
@@ -322,6 +327,21 @@ namespace BPASmart.ConfigurationSoftware | |||
} | |||
/// <summary> | |||
/// 打开项目 | |||
/// </summary> | |||
public void OpenProject() | |||
{ | |||
OpenFileDialog ofd = new OpenFileDialog(); | |||
ofd.Filter = "项目|*.project;"; | |||
if (ofd.ShowDialog() == DialogResult.OK) | |||
{ | |||
Json<ProjectModel>.Read(ofd.FileName); | |||
var pages = Json<ProjectModel>.Data.Pages.OrderBy(p => p.Key).ToDictionary(p => p.Key, s => s.Value); | |||
ProjectStartInit(); | |||
} | |||
} | |||
/// <summary> | |||
/// 应用程序打包程序 | |||
/// </summary> | |||
@@ -128,7 +128,7 @@ | |||
<Button | |||
Width="60" | |||
Margin="5" | |||
Command="{Binding}" | |||
Command="{Binding OpenProjectCommand}" | |||
Content="打开" /> | |||
<Button | |||
@@ -190,7 +190,7 @@ | |||
Content="{Binding}" | |||
GroupName="All" | |||
Style="{StaticResource RadioMiniButtonStyle}"> | |||
<RadioButton.ContextMenu> | |||
<!--<RadioButton.ContextMenu> | |||
<ContextMenu ItemsSource="{Binding DataContext}"> | |||
<MenuItem | |||
Command="{Binding DataContext.RemovePageCommand, RelativeSource={RelativeSource AncestorType=Grid,AncestorLevel=5, Mode=FindAncestor}}" | |||
@@ -205,8 +205,28 @@ | |||
CommandParameter="{Binding}" | |||
Header="重命名" /> | |||
</ContextMenu> | |||
</RadioButton.ContextMenu> | |||
</RadioButton.ContextMenu>--> | |||
</RadioButton> | |||
<Grid.ContextMenu> | |||
<ContextMenu ItemsSource="{Binding DataContext}"> | |||
<MenuItem | |||
Command="{Binding DataContext.RemovePageCommand, RelativeSource={RelativeSource AncestorType=ScrollViewer, Mode=FindAncestor}}" | |||
CommandParameter="{Binding}" | |||
Header="删除页面" /> | |||
<MenuItem | |||
Command="{Binding DataContext.SetStartPageCommand, RelativeSource={RelativeSource AncestorType=ScrollViewer, Mode=FindAncestor}}" | |||
CommandParameter="{Binding}" | |||
Header="设为启动界面" /> | |||
<MenuItem | |||
Command="{Binding DataContext.ReNameCommand, RelativeSource={RelativeSource AncestorType=ScrollViewer, Mode=FindAncestor}}" | |||
CommandParameter="{Binding}" | |||
Header="重命名" /> | |||
</ContextMenu> | |||
</Grid.ContextMenu> | |||
</Grid> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
@@ -36,6 +36,7 @@ namespace BPASmart.ConfigurationSoftware | |||
ReNameCommand = new RelayCommand<object>((o) => { ServiceCenter.GetInstance.ReNameCommand(o); }); | |||
SetStartPageCommand = new RelayCommand<object>((o) => { ServiceCenter.GetInstance.SetStartPageCommand(o); }); | |||
RunCommand = new RelayCommand(async () => { await ServiceCenter.GetInstance.RunProjectAsync(); }); | |||
OpenProjectCommand = new RelayCommand(() => { ServiceCenter.GetInstance.OpenProject(); }); | |||
ServiceCenter.GetInstance.PageChange = new Action<FrameworkElement>((f) => { MainContent = f; }); | |||
ServiceCenter.GetInstance.ProjectNameChange = new Action<string>((s) => { Head = s; }); | |||
mainCanvasPanels = ServiceCenter.GetInstance.mainCanvasPanels; | |||
@@ -56,6 +57,8 @@ namespace BPASmart.ConfigurationSoftware | |||
public RelayCommand GengrateCommand { get; set; } | |||
public RelayCommand OpenProjectCommand { get; set; } | |||
public RelayCommand<object> RemovePageCommand { get; set; } | |||
public RelayCommand<object> SetStartPageCommand { get; set; } | |||
@@ -20,6 +20,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmart.RecipeManagement\BPASmart.RecipeManagement.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" /> | |||
</ItemGroup> | |||