Browse Source

产线项目创建修改

样式分支
pry 2 years ago
parent
commit
c1d3073cde
9 changed files with 50 additions and 7 deletions
  1. +0
    -0
      BPASmart.ConfigurationSoftware/MainWindowViewModel.cs
  2. +5
    -1
      BPASmart.ConfigurationSoftware/Servers/ServiceCenter.cs
  3. +4
    -4
      BPASmart.ConfigurationSoftware/View/MainWindow.xaml
  4. +2
    -1
      BPASmart.ConfigurationSoftware/View/NewPageView.xaml
  5. +16
    -0
      BPASmart.ConfigurationSoftware/View/NewPageView.xaml.cs
  6. +3
    -1
      BPASmart.ConfigurationSoftware/View/NewProjectView.xaml
  7. +1
    -0
      BPASmart.ConfigurationSoftware/View/NewProjectView.xaml.cs
  8. +16
    -0
      BPASmart.ConfigurationSoftware/ViewModel/NewProjectViewModel.cs
  9. +3
    -0
      BPASmart.PageLoad/MainWindow.xaml

BPASmart.ConfigurationSoftware/ViewModel/MainWindowViewModel.cs → BPASmart.ConfigurationSoftware/MainWindowViewModel.cs View File


+ 5
- 1
BPASmart.ConfigurationSoftware/Servers/ServiceCenter.cs View File

@@ -241,11 +241,14 @@ namespace BPASmart.ConfigurationSoftware
/// <param name="o"></param>
public void RemovePageCommand(object o)
{
MessageLog.GetInstance.Show($"准备删除页面:{o.ToString()}");
if (!string.IsNullOrEmpty(o?.ToString()))
{
if (Pages.FirstOrDefault(p => p == o.ToString()) != null)
{
Pages.Remove(o.ToString());
if (Json<ProjectModel>.Data.Pages.ContainsKey(o.ToString()))
Json<ProjectModel>.Data.Pages.Remove(o.ToString());
string path = $"{FileConfigModel.ConstPath}\\{FileConfigModel.PageDirName}\\{o.ToString()}.lay";
if (File.Exists(path)) File.Delete(path);
if (!File.Exists(path)) MessageLog.GetInstance.Show($"页面 {o.ToString()} 删除成功");
@@ -265,6 +268,7 @@ namespace BPASmart.ConfigurationSoftware
Serialization<BinConfigFile>.Data.StartPageName = o.ToString();
Serialization<BinConfigFile>.Save($"{FileConfigModel.GetBinConfigPath}");
}
MessageLog.GetInstance.Show($"当前启动页面:{Serialization<BinConfigFile>.Data.StartPageName}");
}

/// <summary>
@@ -275,7 +279,7 @@ namespace BPASmart.ConfigurationSoftware
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
MessageLog.GetInstance.Show($"页面 {o.ToString()}重命名");
}
}



+ 4
- 4
BPASmart.ConfigurationSoftware/View/MainWindow.xaml View File

@@ -191,17 +191,17 @@
GroupName="All"
Style="{StaticResource RadioMiniButtonStyle}">
<RadioButton.ContextMenu>
<ContextMenu>
<ContextMenu ItemsSource="{Binding DataContext}">
<MenuItem
Command="{Binding DataContext.RemovePageCommand, RelativeSource={RelativeSource AncestorType=Grid, AncestorLevel=4, Mode=FindAncestor}}"
Command="{Binding DataContext.RemovePageCommand, RelativeSource={RelativeSource AncestorType=Grid,AncestorLevel=5, Mode=FindAncestor}}"
CommandParameter="{Binding}"
Header="删除页面" />
<MenuItem
Command="{Binding DataContext.SetStartPageCommand, RelativeSource={RelativeSource AncestorType=Grid, AncestorLevel=4, Mode=FindAncestor}}"
Command="{Binding DataContext.SetStartPageCommand,RelativeSource={RelativeSource AncestorType=Grid,AncestorLevel=5,Mode=FindAncestor}}"
CommandParameter="{Binding}"
Header="设为启动界面" />
<MenuItem
Command="{Binding DataContext.ReNameCommand, RelativeSource={RelativeSource AncestorType=Grid, AncestorLevel=4, Mode=FindAncestor}}"
Command="{Binding DataContext.ReNameCommand, RelativeSource={RelativeSource AncestorType=Grid,AncestorLevel=5, Mode=FindAncestor}}"
CommandParameter="{Binding}"
Header="重命名" />
</ContextMenu>


+ 2
- 1
BPASmart.ConfigurationSoftware/View/NewPageView.xaml View File

@@ -29,7 +29,7 @@
Height="30"
VerticalAlignment="Top"
FontSize="16"
Text="{Binding NewData.ProjectName}" />
Text="" />


<TextBlock
@@ -48,6 +48,7 @@

<Button
Margin="10,2,10,2"
IsDefault="True"
Click="Button_Click_1"
Content="创建" />
<Button


+ 16
- 0
BPASmart.ConfigurationSoftware/View/NewPageView.xaml.cs View File

@@ -24,6 +24,22 @@ namespace BPASmart.ConfigurationSoftware
public NewPageView()
{
InitializeComponent();
DefaultPageName();
this.pageName.Focus();
}

private void DefaultPageName()
{
int count = 0;
while (true)
{
count++;
if (!Json<ProjectModel>.Data.Pages.ContainsKey($"Page{count}"))
{
this.pageName.Text = $"Page{count}";
break;
}
}
}

private void Button_Click(object sender, RoutedEventArgs e)


+ 3
- 1
BPASmart.ConfigurationSoftware/View/NewProjectView.xaml View File

@@ -28,6 +28,7 @@

<TextBlock VerticalAlignment="Center" Text="项目名称:" />
<TextBox
Name="projectName"
Grid.Row="1"
VerticalAlignment="Center"
FontSize="20"
@@ -67,7 +68,8 @@
<Button
Margin="10,2,10,2"
Command="{Binding CreateCommand}"
Content="创建" />
Content="创建"
IsDefault="True" />
<Button
Grid.Column="1"
Grid.ColumnSpan="2"


+ 1
- 0
BPASmart.ConfigurationSoftware/View/NewProjectView.xaml.cs View File

@@ -23,6 +23,7 @@ namespace BPASmart.ConfigurationSoftware
public NewProjectView()
{
InitializeComponent();
projectName.Focus();
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
this.DialogResult = true;


+ 16
- 0
BPASmart.ConfigurationSoftware/ViewModel/NewProjectViewModel.cs View File

@@ -18,6 +18,7 @@ namespace BPASmart.ConfigurationSoftware
{
//Json<BasicInformation>.Read();
NewData.ProjectPath = Json<LocalPar>.Data.ProjectDefaultPath;
DefaultName();
OpenBrowserDialogCommand = new RelayCommand(() =>
{
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
@@ -59,6 +60,21 @@ namespace BPASmart.ConfigurationSoftware

}

private void DefaultName()
{
var res = Directory.GetDirectories(NewData.ProjectPath);
int count = 0;
while (true)
{
count++;
if (res?.ToList()?.FirstOrDefault(p => p.Contains($"default{count}")) == null)
{
NewData.ProjectName = $"default{count}";
break;
}
}
}

public NewProjectModel NewData { get { return _mNewData; } set { _mNewData = value; OnPropertyChanged(); } }
private NewProjectModel _mNewData = new NewProjectModel();



+ 3
- 0
BPASmart.PageLoad/MainWindow.xaml View File

@@ -12,6 +12,9 @@
WindowState="Maximized"
mc:Ignorable="d">
<Grid>
<Grid.Background>
<ImageBrush ImageSource="/BeDesignerSCADA;component/Images/bj.png" />
</Grid.Background>
<ctrl:RunCanvas x:Name="runCanvas" />
</Grid>
</Window>

Loading…
Cancel
Save