Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary fix for async code in lua script engine #585

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions projects/GKCore/GKCore/ScriptEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
using System.IO;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using BSLib;
using GDModel;
using GDModel.Providers.GEDCOM;
Expand Down Expand Up @@ -271,14 +270,14 @@ public void update_view()
fBase.RefreshLists(false);
}

public async Task<string> select_file()
public string select_file()
{
return await AppHost.StdDialogs.GetOpenFile("", "", "All files (*.*)|*.*", 0, "");
return AppHost.StdDialogs.GetOpenFile("", "", "All files (*.*)|*.*", 0, "").Result;
}

public async Task<string> select_new_file()
public string select_new_file()
{
return await AppHost.StdDialogs.GetSaveFile("", "", "All files (*.*)|*.*", 0, "", "", true);
return AppHost.StdDialogs.GetSaveFile("", "", "All files (*.*)|*.*", 0, "", "", true).Result;
}

#endregion
Expand All @@ -301,10 +300,10 @@ public int get_record_type(object recPtr)
return (rec == null) ? (int)GDMRecordType.rtNone : (int)rec.RecordType;
}

public async Task<bool> delete_record(object recPtr)
public bool delete_record(object recPtr)
{
GDMRecord rec = recPtr as GDMRecord;
return await BaseController.DeleteRecord(fBase, rec, false);
return BaseController.DeleteRecord(fBase, rec, false).Result;
}

public string get_record_xref(object recPtr)
Expand Down Expand Up @@ -564,9 +563,9 @@ public void bind_family_child(object familyPtr, object childPtr)
fRec.AddChild(chRec);
}

public async Task<string> define_sex(string name, string patr)
public string define_sex(string name, string patr)
{
GDMSex sx = await fBase.Context.DefineSex(fView, name, patr);
GDMSex sx = fBase.Context.DefineSex(fView, name, patr).Result;

return GKData.SexData[(int)sx].Sign;
}
Expand All @@ -583,11 +582,11 @@ public object create_event(object recPtr, string sign)
return evt;
}

public async Task<string> define_patronymic(string fatherName, string childSex, bool confirm)
public string define_patronymic(string fatherName, string childSex, bool confirm)
{
GDMSex sex = (childSex.Length == 1) ? GKUtils.GetSexBySign(childSex[0]) : GDMSex.svUnknown;

return await fBase.Context.DefinePatronymic(fView, fatherName, sex, confirm);
return fBase.Context.DefinePatronymic(fView, fatherName, sex, confirm).Result;
}

public object get_individual_parents_family(object recPtr)
Expand Down
Loading