Browse Source

1

样式分支
fyf 2 years ago
parent
commit
a852f7d527
4 changed files with 35 additions and 1 deletions
  1. BIN
     
  2. +2
    -1
      BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs
  3. +1
    -0
      BeDesignerSCADA/Controls/MenuRunCanvas.xaml
  4. +32
    -0
      BeDesignerSCADA/Controls/MenuRunCanvas.xaml.cs

BIN
View File


+ 2
- 1
BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs View File

@@ -1,5 +1,6 @@
using BeDesignerSCADA.Common; using BeDesignerSCADA.Common;
using BeDesignerSCADA.View; using BeDesignerSCADA.View;
using Newtonsoft.Json;
using BeDesignerSCADA.ViewModel; using BeDesignerSCADA.ViewModel;
using BPASmart.Model; using BPASmart.Model;
using BPASmartClient.Compiler; using BPASmartClient.Compiler;
@@ -269,7 +270,7 @@ namespace BeDesignerSCADA.Controls
runWindows = null; runWindows = null;
} }
runWindows = new RunWindows(); runWindows = new RunWindows();
runWindows.LoadingData(viewModel.MenuModel);
runWindows.LoadingData(JsonConvert.DeserializeObject<MenuModel>(JsonConvert.SerializeObject(viewModel.MenuModel)));
runWindows.Show(); runWindows.Show();
} }
/// <summary> /// <summary>


+ 1
- 0
BeDesignerSCADA/Controls/MenuRunCanvas.xaml View File

@@ -20,6 +20,7 @@


<Grid> <Grid>
<Canvas <Canvas
Tag="{Binding SelectId,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
x:Name="RootCanvas" x:Name="RootCanvas"
Background="Transparent" Background="Transparent"
ClipToBounds="True" ClipToBounds="True"


+ 32
- 0
BeDesignerSCADA/Controls/MenuRunCanvas.xaml.cs View File

@@ -128,6 +128,7 @@ namespace BeDesignerSCADA.Controls
if (menuRunCanvasModel.MenuModel.pageModels.Count > 0) if (menuRunCanvasModel.MenuModel.pageModels.Count > 0)
{ {
menuRunCanvasModel.MenuModel.SelectPageModels = menuRunCanvasModel.MenuModel.pageModels[0]; menuRunCanvasModel.MenuModel.SelectPageModels = menuRunCanvasModel.MenuModel.pageModels[0];
menuRunCanvasModel.SelectId = menuRunCanvasModel.MenuModel.pageModels[0].Id;
} }


SelectMenu(); SelectMenu();
@@ -166,6 +167,7 @@ namespace BeDesignerSCADA.Controls
/// <param name="canvas"></param> /// <param name="canvas"></param>
public void Run(List<FrameworkElement> canvas) public void Run(List<FrameworkElement> canvas)
{ {
Config.GetInstance().Reset();
RootCanvas.Children.Clear(); RootCanvas.Children.Clear();
foreach (FrameworkElement element in canvas) foreach (FrameworkElement element in canvas)
{ {
@@ -245,6 +247,22 @@ namespace BeDesignerSCADA.Controls


public class MenuRunCanvasModel : ObservableObject public class MenuRunCanvasModel : ObservableObject
{ {
/// <summary>
/// 选中ID
/// </summary>
private string _SelectId;
public string SelectId
{
get
{
return _SelectId;
}
set
{
_SelectId = value;
OnPropertyChanged("SelectId");
}
}
/// <summary> /// <summary>
/// 菜单Model /// 菜单Model
/// </summary> /// </summary>
@@ -279,7 +297,9 @@ namespace BeDesignerSCADA.Controls
{ {
try try
{ {
Rx(SelectId);
MenuModel.SelectPageModels = obj as PageModel; MenuModel.SelectPageModels = obj as PageModel;
SelectId = MenuModel.SelectPageModels.Id;
List<FrameworkElement> Children = new List<FrameworkElement>(); List<FrameworkElement> Children = new List<FrameworkElement>();
if (MenuModel.SelectPageModels != null) if (MenuModel.SelectPageModels != null)
{ {
@@ -298,8 +318,20 @@ namespace BeDesignerSCADA.Controls
} }
} }


public void Rx(string id)
{
//(MenuModel?.pageModels?.ToList().Find(par => par.Id == id).visual as CanvasPanel).Children.Clear();
//foreach (FrameworkElement element in canvas1.Children)
//{
// string xamlText = XamlWriter.Save(element);
// FrameworkElement item = XamlReader.Parse(xamlText) as FrameworkElement;
// (MenuModel?.pageModels?.ToList().Find(par => par.Id == id).visual as CanvasPanel).Children.Add(item);
//}
}

public void Run(List<FrameworkElement> canvas) public void Run(List<FrameworkElement> canvas)
{ {
Config.GetInstance().Reset();
canvas1.Children.Clear(); canvas1.Children.Clear();
foreach (FrameworkElement element in canvas) foreach (FrameworkElement element in canvas)
{ {


Loading…
Cancel
Save