B2019-029: When a new annotation is created, unless you press save, it isn’t saved. The first fix caused a dialog to come up repeatedly for when save is selected. There is no longer a dialog and this was fixed with this update
This commit is contained in:
@@ -200,7 +200,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
|
||||
private bool _AnnotationDirty = false;
|
||||
private bool AnnotationDirty
|
||||
public bool AnnotationDirty
|
||||
{
|
||||
get { return _AnnotationDirty; }
|
||||
set
|
||||
@@ -334,33 +334,27 @@ namespace Volian.Controls.Library
|
||||
if (!_LoadingAnnotation)
|
||||
AnnotationDirty = true;
|
||||
}
|
||||
// B2019-029: Ask user if they want to save an annotation, if it was added (new) and the user did not click to save and moved to a
|
||||
// new step
|
||||
private void rtxbComment_Leave(object sender, EventArgs e)
|
||||
{
|
||||
if (this.AnnotationDirty && (Annotations == null || Annotations.Count == 0))
|
||||
{
|
||||
if (FlexibleMessageBox.Show(this, "Do you want to save the annotation?", "Confirm Annotation Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
SaveAnnotation();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region LoadControlData
|
||||
|
||||
public void SetupAnnotations(DisplaySearch annosrch)
|
||||
{
|
||||
_LoadingAnnotation = true;
|
||||
_AnnotationSearch = annosrch; // reference the Annotation Search to update its lists
|
||||
public void SetupAnnotations(DisplaySearch annosrch)
|
||||
{
|
||||
_LoadingAnnotation = true;
|
||||
_AnnotationSearch = annosrch; // reference the Annotation Search to update its lists
|
||||
|
||||
cbGridAnnoType.DisplayMember = "Name";
|
||||
cbGridAnnoType.ValueMember = "TypeId";
|
||||
cbGridAnnoType.DataSource = AnnotationTypeInfoList.Get().Clone();
|
||||
cbGridAnnoType.SelectedIndex = -1; //don't pre-select an annotation type
|
||||
_LoadingAnnotation = false;
|
||||
}
|
||||
cbGridAnnoType.DisplayMember = "Name";
|
||||
cbGridAnnoType.ValueMember = "TypeId";
|
||||
cbGridAnnoType.DataSource = AnnotationTypeInfoList.Get().Clone();
|
||||
// If there are no annotatons, then selected index is -1 (not defined), otherwise select the first.
|
||||
// This was done so that it could be saved if there was text entered but user moves to another steprtb without selecting save button
|
||||
// so that annotation gets saved.
|
||||
if (cbGridAnnoType.Items.Count == 0)
|
||||
cbGridAnnoType.SelectedIndex = -1;
|
||||
else
|
||||
cbGridAnnoType.SelectedIndex = 0;
|
||||
_LoadingAnnotation = false;
|
||||
}
|
||||
|
||||
private void InitializeAnnotation()
|
||||
{
|
||||
@@ -368,7 +362,10 @@ namespace Volian.Controls.Library
|
||||
_LoadingAnnotation = true;
|
||||
if (CurrentAnnotation == null)
|
||||
{
|
||||
cbGridAnnoType.SelectedIndex = -1;
|
||||
if (cbGridAnnoType.Items.Count == 0) // see comment for SetupAnnotations
|
||||
cbGridAnnoType.SelectedIndex = -1;
|
||||
else
|
||||
cbGridAnnoType.SelectedIndex = 0;
|
||||
AnnotationText = "";
|
||||
}
|
||||
else
|
||||
@@ -653,7 +650,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveAnnotation()
|
||||
public void SaveAnnotation()
|
||||
{
|
||||
if (cbGridAnnoType.SelectedIndex == -1) return;
|
||||
if (rtxbComment.Text == string.Empty) return;
|
||||
|
Reference in New Issue
Block a user