/// <summary> /// Set relevant parameters for when a new type is selected. /// </summary> /// <param name="messageType"></param> public void OnTypeSelectionChanged(MessageTypeTreeModel messageType) { Vm_MessageStructure.DeselectAllMessageTypes(); Vm_MessageStructure.Select(messageType); // Make Fields view visible if not already if (Visibility.Visible != MessageFieldsVisibility) { MessageFieldsVisibility = Visibility.Visible; } SelectedType = messageType; }
/// <summary> /// Commit changes to message field details. /// </summary> /// <param name="destination"></param> public void OnButtonOk(BindableBase destination = null) { // Commit changes, discard extras if (destination is MessageFieldDetailsModel mfdm) { OverwriteField(mfdm); // Discard the copy Vm_MessageStructure.SetMessageFields(SelectedType.MessageFields); Vm_MessageStructure.SetButtons(true); // Reset the view CurrentView = Vm_FileText; } }
/// <summary> /// Reject changes to message field details. /// </summary> /// <param name="destination"></param> public void OnButtonCancel(BindableBase destination = null) { // Revert changes, discard the temp model if (destination is MessageFieldDetailsModel) { // Revert to the initial message fields Vm_MessageStructure.SetMessageFields(SelectedType.MessageFields); // Reset the buttons Vm_MessageStructure.SetButtons(true); // Reset the view CurrentView = Vm_FileText; } }
/// <summary> /// When selecting a Message Type, displays a copy of all the message fields in the bottom pane. /// </summary> /// <param name="destination"></param> public void OnNav(BindableBase destination = null) { // Check type is MessageFieldModel if (destination is MessageFieldModel mfm) { //MessageFieldDetailsModel messageFieldDetails = mfm.MessageFieldDetails; //MessageFieldModel messageField; //// Set the viewModel collection to a new copy //Vm_MessageFields.MessageFields = CopyFieldCollection(); //// If field is the current mfm being modified, give it priority in the ZIndex //messageField = Vm_MessageFields.MessageFields.FindField( // messageFieldDetails.WordNum, messageFieldDetails.BitStart); //messageField.ZIndex++; // And the details to the new copied details, identifiable by the word and bit MessageFieldDetailsModel fieldDetails = Vm_MessageStructure.ViewMessageField(SelectedType, mfm); Vm_FieldDetails.SetFieldDetails(fieldDetails); //// Prevent multiple selections //Vm_MessageFields.SubtractIsEnabled = false; //Vm_MessageFields.TextIsEnabled = false; //Vm_MessageFields.AddIsEnabled = false; // Finally, set the view CurrentView = Vm_FieldDetails; } // Else if not the mfm, set view to the text... //switch (destination) //{ // case "details": // CurrentView = Model.CurrentField; // break; // case "filetext": // CurrentView = Vm_FileText; // break; // default: // break; //} }