private void btnCreate_Click(object sender, RoutedEventArgs e) { bool valid = true; if (tbName.Text == string.Empty) { valid = false; lbNameError.Text = "Enter name"; } else { lbNameError.Text = string.Empty; } if (tbBaseNode.Text == string.Empty) { valid = false; lbNodeError.Text = "Enter node"; } else { lbNodeError.Text = string.Empty; } if (valid == true) { if (!edit) { Control = new Models.Control(); } Control.Name = tbName.Text; Control.Identifier = NodeSelector.SelectedNode; Close(); } }
public ControlListItem(Models.Control control, IStudioEnvironment studio) { InitializeComponent(); Control = control; this.studio = studio; lbControlName.Text = control.Name; Control.PropertyChanged += ControlPropertyChanged; btnRefresh.Visibility = Control.IsLoaded ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible; }
public Control(ViewModel.Manager.Session Session, ViewModel.Control Control) : base(Session) { List <ViewModel.Control> viewmodelcontrols = new List <ViewModel.Control>(); viewmodelcontrols.Add(Control); List <Models.Control> controls = this.QueueControls(Session, viewmodelcontrols); this.Value = controls.First(); }
public AddControl(Models.Control control, IControlIdentifierSelector manualSelector) { InitializeComponent(); Control = control; lbTitle.Text = "Edit Control"; btnCreate.Content = "Save"; edit = true; tbName.Text = Control.Name; NodeSelector = new SelectControlNode(control.Parent.DiscoveredControls, manualSelector); NodeSelector.SelectedNode = control.Identifier; tbBaseNode.Text = control.Identifier.Name; }
public Models.Response UpdateControl(String ID, Models.Control Control) { try { Guid viewmodelid = ViewModel.Utilities.StringToGuid(ID); ViewModel.Control control = this.Session.Control(viewmodelid); foreach (Models.Property property in Control.Properties) { if (!property.ReadOnly) { switch (property.Type) { case ViewModel.Attributes.PropertyTypes.Boolean: control.SetPropertyValue(property.Name, property.Values[0].Equals("1")); break; case ViewModel.Attributes.PropertyTypes.Int32: control.SetPropertyValue(property.Name, Convert.ToInt32(property.Values[0])); break; case ViewModel.Attributes.PropertyTypes.NullableInt32: if (property.Values[0] == null) { control.SetPropertyValue(property.Name, null); } else { control.SetPropertyValue(property.Name, Convert.ToInt32(property.Values[0])); } break; case ViewModel.Attributes.PropertyTypes.String: control.SetPropertyValue(property.Name, property.Values[0]); break; case ViewModel.Attributes.PropertyTypes.Float: control.SetPropertyValue(property.Name, Convert.ToDouble(property.Values[0])); break; case ViewModel.Attributes.PropertyTypes.Control: String id = property.Values[0]; if (id != null) { control.SetPropertyValue(property.Name, this.Session.Control(ViewModel.Utilities.StringToGuid(id))); } else { control.SetPropertyValue(property.Name, null); } break; case ViewModel.Attributes.PropertyTypes.ControlList: List <ViewModel.Control> values = new List <ViewModel.Control>(); foreach (String thisid in property.Values) { values.Add(this.Session.Control(ViewModel.Utilities.StringToGuid(thisid))); } ((ViewModel.ObservableControlList <ViewModel.Control>)control.GetPropertyValue(property.Name)).Replace(values); break; case ViewModel.Attributes.PropertyTypes.Date: if (property.Values[0] == null) { control.SetPropertyValue(property.Name, null); } else { control.SetPropertyValue(property.Name, Convert.ToDateTime(property.Values[0])); } break; case ViewModel.Attributes.PropertyTypes.Decimal: if (property.Values[0] == null) { control.SetPropertyValue(property.Name, null); } else { control.SetPropertyValue(property.Name, Convert.ToDecimal(property.Values[0])); } break; case ViewModel.Attributes.PropertyTypes.Command: if (property.Values[0] == null) { control.SetPropertyValue(property.Name, null); } else { control.SetPropertyValue(property.Name, this.Session.Command(ViewModel.Utilities.StringToGuid(property.Values[0]))); } break; default: throw new NotImplementedException("PropertyType not implemented: " + property.Type); } } } return(new Models.Responses.Empty(this.Session)); } catch (Exception e) { throw this.ProcessException(e); } }
public ControlView(Models.Control control) { InitializeComponent(); Control = control; }
private void BtnCancel_Click(object sender, RoutedEventArgs e) { Control = null; Close(); }