private void updatePMH() { HraModelChangedEventArgs pmh_args = new RiskApps3.Model.HraModelChangedEventArgs(null); pmh_args.Persist = false; geneticTest.owningPMH.SignalModelChanged(pmh_args); }
private void updatePMH(bool persist) { HraModelChangedEventArgs pmh_args = new RiskApps3.Model.HraModelChangedEventArgs(geneticTestingView); pmh_args.Persist = persist; geneticTest.owningPMH.SignalModelChanged(pmh_args); }
private void ageDiagnosis_Validated(object sender, EventArgs e) { foreach (ClincalObservation co in PMHHx.Observations) { if (co.disease.Equals("Bilateral Oophorectomy")) { if ((String.IsNullOrEmpty(ageDiagnosis.Text)) || (bothOvariesRemoved.Text != "Yes")) { PMHHx.Observations.RemoveFromList(co, SessionManager.Instance.securityContext); } else { co.ageDiagnosis = ageDiagnosis.Text; HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); args.Persist = true; args.updatedMembers.Add(co.GetMemberByName("ageDiagnosis")); co.SignalModelChanged(args); } return; } } // add the disease... if (bothOvariesRemoved.Text.Equals("Yes")) { ClincalObservation co2 = new ClincalObservation(PMHHx); co2.disease = "Bilateral Oophorectomy"; co2.SetDiseaseDetails(); //SessionManager.Instance.MetaData.Diseases.SetDataFromDiseaseName(ref co2); co2.ageDiagnosis = ageDiagnosis.Text; HraModelChangedEventArgs args2 = new HraModelChangedEventArgs(null); args2.Persist = true; PMHHx.Observations.AddToList(co2, args2); } }
/**************************************************************************************************/ private void activePatientChanged(object sender, HraModelChangedEventArgs e) { if (e.sendingView != this) { FillControls(); } }
private void button2_Click(object sender, EventArgs e) { Task t = new Task(proband, "Task", "Pending", SessionManager.Instance.ActiveUser.ToString(), DateTime.Now); HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); args.Persist = true; proband.Tasks.AddToList(t, args); }
private void cA125ToolStripMenuItem_Click(object sender, EventArgs e) { LabResult lr = new LabResult(); lr.unitnum = proband.unitnum; lr.date = DateTime.Today; lr.TestDesc = "CA125"; HraModelChangedEventArgs args = new HraModelChangedEventArgs(this); proband.labsHx.AddToList(lr, args); }
private void button1_Click(object sender, EventArgs e) { HraModelChangedEventArgs args = new HraModelChangedEventArgs(parentView); args.Delete = true; test.SignalModelChanged(args); if (DeleteClicked != null) DeleteClicked(this, e); }
private void allelicStateComboBox_SelectionChangeCommitted(object sender, EventArgs e) { HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); geneticTestResult.allelicState = allelicStateComboBox.SelectedItem.ToString(); args.updatedMembers.Add(geneticTestResult.GetMemberByName("allelicState")); geneticTestResult.SignalModelChanged(args); SignalOwningTestCompleted(); }
private void FHItemChanged(object sender, HraModelChangedEventArgs e) { if (e.sendingView != this) { foreach (MemberInfo mi in e.updatedMembers) { if (HraObject.DoesAffectTestingDecision(mi)) { reCreateListOfRelativesToConsider(); break; } } } }
public void RemoveFromList(HraObject hraObject, SecurityContext p_securityContext) { HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); args.Delete = true; hraObject.SignalModelChanged(args); hraObject.ReleaseListeners(this); if (Remove(hraObject)) { if (ListChanged != null) { ListChanged(new HraListChangedEventArgs(HraListChangedEventArgs.HraListChangeType.DELETE, hraObject)); } } }
private bool MemberListContainsName(HraModelChangedEventArgs hraE, string p) { bool retval = false; foreach (MemberInfo member in hraE.updatedMembers) { //TODO should this be handle specially when international flag is set? if (string.Compare(member.Name, p, true) == 0) { retval = true; break; } } return(retval); }
public bool RemoveFromList(T hraObject, SecurityContext p_securityContext) { bool removed = false; HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); args.Delete = true; hraObject.SignalModelChanged(args); hraObject.ReleaseListeners(this); if (this.Remove(hraObject)) { removed = true; if (ListChanged != null) { ListChanged(new HraListChangedEventArgs(HraListChangedEventArgs.HraListChangeType.DELETE, hraObject)); } } return(removed); }
private void button2_Click(object sender, EventArgs e) { Provider p = new Provider(); p.firstName = SessionManager.Instance.ActiveUser.userFirstName; p.lastName = SessionManager.Instance.ActiveUser.userLastName; p.fullName = SessionManager.Instance.ActiveUser.userFullName; p.displayName = SessionManager.Instance.ActiveUser.userFullName; p.isApptProvider = "Yes"; HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); p.BackgroundPersistWork(args); SessionManager.Instance.ActiveUser.User_hraProviderID = p.providerID; args.Persist = false; SessionManager.Instance.MetaData.ApptProviders.AddToList(p, args); this.Close(); }
public void AddToList(HraObject hraObject, HraModelChangedEventArgs args) { lock (this) { if (this.Contains(hraObject)) { return; } hraObject.SignalModelChanged(args); hraObject.Changed += new HraObject.ChangedEventHandler(ItemChanged); this.Add(hraObject); if (ListChanged != null) { ListChanged(new HraListChangedEventArgs(HraListChangedEventArgs.HraListChangeType.ADD, hraObject)); } } }
/*******************************************************************************/ public void SignalModelChanged(HraModelChangedEventArgs e) { //TODO should very strongly consider moving this to some kind of object state manager class which can utilize connection and thread pooling if (e != null) //Silicus: Check for null { if (HttpContext.Current != null) //Silicus: Setting e.Persist to true to avoid any astnc call. { e.Persist = false; } if (e.Persist) { RunPersist(e); } if (Changed != null) { #if (CHATTY_DEBUG) string msg = "*** Changed event fired on : " + this.ToString() + System.Environment.NewLine; if (e != null) { if (e.sendingView != null) { msg += "FROM: " + e.sendingView.ToString(); } if (e.updatedMembers != null) { foreach (MemberInfo mi in e.updatedMembers) { msg += "Member: " + mi.ToString() + Environment.NewLine; } } } Logger.Instance.DebugToLog(msg); #endif Changed(this, e); } } }
/*******************************************************************************/ private void RunPersist(HraModelChangedEventArgs e) { //TODO use Task Parallel Library because its *WAY* easier to get this stuff correct!!! if (!ReadOnly) { lock (_persistThread) { _changeEventArgQueue.Enqueue(e); if (_persistThread.IsBusy == false) { RunPersistChattyDebugThreadyNotBusy(); _persistThread.RunWorkerAsync(e); } else { RunPersistChattyDebugThreadBusy(); } } } }
/// <summary> /// Adds the object to this <code>HRAList</code> given event args. /// </summary> /// <param name="hraObject">to add</param> /// <param name="args">args (members changed, etc...)</param> /// <param name="signalModelChanged">to immediately persist or not</param> public void AddToList(T hraObject, HraModelChangedEventArgs args, bool signalModelChanged = true) { //todo consider making this less accessible lock (this) { if (this.Contains(hraObject)) { return; } if (signalModelChanged) { hraObject.SignalModelChanged(args); } hraObject.Changed += ItemChanged; this.Add(hraObject); if (ListChanged != null) { ListChanged(new HraListChangedEventArgs(HraListChangedEventArgs.HraListChangeType.ADD, hraObject)); } } }
private void tVSToolStripMenuItem_Click(object sender, EventArgs e) { TransvaginalImagingStudy tvs = new TransvaginalImagingStudy(); tvs.unitnum = proband.unitnum; tvs.type = "TVS"; tvs.date = DateTime.Today; tvs.imagingType = "TVS"; HraModelChangedEventArgs args = new HraModelChangedEventArgs(this); proband.transvaginalImagingHx.AddToList(tvs, args); }
/**************************************************************************************************/ private void GUIPreferenceChanged(object sender, HraModelChangedEventArgs e) { foreach (MemberInfo fi in e.updatedMembers) { switch (fi.Name) { case "ShowLegend": if (currentPrefs.GUIPreference_ShowLegend) pedigreeLegend1.CheckForEmpty(); else pedigreeLegend1.Visible = false; break; case "LegendBackground": pedigreeLegend1.Background = currentPrefs.GUIPreference_LegendBackground; break; case "LegendBorder": pedigreeLegend1.BorderStyle = currentPrefs.GUIPreference_LegendBorder; break; case "LegendFont": pedigreeLegend1.LegendFont = currentPrefs.GUIPreference_LegendFont; break; case "LegendRadius": pedigreeLegend1.LegendRadius = currentPrefs.GUIPreference_LegendRadius; break; case "ShowComment": pedigreeComment1.Visible = currentPrefs.GUIPreference_ShowComment; break; case "CommentBackground": pedigreeComment1.Background = currentPrefs.GUIPreference_CommentBackground; break; case "CommentBorder": pedigreeComment1.BorderStyle = currentPrefs.GUIPreference_CommentBorder; break; case "CommentFont": pedigreeComment1.CommentFont = currentPrefs.GUIPreference_CommentFont; break; case "ShowTitle": pedigreeTitleBlock1.Visible = currentPrefs.GUIPreference_ShowTitle; break; case "NameFont": case "UnitnumFont": case "DobFont": pedigreeTitleBlock1.SetFonts(currentPrefs.GUIPreference_NameFont, currentPrefs.GUIPreference_UnitnumFont, currentPrefs.GUIPreference_DobFont); break; case "ShowName": pedigreeTitleBlock1.NameVis = currentPrefs.GUIPreference_ShowName; break; case "ShowUnitnum": pedigreeTitleBlock1.MRNVis = currentPrefs.GUIPreference_ShowUnitnum; break; case "ShowDob": pedigreeTitleBlock1.DOBVis = currentPrefs.GUIPreference_ShowDob; break; case "TitleSpacing": pedigreeTitleBlock1.Spacing = currentPrefs.GUIPreference_TitleSpacing; break; case "TitleBackground": pedigreeTitleBlock1.BackColor = currentPrefs.GUIPreference_TitleBackground; break; case "TitleBorder": pedigreeTitleBlock1.BorderStyle = currentPrefs.GUIPreference_TitleBorder; break; case "PedigreeBackground": pedigreeControl1.model.parameters.BackgroundBrush = new SolidBrush(currentPrefs.GUIPreference_PedigreeBackground); colorSlider1.BackColor = currentPrefs.GUIPreference_PedigreeBackground; ZoomSlider.BackColor = currentPrefs.GUIPreference_PedigreeBackground; break; case "nameWidth": pedigreeControl1.model.parameters.nameWidth = currentPrefs.GUIPreference_nameWidth; break; case "limitedEthnicity": pedigreeControl1.model.parameters.limitedEthnicity = currentPrefs.GUIPreference_limitedEthnicity; break; case "VariantFoundText": pedigreeControl1.model.parameters.VariantFoundText = currentPrefs.GUIPreference_VariantFoundText; break; case "VariantFoundVusText": pedigreeControl1.model.parameters.VariantFoundVusText = currentPrefs.GUIPreference_VariantFoundVusText; break; case "VariantNotFoundText": pedigreeControl1.model.parameters.VariantNotFoundText = currentPrefs.GUIPreference_VariantNotFoundText; break; case "VariantNotTestedText": pedigreeControl1.model.parameters.VariantNotTestedText = currentPrefs.GUIPreference_VariantNotTestedText; break; case "VariantUnknownText": pedigreeControl1.model.parameters.VariantUnknownText = currentPrefs.GUIPreference_VariantUnknownText; break; case "VariantHeteroText": pedigreeControl1.model.parameters.VariantHeteroText = currentPrefs.GUIPreference_VariantHeteroText; break; default: break; } } }
/**************************************************************************************************/ private GUIPreference getBestFitExistingGuiPreference(bool exactMatchOnly) { GUIPreference bestFitGuiPreference = null; List<GUIPreference> localList = proband.guiPreferences.ConvertAll(x => (GUIPreference)x); String parentFormText = (this.ParentForm != null) ? this.ParentForm.Text : ""; if (localList.Count == 0) { GUIPreference guiPreference; //String parentFormText = (this.ParentForm != null) ? this.ParentForm.Text : ""; guiPreference = new GUIPreference(proband, DateTime.Now, this.Text, parentFormText, this.Width, this.Height); HraModelChangedEventArgs args = new HraModelChangedEventArgs(this); args.Persist = true; proband.guiPreferences.AddToList(guiPreference, args); return guiPreference; } else { GUIPreference guiPreference = null; foreach (GUIPreference gp in localList) { guiPreference = gp; guiPreference.ReadOnly = false; guiPreference.ConsumeSettings(guiPreference); //TODO this is kind of a hack guiPreference.PersistFullObject(new HraModelChangedEventArgs(this)); guiPreference.GUIPreference_height = pedigreeControl1.Height; //TODO and so is this guiPreference.GUIPreference_width = pedigreeControl1.Width; //TODO ...and this....find better places for all of this... } return guiPreference; } }
private void AppointmentChanged(object sender, HraModelChangedEventArgs e) { }
private void TaskListLoadedForPopup(HraListLoadedEventArgs e) { RiskApps3.Model.PatientRecord.Patient p = SessionManager.Instance.GetActivePatient(); if (p != null) { Task t = new Task(p, "Task", "Pending", SessionManager.Instance.ActiveUser.ToString(), DateTime.Now); HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); args.Persist = true; p.Tasks.AddToList(t, args); TaskView tv = new TaskView(t); tv.ShowDialog(); p.Tasks.ReleaseListeners(this); RefreshQueue(); } }
/*******************************************************************************/ public virtual void BackgroundPersistWork(HraModelChangedEventArgs e) { }
private void button1_Click(object sender, EventArgs e) { if (pmh != null && sendingView != null) { ClincalObservation co = new ClincalObservation(pmh); co.disease = diseaseComboBox.Text; co.ageDiagnosis = AgeTextBox.Text; co.SetDiseaseDetails(); HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); args.Persist = true; pmh.Observations.AddToList(co, args); this.Close(); } }
private void selectedRelativeChanged(object sender, HraModelChangedEventArgs e) { if (this.InvokeRequired) { selectedRelativeChangedCallback srcc = new selectedRelativeChangedCallback(selectedRelativeChanged); object[] args = new object[2]; args[0] = sender; args[2] = e; this.Invoke(srcc, args); } else { // handles changes to the current relative and NOT a change from one relative to another FillControls(); if (e.sendingView != this) { foreach (MemberInfo mi in e.updatedMembers) { switch (mi.Name) { case "name": name.Text = selectedRelative.name; break; case "firstName": firstName.Text = selectedRelative.firstName; break; case "middleName": middleName.Text = selectedRelative.middleName; break; case "lastName": lastName.Text = selectedRelative.lastName; break; case "title": title.Text = selectedRelative.title; break; case "suffix": suffix.Text = selectedRelative.suffix; break; case "gender": gender.Text = selectedRelative.gender; break; case "maidenName": maidenName.Text = selectedRelative.maidenName; break; case "causeOfDeath": causeOfDeath.Text = selectedRelative.causeOfDeath; break; case "dateOfDeath": dateOfDeath.Text = selectedRelative.dateOfDeath; break; case "dob": dob.Text = selectedRelative.dob; break; case "dobConfidence": dobConfidence.Text = selectedRelative.dobConfidence; break; case "dateOfDeathConfidence": dateOfDeathConfidence.Text = selectedRelative.dateOfDeathConfidence; break; case "age": age.Text = selectedRelative.age; break; case "vitalStatus": vitalStatus.Text = selectedRelative.vitalStatus; break; case "city": city.Text = selectedRelative.city; break; case "state": city.Text = selectedRelative.state; break; case "zip": zipCode.Text = selectedRelative.zip; break; case "adopted": adopted.Text = selectedRelative.adopted; break; case "isAshkenazi": isAshkenaziComboBox.Text = selectedRelative.Person_isAshkenazi; break; case "isHispanic": isHispanicComboBox.Text = selectedRelative.Person_isHispanic; break; case "comment": commentsTextBox.Text = selectedRelative.Person_comment; break; } } } } }
private void mRIToolStripMenuItem_Click(object sender, EventArgs e) { BreastImagingStudy bis = new BreastImagingStudy(); bis.unitnum = proband.unitnum; bis.type = "MRI"; bis.date = DateTime.Today; bis.imagingType = "MRI"; bis.side = "Bilateral"; HraModelChangedEventArgs args = new HraModelChangedEventArgs(this); proband.breastImagingHx.AddToList(bis, args); }
private void DiagnosticChanged(object sender, HraModelChangedEventArgs e) { fastDataListView1.RefreshObject(sender); if (fastDataListView1.SelectedObject == sender) { Diagnostic dx = (Diagnostic)sender; comboBox1.Text = dx.normal; ValueLabel.Text = " - " + dx.value; ValueLabel.Location = new Point(label5.Location.X + label5.Width , label5.Location.Y); comboBox3.Text = dx.status; richTextBox1.Text = dx.report; } }
private void FollowupChanged(object sender, HraModelChangedEventArgs e) { //update the appropriate row with the new }
/*******************************************************************************/ public void DoPersistWithSpAndParams(HraModelChangedEventArgs e, String spName, ref ParameterCollection sPparams) { lock (BCDB2.Instance) { if (e.Persist == false) { return; } try { ////////////////////// using (SqlConnection connection = new SqlConnection(BCDB2.Instance.getConnectionString())) { connection.Open(); SqlCommand cmdProcedure = new SqlCommand(spName, connection) { CommandType = CommandType.StoredProcedure, CommandTimeout = 300 }; //change command timeout from default to 5 minutes if (e.Delete) { cmdProcedure.Parameters.Add("@delete", SqlDbType.Bit); cmdProcedure.Parameters["@delete"].Value = e.Delete; } cmdProcedure.Parameters.Add("@user", SqlDbType.NVarChar); if (SessionManager.Instance.ActiveUser == null) { cmdProcedure.Parameters["@user"].Value = "Not Available"; } else { cmdProcedure.Parameters["@user"].Value = SessionManager.Instance.ActiveUser.userLogin; } if (sPparams != null) { foreach (string param in sPparams.getKeys()) { if (sPparams[param].Size > 0) { cmdProcedure.Parameters.Add("@" + param, sPparams[param].sqlType, sPparams[param].Size); } else { cmdProcedure.Parameters.Add("@" + param, sPparams[param].sqlType); } cmdProcedure.Parameters["@" + param].Value = sPparams[param].obj; if (sPparams[param].BiDirectional) { cmdProcedure.Parameters["@" + param].Direction = ParameterDirection.InputOutput; } } } try { if (e.updatedMembers.Count > 0) { foreach (FieldInfo fi in this.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) { string name = fi.Name; foreach (MemberInfo mi in e.updatedMembers) { if (name == mi.Name) { SqlDbType sType = BCDB2.Instance.GetSqlTypeFromModel(fi.FieldType); if (cmdProcedure.Parameters.Contains("@" + name)) { if (cmdProcedure.Parameters["@" + name].Value.Equals(fi.GetValue(this))) { //Logger.Instance.WriteToLog("[DoPersistWithSpAndParams] Executing Stored Procedure - " // + "Added the same parameter and value twice; parameter name = " + name + "; value = " + cmdProcedure.Parameters["@" + name].Value.ToString()); } else { Logger.Instance.WriteToLog("Attempted to Add the same parameter twice with differing values; first value = " + cmdProcedure.Parameters["@" + name].Value + ", " + "Second value = " + fi.GetValue(this)); } break; //don't add it } cmdProcedure.Parameters.Add("@" + name, sType); cmdProcedure.Parameters["@" + name].Value = fi.GetValue(this); break; } } } } else { foreach (FieldInfo fi in this.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) { bool persist = IsPersistable(fi); if (fi.FieldType == typeof(DateTime)) { DateTime dt = (DateTime)fi.GetValue(this); if (!(dt > DateTime.MinValue && dt < DateTime.MaxValue)) { persist = false; } } else if (fi.GetValue(this) == null) { persist = false; } if (persist) { SqlDbType sType = BCDB2.Instance.GetSqlTypeFromModel(fi.FieldType); if (cmdProcedure.Parameters.Contains("@" + fi.Name)) { if (cmdProcedure.Parameters["@" + fi.Name].Value.Equals(fi.GetValue(this))) { Logger.Instance.WriteToLog("[DoPersistWithSpAndParams] executing Stored Procedure [" + cmdProcedure.CommandText + "] - Added the same parameter and value twice; parameter name = " + fi.Name + "; value = " + cmdProcedure.Parameters["@" + fi.Name].Value); } else { Logger.Instance.WriteToLog("[DoPersistWithSpAndParams] executing Stored Procedure - [" + cmdProcedure.CommandText + "] - Attempted to Add the same parameter twice with differing values; first value = " + cmdProcedure.Parameters["@" + fi.Name].Value + ", " + "Second value = " + fi.GetValue(this)); } continue; //don't add it } cmdProcedure.Parameters.Add("@" + fi.Name, sType); cmdProcedure.Parameters["@" + fi.Name].Value = (fi.GetValue(this) is Double ? (Double.IsNaN((Double)(fi.GetValue(this))) ? null : fi.GetValue(this)) : fi.GetValue(this)); } } } PersistWithSpAndParamsChattyDebug(); cmdProcedure.ExecuteNonQuery(); foreach (SqlParameter p in cmdProcedure.Parameters) { if (p.Direction == ParameterDirection.InputOutput) { if (sPparams != null) { sPparams.Add(p.ParameterName.Replace("@", ""), p.Value); } } } } catch (Exception exception) { Logger.Instance.WriteToLog("[DoPersistWithSpAndParams] Executing Stored Procedure - " + cmdProcedure.CommandText + "; " + exception); } } //end of using connection } catch (Exception exc) { Logger.Instance.WriteToLog("[DoPersistWithSpAndParams] Executing Stored Procedure - " + exc); } } }
/**************************************************************************************************/ private void theBreastImagingHxChanged(object sender, HraModelChangedEventArgs e) { if (e.sendingView != this) { FillControls(); } }
private void PendingGenTestChanged(object sender, HraModelChangedEventArgs e) { }
/**************************************************************************************************/ private void activePatientChanged(object sender, HraModelChangedEventArgs e) { }
/**************************************************************************************************/ public void SaveSelectedPositions(bool persist) { foreach (PedigreeIndividual p in model.Selected) { p.HraPerson.x_position = 800 / (p.point.x - ((model.displayXMax - 800) / 2)); p.HraPerson.y_position = 600 / (p.point.y - ((model.displayYMax - 600) / 2)); p.HraPerson.x_norm = (int)(p.point.x - (model.displayXMax / 2)); p.HraPerson.y_norm = (int)(p.point.y - (model.displayYMax / 2)); HraModelChangedEventArgs args = new RiskApps3.Model.HraModelChangedEventArgs((HraView)(this.Parent)); args.Persist = persist; if (p.HraPerson.x_position > float.MinValue && p.HraPerson.x_position < float.MaxValue) { foreach (MemberInfo mi in p.HraPerson.GetType().GetMember("x_*")) { args.updatedMembers.Add(mi); } } if (p.HraPerson.y_position > float.MinValue && p.HraPerson.y_position < float.MaxValue) { foreach (MemberInfo mi in p.HraPerson.GetType().GetMember("y_*")) { args.updatedMembers.Add(mi); } } p.HraPerson.SignalModelChanged(args); } }
/**************************************************************************************************/ public PedigreeControl() { InitializeComponent(); FHxQueue = new Queue<RiskApps3.Model.PatientRecord.FHx.FamilyHistory>(); this.DoubleBuffered = true; ModelConvergedDelegate = ModelConverged; at.SpawnAnimationThread ( delegate() { if (model != null && controller != null) { controller.IncrementLayout(); if (controller.LayoutComplete) { if (CloseFormCallback != null) { CloseFormCallback.Invoke(); } } } this.Refresh(); return continueAnimation; } ); /**************************************************************************************************/ MouseDown += new MouseEventHandler(delegate(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { RightClickTimer.Enabled = true; } //PushPositionHistory(); if (model != null) { model.io.mouseX = e.X; model.io.mouseY = e.Y; model.io.mouseDown = true; model.io.button = e.Button; } //PointWithVelocity pointUnderCursor = GetPointUnderCursor(model, e.X, e.Y); PedigreeIndividual underCursor = PedigreeUtils.GetIndividualUnderPoint(model, e.X, e.Y); if (underCursor != null) { if (model.Selected.Count > 1) { foreach (PedigreeIndividual pi in model.Selected) { model.pointsBeingDragged.Add(pi.point); } if (!(model.pointsBeingDragged.Contains(underCursor.point))) { model.pointsBeingDragged.Clear(); } } else { if (underCursor.Group == null) { model.pointsBeingDragged.Add(underCursor.point); } else { foreach (PedigreeIndividual gm in underCursor.Group) { model.pointsBeingDragged.Add(gm.point); } } } } }); /**************************************************************************************************/ MouseClick += new MouseEventHandler(delegate(object sender, MouseEventArgs e) { }); /**************************************************************************************************/ MouseUp += new MouseEventHandler(delegate(object sender, MouseEventArgs e) { if (model.SelectionLasso.Count > 0) { Polygon poly = new Polygon(model.SelectionLasso.ToArray()); model.Selected.Clear(); foreach (PedigreeIndividual pi in model.individuals) { if (!model.parameters.hideNonBloodRelatives || pi.bloodRelative) { System.Drawing.Point scaled = new System.Drawing.Point((int)pi.point.x, (int)pi.point.y); scaled.X += model.parameters.hOffset; scaled.Y += model.parameters.vOffset; scaled.X = (int)(model.parameters.scale * (double)scaled.X); scaled.Y = (int)(model.parameters.scale * (double)scaled.Y); if (poly.Contains(scaled)) { pi.Selected = true; if (model.Selected.Contains(pi) == false) { model.Selected.Add(pi); model.pointsBeingDragged.Add(pi.point); } } else { pi.Selected = false; } } } } else { PedigreeIndividual individual = PedigreeUtils.GetIndividualUnderPoint(model, (e.X), (e.Y)); if (individual != null) { if (individual.Selected == false) { foreach (PedigreeIndividual pi in model.Selected) { pi.Selected = false; } model.Selected.Clear(); if (individual.Group == null) { if (SelectedIndividualCallback != null) { SelectedIndividualCallback.Invoke(individual.HraPerson); } individual.Selected = true; if (model.Selected.Contains(individual) == false) model.Selected.Add(individual); } else { if (SelectedIndividualCallback != null) { SelectedIndividualCallback.Invoke(null); } foreach (PedigreeIndividual gm in individual.Group) { gm.Selected = true; if (model.Selected.Contains(gm) == false) model.Selected.Add(gm); } } } } else { //if (currentPrefs != null) //{ // currentPrefs.GUIPreference_xOffset = model.parameters.hOffset; // currentPrefs.GUIPreference_yOffset = model.parameters.vOffset; //} if (SelectedIndividualCallback != null) { SelectedIndividualCallback.Invoke(null); } foreach (PedigreeIndividual pi in model.Selected) { pi.Selected = false; } model.Selected.Clear(); } } if (e.Button == MouseButtons.Right) { if (RightClickTimer.Enabled) { RightClickTimer.Enabled = false; ShowContextMenu(e); if (model.Selected.Count == 1) { if (model.Selected[0].HraPerson.PMH.Observations.Count > 0) { removeToolStripMenuItem.Enabled = true; foreach (ClincalObservation co in model.Selected[0].HraPerson.PMH.Observations) { ToolStripMenuItem tsmi = new ToolStripMenuItem(); tsmi.Text = co.disease; if (string.IsNullOrEmpty(co.ageDiagnosis) == false) { tsmi.Text += " @ " + co.ageDiagnosis; } removeToolStripMenuItem.DropDownItems.Add(tsmi); tsmi.Tag = co; tsmi.Click += new System.EventHandler(RemoveCoClick); } } else { removeToolStripMenuItem.Enabled = false; } } else { removeToolStripMenuItem.Enabled = false; } } else { //removeToolStripMenuItem.Enabled = false; } } if (model != null) { model.io.mouseX = e.X; model.io.mouseY = e.Y; model.io.mouseDown = false; model.io.button = e.Button; } if (model.pointsBeingDragged.Count > 0) { PushPositionHistory(); foreach (PedigreeIndividual p in model.individuals) { if (model.pointsBeingDragged.Contains(p.point)) { bool changed = false; double tempXpos = 800 / (p.point.x - ((model.displayXMax - 800) / 2)); double tempYpos = 600 / (p.point.y - ((model.displayYMax - 600) / 2)); int tempXnorm = (int)(p.point.x - (model.displayXMax / 2)); int tempYnorm = (int)(p.point.y - (model.displayYMax / 2)); if (tempXpos != p.HraPerson.x_position) { p.HraPerson.x_position = tempXpos; changed = true; } if (tempYpos != p.HraPerson.y_position) { p.HraPerson.y_position = tempYpos; changed = true; } if (tempXnorm != p.HraPerson.x_norm) { p.HraPerson.x_norm = tempXnorm; changed = true; } if (tempYnorm != p.HraPerson.y_norm) { p.HraPerson.y_norm = tempYnorm; changed = true; } if (changed) { HraModelChangedEventArgs args = new RiskApps3.Model.HraModelChangedEventArgs((HraView)(this.Parent)); if (p.HraPerson.x_position > float.MinValue && p.HraPerson.x_position < float.MaxValue) { foreach (MemberInfo mi in p.HraPerson.GetType().GetMember("x_*")) { args.updatedMembers.Add(mi); } } if (p.HraPerson.y_position > float.MinValue && p.HraPerson.y_position < float.MaxValue) { foreach (MemberInfo mi in p.HraPerson.GetType().GetMember("y_*")) { args.updatedMembers.Add(mi); } } p.HraPerson.SignalModelChanged(args); } } } } if (model.RelativesToLink.Count > 0) { LinkToSelected(); model.RelativesToLink.Clear(); PushPositionHistory(); SavePositions(true); SetPedigreeFromFHx(model.familyHistory); } model.pointsBeingDragged.Clear(); model.SelectionLasso.Clear(); }); /**************************************************************************************************/ MouseMove += new MouseEventHandler(delegate(object sender, MouseEventArgs e) { if (model != null) { if (model.io.mouseDown) { if (!(model.pointsBeingDragged.Count > 0)) { if (model.parameters.multiSelect) { model.SelectionLasso.Add(e.Location); } else { model.parameters.hOffset += (int)((System.Convert.ToDouble(e.X) - (model.io.mouseX)) / model.parameters.scale); model.parameters.vOffset += (int)((System.Convert.ToDouble(e.Y) - (model.io.mouseY)) / model.parameters.scale); } } else { foreach (PointWithVelocity point in model.pointsBeingDragged) { point.x += ((e.X - model.io.mouseX) / model.parameters.scale); point.y += ((e.Y - model.io.mouseY) / model.parameters.scale); } } } model.io.mouseX = e.X; model.io.mouseY = e.Y; } }); }
/**************************************************************************************************/ private void relChanged(object sender, HraModelChangedEventArgs e) { if (e.sendingView != this) { bool found = false; foreach (MemberInfo mi in e.updatedMembers) { if (mi.Name == "x_norm" || mi.Name == "y_norm") { found = true; } } if (found) { pedigreeControl1.SetPersonPosition((Person)sender); } } }
/**************************************************************************************************/ private void ActivePatientTasksChanged(object sender, HraModelChangedEventArgs e) { Task t = (Task)sender; if (t != null) { if (string.IsNullOrEmpty(t.Task_Status) == false) { if (t.Task_Status != "Pending") { RemoveTabPage(t.taskID); } else { UpdateTabPage(t.taskID); } } } }
/**************************************************************************************************/ private void ClinicalObservationChanged(object sender, HraModelChangedEventArgs e) { if (sender != null) { ClincalObservation co = (ClincalObservation)sender; foreach (MemberInfo mi in e.updatedMembers) { if (mi.Name == "disease") { pedigreeLegend1.AddSingleObservation(co, true); if (currentPrefs != null) { currentPrefs.GUIPreference_LegendX = pedigreeLegend1.Location.X; currentPrefs.GUIPreference_LegendY = pedigreeLegend1.Location.Y; currentPrefs.GUIPreference_LegendWidth = pedigreeLegend1.Size.Width; currentPrefs.GUIPreference_LegendHeight = pedigreeLegend1.Size.Height; // currentPrefs.GUIPreference_LegendHeight = pedigreeLegend1.Height; //currentPrefs.GUIPreference_LegendWidth = pedigreeLegend1.Width; //if (currentPrefs.GUIPreference_ShowLegend) // pedigreeLegend1.CheckForEmpty(); //else // pedigreeLegend1.Visible = false; } } } } }
private void addToDoNotCallListToolStripMenuItem_Click(object sender, EventArgs e) { string assignedBy = ""; if (SessionManager.Instance.ActiveUser != null) { if (string.IsNullOrEmpty(SessionManager.Instance.ActiveUser.ToString()) == false) { assignedBy = SessionManager.Instance.ActiveUser.ToString(); } } Patient p = SessionManager.Instance.GetActivePatient(); // TODO: Check this!! Task t = new Task(p, "Task", null, assignedBy, DateTime.Now); HraModelChangedEventArgs args = new HraModelChangedEventArgs(null); args.Persist = true; p.Tasks.AddToList(t, args); PtFollowup newFollowup = new PtFollowup(t); newFollowup.Disposition = "Omit From List"; newFollowup.TypeOfFollowup = "Phone Call"; newFollowup.Comment = "Do Not Call"; newFollowup.Who = assignedBy; newFollowup.Date = DateTime.Now; args = new HraModelChangedEventArgs(null); args.Persist = true; t.FollowUps.AddToList(newFollowup, args); }
/**************************************************************************************************/ private void FhxItemChanged(object sender, HraModelChangedEventArgs e) { if (e.sendingView != this) { foreach (MemberInfo mi in e.updatedMembers) { if (mi.Name.Contains("position")) { if (pedigreeControl1.model != null) { foreach (PedigreeIndividual pi in pedigreeControl1.model.individuals) { if (pi.HraPerson == sender) { pedigreeControl1.SetPersonFromHraValues(pi, pedigreeControl1.model); return; } } } } } } }
/**************************************************************************************************/ private void TaskChanged(object sender, HraModelChangedEventArgs e) { foreach (Control c in flowLayoutPanel1.Controls) { if (((PendingTaskSummaryRow)c).GetTask() == sender) { ((PendingTaskSummaryRow)c).SetTask((Task)sender); } } }
/**************************************************************************************************/ private void GeneticTestChanged(object sender, HraModelChangedEventArgs e) { if (sender != null) { GeneticTest gt = (GeneticTest)sender; ProcessGeneticTest(); this.pedigreeControl1.SetPedigreeFromFHx(this.fhx); } }