private void TextBox_Comment_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { try { RevisionsCommentViewModel instance = (RevisionsCommentViewModel)((TextBox)sender).Tag; string newTextValue = ((TextBox)sender).Text; EventHandler_Revision_ChangeComment.thisCmd.GetData(instance, newTextValue); Cmd_RegisterEvents.thisCmd.ExEvent_Revision_ChangeComment.Raise(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace); } } }
/// <summary> /// Constructor /// </summary> /// <param name="cloud"></param> /// <param name="parent"></param> /// <param name="issued"></param> public RevisionsViewViewModel(RevisionCloud cloud, RevisionsCommentViewModel parent, bool issued) { if (cloud != null) { this.ThisInstance = this; this.Parent = parent; this.Issued = issued; this.View = ThisApplication.thisApp.doc.GetElement(cloud.OwnerViewId) as View; this.Cloud = cloud; this.ViewName = this.View.LookupParameter(Constants.ViewClusterIn).AsString() + " | " + this.View.Name; //Check if RevCloud is correctly placed on the ViewSheet ViewSheet sheet = this.View as ViewSheet; if (sheet == null) { Globals.NumberOfIncorrectRevisions++; this.Parent.Parent.HasErrors = true; this.HasErrors = true; } } }
/// <summary> /// Assign Data from Model /// </summary> /// <param name="comment"></param> /// <param name="newText"></param> public void GetData(RevisionsCommentViewModel comment, string newText) { this.Comment = comment; this.newText = newText; }