private void loadHeader() { string name = messageTypeCombo.Text; DERMSInterface.CIMData.header h = getHeader(name); endPointText.Text = h.EndPoint; replyAddressText.Text = h.ReplyAddress; ackRequiredCheck.Checked = h.AckRequired; // hardcoded! setDefaultVerb(h, h.Name); nounText.Text = h.Noun = h.Noun; userIDText.Text = h.UserID; organizationText.Text = h.UserOrganization; contextText.Text = h.Context; commentText.Text = h.Comment; majorVersionText.Text = _cim.Version.Major; minorVersionText.Text = _cim.Version.Minor; revVersionText.Text = _cim.Version.Revision; if (_cim.Version.Date < dateVersionPicker.MinDate) { dateVersionPicker.Value = System.DateTime.Now; } else { dateVersionPicker.Value = _cim.Version.Date; } }
/// <summary> /// initializes the form, loads up all its widgets with data /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DispatchDERForm_Load(object sender, System.EventArgs e) { _log = new XMLForm(); string DERGroupName = DERMSInterface.CIMData.operations.dispatchDER.ToString(); DERMSInterface.CIMData.header header = _cim.DispatchDERHeader; this.endPointText.Text = header.EndPoint; this.messageTypeText.Text = "Dispatch DER"; this.replyAddressText.Text = header.ReplyAddress; this.userIDText.Text = header.UserID; this.organizationText.Text = header.UserOrganization; this.contextText.Text = header.Context; this.verbText.Text = header.Verb; this.ackRequiredCheck.Checked = header.AckRequired; this.commentText.Text = header.Comment; // set to real by default. Why not? this.realRadio.Checked = true; DERMSInterface.CIMData.DERGroup group = this.group; DERGroupMRIDText.Text = group.Mrid; realValue = group.getWattCapacity(); reactiveValue = group.getVarCapacity(); realValueText.Text = realValue.ToString(); reactiveValueText.Text = reactiveValue.ToString(); }
// convenience function to return correct verb based on message type public void setDefaultVerb(DERMSInterface.CIMData.header h, String name) { if (name.Equals("createDER") || name.Equals("dispatchDER")) { verbText.Text = h.Verb = "create"; } else if (name.Equals("getDER") || name.Equals("getDERStatus")) { verbText.Text = h.Verb = "get"; } }
/// <summary> /// retrieves correct header based on name. If that header doesn't currently exist /// in memory, intializes it /// </summary> /// <param name="name"></param> /// <returns></returns> private DERMSInterface.CIMData.header getHeader(string name) { DERMSInterface.CIMData.header h = _cim.Headers.Find(x => x.Name.Equals(name)); // if it doesn't exist, we'll create it if (h == null) { h = new DERMSInterface.CIMData.header(); h.Name = name; _cim.Headers.Add(h); } return(h); }
/// <summary> /// initializes the form, filling in the values of all the widgets /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GetDERGroupForm_Load(object sender, System.EventArgs e) { _log = new XMLForm(); string DERGroupName = DERMSInterface.CIMData.operations.getDER.ToString(); DERMSInterface.CIMData.header header = _cim.GetDERHeader; this.endPointText.Text = header.EndPoint; this.messageTypeText.Text = "Dispatch DER"; this.replyAddressText.Text = header.ReplyAddress; this.userIDText.Text = header.UserID; this.organizationText.Text = header.UserOrganization; this.contextText.Text = header.Context; this.verbText.Text = header.Verb; this.ackRequiredCheck.Checked = header.AckRequired; this.commentText.Text = header.Comment; DERGroupMRIDText.Text = group.Mrid; }
/// <summary> /// populate screen with values /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GetDERStatusForm_Load(object sender, EventArgs e) { string DERGroupName = DERMSInterface.CIMData.operations.getDERStatus.ToString(); DERMSInterface.CIMData.header header = _cim.GetDERStatusHeader; this.endPointText.Text = header.EndPoint; this.messageTypeText.Text = "Get DER Status"; this.replyAddressText.Text = header.ReplyAddress; this.userIDText.Text = header.UserID; this.organizationText.Text = header.UserOrganization; this.contextText.Text = header.Context; this.verbText.Text = header.Verb; this.ackRequiredCheck.Checked = header.AckRequired; this.commentText.Text = header.Comment; this.realRadio.Checked = true; DERMSInterface.CIMData.DERGroup group = _group; DERGroupNameText.Text = group.GroupName; DERGroupMRIDText.Text = group.Mrid; }
/// <summary> /// retrieves correct header based on name. If that header doesn't currently exist /// in memory, intializes it /// </summary> /// <param name="name"></param> /// <returns></returns> private DERMSInterface.CIMData.header getHeader(string name) { DERMSInterface.CIMData.header h = _cim.Headers.Find(x => x.Name.Equals(name)); // if it doesn't exist, we'll create it if (h == null) { h = new DERMSInterface.CIMData.header(); h.Name = name; _cim.Headers.Add(h); } return h; }
public void setDefaultVerb(DERMSInterface.CIMData.header h) { setDefaultVerb(h, messageTypeCombo.Text); }
/// <summary> /// initializes the form, loads the on screen widgets with data /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormLoad(object sender, System.EventArgs e) { DERMSInterface.CIMData.header header = _cim.CreateDERHeader; // header info this.endPointText.Text = header.EndPoint; this.messageTypeText.Text = "Create DER"; this.replyAddressText.Text = header.ReplyAddress; this.userIDText.Text = header.UserID; this.organizationText.Text = header.UserOrganization; this.contextText.Text = header.Context; this.verbText.Text = header.Verb; this.ackRequiredCheck.Checked = header.AckRequired; this.commentText.Text = header.Comment; // group widgets DERMSInterface.CIMData.DERGroup group = _group; DERGroupNameText.Text = group.GroupName; DERGroupMRIDText.Text = group.Mrid; DERGroupRevisionText.Text = group.Revision; DERGroupSubText.Text = group.Substation; DERGroupFeederText.Text = group.Feeder; DERGroupSegmentText.Text = group.Segment; // TODO : we do not set count, reactive and total power values, they are derived int deviceCount = 0; double realPower = 0.0; double reactivePower = 0.0; // bind datasource to the currently selected DER group row bs = new BindingSource(); bs.DataSource = group.Devices; DERView.DataSource = bs; bs.ResetBindings(false); // we allow editing/adding to DER members DERView.CellValueChanged += new DataGridViewCellEventHandler(DERCellValue_Updated); DERView.CellValidating += new DataGridViewCellValidatingEventHandler(DERCell_Validating); // first time, set the read-only sum/count vars for DERGRoup based // on the DER members group.Devices.ForEach(x => { deviceCount++; realPower += x.WattCapacity; reactivePower += x.VarCapacity; }); // editing for DER members, no edit on derived DER Group fields DERView.ReadOnly = false; DERGroupDeviceCountText.Enabled = false; DERGroupRealText.Enabled = false; DERGroupReactiveText.Enabled = false; // intialize readonly vars DERGroupDeviceCountText.Text = group.Devices.Count.ToString(); DERGroupReactiveText.Text = group.getVarCapacity().ToString(); DERGroupRealText.Text = group.getWattCapacity().ToString(); // if (_editDER == true) // DERView.CellValueChanged += new DataGridViewCellEventHandler(CellValue_Changed); }