diff --git a/BPASmartClient.SCADAControl/DLL/BPASmartClient.Compiler.dll b/BPASmartClient.SCADAControl/DLL/BPASmartClient.Compiler.dll index 259a8da6..3331c0b1 100644 Binary files a/BPASmartClient.SCADAControl/DLL/BPASmartClient.Compiler.dll and b/BPASmartClient.SCADAControl/DLL/BPASmartClient.Compiler.dll differ diff --git a/BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs b/BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs index ee726882..9bf0d497 100644 --- a/BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs +++ b/BeDesignerSCADA/Controls/CanvasPanelNew.xaml.cs @@ -1,5 +1,6 @@ using BeDesignerSCADA.Common; using BeDesignerSCADA.View; +using Newtonsoft.Json; using BeDesignerSCADA.ViewModel; using BPASmart.Model; using BPASmartClient.Compiler; @@ -269,7 +270,7 @@ namespace BeDesignerSCADA.Controls runWindows = null; } runWindows = new RunWindows(); - runWindows.LoadingData(viewModel.MenuModel); + runWindows.LoadingData(JsonConvert.DeserializeObject(JsonConvert.SerializeObject(viewModel.MenuModel))); runWindows.Show(); } /// diff --git a/BeDesignerSCADA/Controls/MenuRunCanvas.xaml b/BeDesignerSCADA/Controls/MenuRunCanvas.xaml index 70a30dcb..e63705d6 100644 --- a/BeDesignerSCADA/Controls/MenuRunCanvas.xaml +++ b/BeDesignerSCADA/Controls/MenuRunCanvas.xaml @@ -20,6 +20,7 @@ 0) { menuRunCanvasModel.MenuModel.SelectPageModels = menuRunCanvasModel.MenuModel.pageModels[0]; + menuRunCanvasModel.SelectId = menuRunCanvasModel.MenuModel.pageModels[0].Id; } SelectMenu(); @@ -166,6 +167,7 @@ namespace BeDesignerSCADA.Controls /// public void Run(List canvas) { + Config.GetInstance().Reset(); RootCanvas.Children.Clear(); foreach (FrameworkElement element in canvas) { @@ -245,6 +247,22 @@ namespace BeDesignerSCADA.Controls public class MenuRunCanvasModel : ObservableObject { + /// + /// 选中ID + /// + private string _SelectId; + public string SelectId + { + get + { + return _SelectId; + } + set + { + _SelectId = value; + OnPropertyChanged("SelectId"); + } + } /// /// 菜单Model /// @@ -279,7 +297,9 @@ namespace BeDesignerSCADA.Controls { try { + Rx(SelectId); MenuModel.SelectPageModels = obj as PageModel; + SelectId = MenuModel.SelectPageModels.Id; List Children = new List(); 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 canvas) { + Config.GetInstance().Reset(); canvas1.Children.Clear(); foreach (FrameworkElement element in canvas) {