diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2017-09-28 16:24:12 +0300 |
---|---|---|
committer | Vsevolod Kukol <sevoku@microsoft.com> | 2017-09-28 16:59:24 +0300 |
commit | 337053efcb26e077922485bab754a3b6b2bc828a (patch) | |
tree | ad21cdbc70ebc40613d80ff1d4425f7c08b6396c /Xwt | |
parent | 48c66f84811633681f29d6775d81f663243a1c4a (diff) |
Use InvokePlatformCode to run dialogs
Diffstat (limited to 'Xwt')
-rw-r--r-- | Xwt/Xwt/FileDialog.cs | 6 | ||||
-rw-r--r-- | Xwt/Xwt/MessageDialog.cs | 5 | ||||
-rw-r--r-- | Xwt/Xwt/SelectColorDialog.cs | 6 | ||||
-rw-r--r-- | Xwt/Xwt/SelectFolderDialog.cs | 7 | ||||
-rw-r--r-- | Xwt/Xwt/SelectFontDialog.cs | 6 |
5 files changed, 25 insertions, 5 deletions
diff --git a/Xwt/Xwt/FileDialog.cs b/Xwt/Xwt/FileDialog.cs index e6d46a74..54488b95 100644 --- a/Xwt/Xwt/FileDialog.cs +++ b/Xwt/Xwt/FileDialog.cs @@ -182,7 +182,11 @@ namespace Xwt Backend.ActiveFilter = activeFilter; if (!string.IsNullOrEmpty (title)) Backend.Title = title; - return Backend.Run ((IWindowFrameBackend)Toolkit.GetBackend (parentWindow)); + bool result = false; + BackendHost.ToolkitEngine.InvokePlatformCode (delegate { + result = Backend.Run ((IWindowFrameBackend)Toolkit.GetBackend (parentWindow)); + }); + return result; } finally { currentFolder = Backend.CurrentFolder; activeFilter = Backend.ActiveFilter; diff --git a/Xwt/Xwt/MessageDialog.cs b/Xwt/Xwt/MessageDialog.cs index 164ee552..fd7a8207 100644 --- a/Xwt/Xwt/MessageDialog.cs +++ b/Xwt/Xwt/MessageDialog.cs @@ -224,7 +224,10 @@ namespace Xwt message.Icon.InitForToolkit (Toolkit.CurrentEngine); using (backend) { - var res = backend.Run (parent ?? RootWindow, message); + Command res = null; + Toolkit.CurrentEngine.InvokePlatformCode (delegate { + res = backend.Run (parent ?? RootWindow, message); + }); if (backend.ApplyToAll) message.ApplyToAllButton = res; diff --git a/Xwt/Xwt/SelectColorDialog.cs b/Xwt/Xwt/SelectColorDialog.cs index a46fec91..269807c9 100644 --- a/Xwt/Xwt/SelectColorDialog.cs +++ b/Xwt/Xwt/SelectColorDialog.cs @@ -89,7 +89,11 @@ namespace Xwt try { if (color != Colors.Transparent) backend.Color = color; - return backend.Run ((IWindowFrameBackend)Toolkit.GetBackend (parentWindow), title, supportsAlpha); + bool result = false; + Toolkit.CurrentEngine.InvokePlatformCode (delegate { + result = backend.Run ((IWindowFrameBackend)Toolkit.GetBackend (parentWindow), title, supportsAlpha); + }); + return result; } finally { color = backend.Color; backend.Dispose (); diff --git a/Xwt/Xwt/SelectFolderDialog.cs b/Xwt/Xwt/SelectFolderDialog.cs index 660e882b..cc5990fc 100644 --- a/Xwt/Xwt/SelectFolderDialog.cs +++ b/Xwt/Xwt/SelectFolderDialog.cs @@ -156,7 +156,12 @@ namespace Xwt if (!string.IsNullOrEmpty (title)) Backend.Title = title; Backend.CanCreateFolders = canCreateFolders; - return Backend.Run ((IWindowFrameBackend)Toolkit.GetBackend (parentWindow)); + + bool result = false; + BackendHost.ToolkitEngine.InvokePlatformCode (delegate { + result = Backend.Run ((IWindowFrameBackend)Toolkit.GetBackend (parentWindow)); + }); + return result; } finally { currentFolder = Backend.CurrentFolder; folder = Backend.Folder; diff --git a/Xwt/Xwt/SelectFontDialog.cs b/Xwt/Xwt/SelectFontDialog.cs index 5525ec96..c775b2f0 100644 --- a/Xwt/Xwt/SelectFontDialog.cs +++ b/Xwt/Xwt/SelectFontDialog.cs @@ -95,7 +95,11 @@ namespace Xwt backend.SelectedFont = SelectedFont; backend.Title = Title; backend.PreviewText = PreviewText; - return backend.Run ((IWindowFrameBackend)Toolkit.GetBackend (parentWindow)); + bool result = false; + Toolkit.CurrentEngine.InvokePlatformCode (delegate { + result = backend.Run ((IWindowFrameBackend)Toolkit.GetBackend (parentWindow)); + }); + return result; } catch (Exception ex) { Console.WriteLine (ex); return false; |