Use event pattern
This commit is contained in:
parent
db84a6ec83
commit
523a218d47
3 changed files with 14 additions and 14 deletions
|
|
@ -261,7 +261,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
ActiveSliceSettings.Instance.SetValue("boolean_operations", mergeRules);
|
||||
|
||||
var matrixAndMeshArgs = new StringBuilder(); ;
|
||||
var matrixAndMeshArgs = new StringBuilder();
|
||||
foreach (var matrixAndFile in stlFileLocations)
|
||||
{
|
||||
var matrixString = "";
|
||||
|
|
|
|||
|
|
@ -41,9 +41,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
public class SurfacedEditorPage : DialogPage
|
||||
{
|
||||
public event EventHandler ValueChanged;
|
||||
|
||||
private MHTextEditWidget editWidget;
|
||||
|
||||
public SurfacedEditorPage(UIField uiField, IObject3D selectedItem)
|
||||
public SurfacedEditorPage(IObject3D selectedItem)
|
||||
{
|
||||
this.WindowTitle = "MatterControl - " + "Editor Selector".Localize();
|
||||
this.HeaderText = "Surfaced Editor".Localize();
|
||||
|
|
@ -142,9 +144,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
var saveButton = theme.CreateDialogButton("Save".Localize());
|
||||
saveButton.Click += (s, e) =>
|
||||
{
|
||||
uiField.SetValue(
|
||||
editWidget.Text.Replace("\n", "\\n"),
|
||||
userInitiated: true);
|
||||
this.ValueChanged?.Invoke(this, null);
|
||||
|
||||
this.DialogWindow.CloseOnIdle();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -58,17 +58,17 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
if (sender is InlineStringEdit inlineEdit)
|
||||
{
|
||||
var uifield = new TextField();
|
||||
uifield.Initialize(0);
|
||||
uifield.ValueChanged += (s, e2) =>
|
||||
{
|
||||
inlineEdit.Text = uifield.Value;
|
||||
};
|
||||
|
||||
DialogWindow.Show(new SurfacedEditorPage(uifield, selectedItem)
|
||||
var editorPage = new SurfacedEditorPage(selectedItem)
|
||||
{
|
||||
EditorString = inlineEdit.Text,
|
||||
});
|
||||
};
|
||||
|
||||
editorPage.ValueChanged += (s, e2) =>
|
||||
{
|
||||
inlineEdit.Text = editorPage.EditorString;
|
||||
};
|
||||
|
||||
DialogWindow.Show(editorPage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue