private void RenderDisplayData() { if (string.IsNullOrEmpty(layoutSourceField.DisplayData)) { NoDisplayDataMessage(); return; } try { var displayData = XDocument.Parse(layoutSourceField.DisplayData); var devices = from d in displayData.Descendants(LayoutStruct.Node.Device).OrderBy(element => element.GetAttributeValue("dn")) select d; if (devices.Any()) { Devices.Children.Add(DrawPanel(devices, deviceStackSettings)); } else { NoDisplayDataMessage(); } } catch (Exception e) { MainBorder.IsEnabled = false; DataNotSpecifiedNotification.Hide(); ParseErrorNotification.Initialize(e); ParseErrorNotification.Show(); } }
public void UnsetField() { OutdatedNotification.Hide(); DataNotSpecifiedNotification.Hide(); ParseErrorNotification.Hide(); MainBorder.IsEnabled = true; }
public void SetValue(string value) { Assert.ArgumentNotNull(value, nameof(value)); if (!value.Equals(string.Empty)) { DataNotSpecifiedNotification.Hide(); } if (justSetField) { justSetField = false; fieldValue = value; return; } if (fieldValue.Equals(value)) { // No change ~> return return; } fieldValue = value; MainBorder.IsEnabled = false; DataNotSpecifiedNotification.Hide(); OutdatedNotification.Show(); var modified = ValueModified; if (modified != null) { modified(); } }
public void SetField(Field sourceField) { Assert.ArgumentNotNull(sourceField, nameof(sourceField)); Resizer.FieldId = sourceField.FieldUris.First().FieldId; stkMain.Children.Clear(); fieldValue = sourceField.Value; souceFieldValue = sourceField; try { var data = XDocument.Parse(sourceField.DisplayData); DrawAccounts(data); justSetField = true; } catch (Exception e) { MainBorder.IsEnabled = false; DataNotSpecifiedNotification.Hide(); ParseErrorNotification.Initialize(e); ParseErrorNotification.Show(); } }
public void SetValue(string value) { Assert.ArgumentNotNull(value, nameof(value)); TreeView.Items.Clear(); if (!value.Equals(string.Empty)) { DataNotSpecifiedNotification.Hide(); } var changed = myvalue != value; myvalue = value; if (!string.IsNullOrEmpty(value)) { try { var tracking = XElement.Parse(value); DrawProfiles(from p in tracking.Descendants(@"profile") select p); DrawEvents(from e in tracking.Descendants(@"event") select e); } catch (Exception e) { MainBorder.IsEnabled = false; DataNotSpecifiedNotification.Hide(); ParseErrorNotification.Initialize(e); ParseErrorNotification.Show(); } } if (!changed) { return; } var modified = ValueModified; if (modified != null) { modified(); } }
private void NoDisplayDataMessage() { MainBorder.IsEnabled = false; DataNotSpecifiedNotification.Show(); }
private void DrawAccounts([NotNull] XContainer element) { Debug.ArgumentNotNull(element, nameof(element)); var accounts = element.Descendants(SecurityStruct.Node.Account); if (!accounts.Any()) { MainBorder.IsEnabled = false; DataNotSpecifiedNotification.Show(); return; } var listOfAccounts = new Grid(); listOfAccounts.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); listOfAccounts.ColumnDefinitions.Add(new ColumnDefinition()); listOfAccounts.RowDefinitions.Add(new RowDefinition()); var txtAccounts = new TextBlock { Text = Rocks.Resources.SecurityField_DrawAccounts_Accounts, Margin = new Thickness(0.0, 0.0, 6.0, 0.0), Style = Resources[@"stlHeader"] as Style }; Grid.SetRow(txtAccounts, 0); Grid.SetColumn(txtAccounts, 0); listOfAccounts.Children.Add(txtAccounts); var txtPermissions = new TextBlock { Text = Rocks.Resources.SecurityField_DrawAccounts_Permissions, Style = Resources[@"stlHeader"] as Style }; Grid.SetRow(txtPermissions, 0); Grid.SetColumn(txtPermissions, 1); listOfAccounts.Children.Add(txtPermissions); var row = 1; foreach (var account in accounts) { listOfAccounts.RowDefinitions.Add(new RowDefinition()); var accountHeader = new StackPanel { Orientation = Orientation.Horizontal }; DrawAccountHeader(account, accountHeader); Grid.SetRow(accountHeader, row); Grid.SetColumn(accountHeader, 0); listOfAccounts.Children.Add(accountHeader); var accountPermissions = new StackPanel { Margin = new Thickness(0.0, 0.0, 0.0, 12.0) }; DrawAccountPermissions(account, accountPermissions); Grid.SetRow(accountPermissions, row); Grid.SetColumn(accountPermissions, 1); listOfAccounts.Children.Add(accountPermissions); row++; } stkMain.Children.Add(listOfAccounts); }