-
-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
1,991 additions
and
616 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,84 @@ | ||
using Eto.Forms; | ||
namespace Eto.WinUI.Forms | ||
namespace Eto.WinUI.Forms; | ||
|
||
public class ApplicationHandler : WidgetHandler<mux.Application, Application, Application.ICallback>, Application.IHandler | ||
{ | ||
public class ApplicationHandler : WidgetHandler<mux.Application, Application, Application.ICallback>, Application.IHandler | ||
{ | ||
mud.DispatcherQueue _dispatcher; | ||
Thread _mainThread; | ||
mud.DispatcherQueue _dispatcher; | ||
Thread _mainThread; | ||
|
||
public bool QuitIsSupported => true; | ||
public Keys CommonModifier => Keys.Control; | ||
public Keys AlternateModifier => Keys.Alt; | ||
public string BadgeLabel { get; set; } | ||
public bool IsActive { get; } | ||
public bool QuitIsSupported => true; | ||
public Keys CommonModifier => Keys.Control; | ||
public Keys AlternateModifier => Keys.Alt; | ||
public string BadgeLabel { get; set; } | ||
public bool IsActive { get; } | ||
|
||
public ApplicationHandler() | ||
{ | ||
Control = mux.Application.Current; | ||
} | ||
public ApplicationHandler() | ||
{ | ||
Control = mux.Application.Current; | ||
} | ||
|
||
public void AsyncInvoke(Action action) | ||
{ | ||
_dispatcher.TryEnqueue(new mud.DispatcherQueueHandler(action)); | ||
} | ||
public void AsyncInvoke(Action action) | ||
{ | ||
_dispatcher.TryEnqueue(new mud.DispatcherQueueHandler(action)); | ||
} | ||
|
||
public void Attach(object context) | ||
{ | ||
Control = context as mux.Application; | ||
} | ||
public void Attach(object context) | ||
{ | ||
Control = context as mux.Application; | ||
} | ||
|
||
protected override void Initialize() | ||
{ | ||
base.Initialize(); | ||
_dispatcher = mud.DispatcherQueue.GetForCurrentThread(); | ||
_mainThread = Thread.CurrentThread; | ||
} | ||
protected override void Initialize() | ||
{ | ||
base.Initialize(); | ||
_dispatcher = mud.DispatcherQueue.GetForCurrentThread(); | ||
_mainThread = Thread.CurrentThread; | ||
} | ||
|
||
public void Invoke(Action action) | ||
{ | ||
public void Invoke(Action action) | ||
{ | ||
|
||
if (_dispatcher == null || Thread.CurrentThread == _mainThread) | ||
action(); | ||
else | ||
if (_dispatcher == null || Thread.CurrentThread == _mainThread) | ||
action(); | ||
else | ||
{ | ||
var mre = new ManualResetEvent(false); | ||
_dispatcher.TryEnqueue(() => | ||
{ | ||
var mre = new ManualResetEvent(false); | ||
_dispatcher.TryEnqueue(() => | ||
{ | ||
action(); | ||
mre.Set(); | ||
}); | ||
mre.WaitOne(); | ||
} | ||
action(); | ||
mre.Set(); | ||
}); | ||
mre.WaitOne(); | ||
} | ||
} | ||
|
||
public void OnMainFormChanged() | ||
{ | ||
//mux.Application.Current..MainWindow = Widget.MainForm.ToNative(); | ||
} | ||
public void OnMainFormChanged() | ||
{ | ||
//mux.Application.Current..MainWindow = Widget.MainForm.ToNative(); | ||
} | ||
|
||
public void Open(string url) | ||
{ | ||
Process.Start(new ProcessStartInfo(url) { UseShellExecute = true }); | ||
} | ||
public void Open(string url) | ||
{ | ||
Process.Start(new ProcessStartInfo(url) { UseShellExecute = true }); | ||
} | ||
|
||
public void Quit() | ||
{ | ||
Control.Exit(); | ||
} | ||
public void Quit() | ||
{ | ||
Control.Exit(); | ||
} | ||
|
||
public void Restart() | ||
{ | ||
} | ||
public void Restart() | ||
{ | ||
} | ||
|
||
public void Run() | ||
{ | ||
Callback.OnInitialized(Widget, EventArgs.Empty); | ||
} | ||
public void Run() | ||
{ | ||
Callback.OnInitialized(Widget, EventArgs.Empty); | ||
} | ||
|
||
public void RunIteration() | ||
{ | ||
//var frame = new DispatcherFrame(); | ||
//Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(ExitFrame), frame); | ||
//Dispatcher.PushFrame(frame); | ||
//WpfFrameworkElementHelper.ShouldCaptureMouse = false; | ||
} | ||
public void RunIteration() | ||
{ | ||
//var frame = new DispatcherFrame(); | ||
//Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(ExitFrame), frame); | ||
//Dispatcher.PushFrame(frame); | ||
//WpfFrameworkElementHelper.ShouldCaptureMouse = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using mui = Microsoft.UI.Xaml; | ||
|
||
namespace Eto.WinUI.Forms; | ||
|
||
public class FormHandler : WinUIWindow<mui.Window, Form, Form.ICallback>, Form.IHandler | ||
{ | ||
protected override mui.Window CreateControl() => new mui.Window(); | ||
|
||
public bool ShowActivated { get; set; } | ||
public bool CanFocus { get; set; } | ||
|
||
public void Show() | ||
{ | ||
//Control.CoreWindow.Di = Windows.UI.Core.CoreWindowActivationMode.ActivatedNotForeground; | ||
Control.Activate(); | ||
} | ||
} |
Oops, something went wrong.