Browse Source

更新

master
fyf 2 years ago
parent
commit
bdba0ac21e
3 changed files with 12 additions and 53 deletions
  1. +0
    -49
      BPASmartClient.SCADAControl/CustomerControls/TheListBox.xaml.cs
  2. +0
    -3
      BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs
  3. +12
    -1
      BeDesignerSCADA/View/ChildEditWindow.xaml.cs

+ 0
- 49
BPASmartClient.SCADAControl/CustomerControls/TheListBox.xaml.cs View File

@@ -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<string, object> keys = JsonConvert.DeserializeObject<Dictionary<string, object>>(GenerateData);
ItemsString = JsonConvert.DeserializeObject<ObservableCollection<object>>(keys["data"].ToString());


//ItemsString = JsonConvert.DeserializeObject<DataSouceModel>(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(@"
<DataTemplate xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"">
@@ -283,7 +235,6 @@ namespace BPASmartClient.SCADAControl.CustomerControls
{
timer.Stop();
FDataSouce = "";
//if (IsRun) IsRun = false;
GenerateDataRefresh();
}



+ 0
- 3
BeDesignerSCADA/Controls/MainCanvasPanel.xaml.cs View File

@@ -241,7 +241,6 @@ namespace BeDesignerSCADA.Controls
}
return frameworks;
}

/// <summary>
/// 保存文件
/// </summary>
@@ -569,8 +568,6 @@ namespace BeDesignerSCADA.Controls
}
communication?.CommunicationDevices?.ToList().ForEach(x => { viewModel.DevNameList.Add(x.DeviceName); });
}


#endregion




+ 12
- 1
BeDesignerSCADA/View/ChildEditWindow.xaml.cs View File

@@ -51,10 +51,21 @@ namespace BeDesignerSCADA.View

if (Instance.IsOk)
{
Canvas grid =new Canvas();
Canvas grid = new Canvas();
List<FrameworkElement> children = new List<FrameworkElement>();
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


Loading…
Cancel
Save