diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheListBox.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/TheListBox.xaml.cs index 23ce5e72..910091db 100644 --- a/BPASmartClient.SCADAControl/CustomerControls/TheListBox.xaml.cs +++ b/BPASmartClient.SCADAControl/CustomerControls/TheListBox.xaml.cs @@ -126,26 +126,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls } public static readonly DependencyProperty CodeProperty = DependencyProperty.Register("Code", typeof(string), typeof(TheListBox), new PropertyMetadata(_code)); - //[Category("数据绑定")] - //public bool IsRun - //{ - // get { return (bool)GetValue(RunProperty); } - // set { SetValue(RunProperty, value); } - //} - //public static readonly DependencyProperty RunProperty = - // DependencyProperty.Register("IsRun", typeof(bool), typeof(TheListBox), new PropertyMetadata(false, new PropertyChangedCallback(onIsRunChanged))); - //private static void onIsRunChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => (d as TheListBox)?.IsRunRefresh(); - public void IsRunRefresh() - { - ////测试运行 - //if (IsRun) - // IsExecuteState = true; - //else - //{ - // IsExecuteState = false; - // Dispose(); - //} - } [Category("数据绑定")] public string GenerateData { @@ -163,18 +143,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls { Dictionary keys = JsonConvert.DeserializeObject>(GenerateData); ItemsString = JsonConvert.DeserializeObject>(keys["data"].ToString()); - - - //ItemsString = JsonConvert.DeserializeObject(GenerateData); - // 运行时进行项目绑定 - - //this.ItemsSource = ListToDataTable(obj2).DefaultView; - - // 运行时进行项目绑定 - //Binding binding = new Binding(); - //binding.RelativeSource = new RelativeSource() { Mode = RelativeSourceMode.Self }; - //binding.Path = new PropertyPath("ItemsString"); - //SetBinding(ItemsSourceProperty,binding); } catch (Exception ex) { @@ -250,22 +218,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls public void XmlToFrameworkElement() { - StackPanel stackPanel = new StackPanel() { Width = 600, Height = 30, Orientation = Orientation.Horizontal }; - Button button = new Button(); - button.Name = "button1"; - Binding bindingButton = new Binding("alarmTime"); - button.SetBinding(Button.ContentProperty, bindingButton); - stackPanel.Children.Add(button); - - TextBlock textBlock = new TextBlock(); - textBlock.Name = "text1"; - Binding bindingtextBlock = new Binding("alarmMessage"); - textBlock.SetBinding(TextBlock.TextProperty, bindingtextBlock); - stackPanel.Children.Add(textBlock); - FrameworkElementToXml(stackPanel); - - - var template = (DataTemplate)XamlReader.Parse(@" @@ -283,7 +235,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls { timer.Stop(); FDataSouce = ""; - //if (IsRun) IsRun = false; GenerateDataRefresh(); } diff --git a/BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs b/BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs index efd93c37..477e712e 100644 --- a/BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs +++ b/BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs @@ -241,7 +241,6 @@ namespace BeDesignerSCADA.Controls } return frameworks; } - /// /// 保存文件 /// @@ -569,8 +568,6 @@ namespace BeDesignerSCADA.Controls } communication?.CommunicationDevices?.ToList().ForEach(x => { viewModel.DevNameList.Add(x.DeviceName); }); } - - #endregion diff --git a/BeDesignerSCADA/View/ChildEditWindow.xaml.cs b/BeDesignerSCADA/View/ChildEditWindow.xaml.cs index 989ea5f4..b66f0ef2 100644 --- a/BeDesignerSCADA/View/ChildEditWindow.xaml.cs +++ b/BeDesignerSCADA/View/ChildEditWindow.xaml.cs @@ -51,10 +51,21 @@ namespace BeDesignerSCADA.View if (Instance.IsOk) { - Canvas grid =new Canvas(); + Canvas grid = new Canvas(); + List children = new List(); + foreach (FrameworkElement item in (Instance.main.Child as MainCanvasPanel).cav.Children) + { + children.Add(item); + } + + double gd = children==null || children.Count<=0?60: children.Max((FrameworkElement x) => Canvas.GetTop(x) + x.ActualHeight); + double wd = children == null || children.Count <= 0 ? 100 : children.Max((FrameworkElement x) => Canvas.GetLeft(x) + x.ActualWidth); + grid.Width = wd; + grid.Height = gd+5; (Instance.main.Child as MainCanvasPanel).GetChildren()?.ForEach(child => { grid.Children.Add(child); }); + return FrameworkElementToXml(grid); } else