Fix form dialogs not working for sarc (ie AAMP editor)
This commit is contained in:
parent
153783562e
commit
05cb5979f8
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -393,12 +393,21 @@ namespace FirstPlugin
|
||||
|
||||
private void OpenFormDialog(IFileFormat fileFormat)
|
||||
{
|
||||
STForm form = GetEditorForm(fileFormat);
|
||||
UserControl form = GetEditorForm(fileFormat);
|
||||
form.Text = (((IFileFormat)fileFormat).FileName);
|
||||
|
||||
var parentForm = LibraryGUI.Instance.GetActiveForm();
|
||||
|
||||
form.Text = (((IFileFormat)fileFormat).FileName);
|
||||
form.FormClosing += (sender, e) => FormClosing(sender, e, fileFormat);
|
||||
form.Show(parentForm);
|
||||
GenericEditorForm editorForm = new GenericEditorForm(true, form);
|
||||
editorForm.FormClosing += (sender, e) => FormClosing(sender, e, fileFormat);
|
||||
if (editorForm.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (fileFormat.CanSave)
|
||||
{
|
||||
ArchiveFileInfo.FileData = fileFormat.Save();
|
||||
UpdateEditor();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FormClosing(object sender, EventArgs args, IFileFormat fileFormat)
|
||||
@ -413,7 +422,7 @@ namespace FirstPlugin
|
||||
}
|
||||
}
|
||||
|
||||
private STForm GetEditorForm(IFileFormat fileFormat)
|
||||
private UserControl GetEditorForm(IFileFormat fileFormat)
|
||||
{
|
||||
Type objectType = fileFormat.GetType();
|
||||
foreach (var inter in objectType.GetInterfaces())
|
||||
@ -421,7 +430,7 @@ namespace FirstPlugin
|
||||
if (inter.IsGenericType && inter.GetGenericTypeDefinition() == typeof(IEditor<>))
|
||||
{
|
||||
System.Reflection.MethodInfo method = objectType.GetMethod("OpenForm");
|
||||
return (STForm)method.Invoke(fileFormat, new object[0]);
|
||||
return (UserControl)method.Invoke(fileFormat, new object[0]);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -110,7 +110,7 @@ namespace FirstPlugin
|
||||
readonly STToolStripItem[] toolsExt = new STToolStripItem[1];
|
||||
public OdysseyCostumeSelectorMenu()
|
||||
{
|
||||
toolsExt[0] = new STToolStripItem("Odyssey Costume Selctor");
|
||||
toolsExt[0] = new STToolStripItem("Odyssey Costume Selector");
|
||||
toolsExt[0].Click += OpenSelector;
|
||||
}
|
||||
private void OpenSelector(object sender, EventArgs args)
|
||||
|
Loading…
Reference in New Issue
Block a user