示例#1
0
        private static async Task Remap()
        {
            var gui = new MessageBox("Window Docker", "Press any keyboard key to remap window docker to Win + [that key]");
            await gui.LaunchAndWait();

            gui.Window.SetAlwaysOnTop(true);
            gui.Window.MoveTop();

            key = (await KeyHandler.WaitKey(Filter)).Result.Key;
            gui.Close();
            File.WriteAllText(keyfile, ((int)key).ToString());

            h.Remove();
            CreateMainHotkey();

            GuiTool.Message("Remap succesful");

            bool Filter(Key k, bool state)
            {
                if (!state)
                {
                    return(false);
                }
                if (k.IsKeyboard())
                {
                    return(true);
                }
                return(false);
            }
        }
示例#2
0
        public override void Create()
        {
            LoadKey();

            Hotkey(Win(Key.Backspace), async a => {
                GuiTool.Message("WinDocker closing...");
                await Task.Delay(1000);
                Environment.Exit(0);
            });
            Hotkey(Win(Key.D0), async a => await Remap());

            CreateMainHotkey();
        }
示例#3
0
 /// <summary>Causes an immediate notification if an exception occurs within the task</summary>
 public static void Throw(this Task task)
 {
     task.ContinueWith(t => {
         GuiTool.Message("Unhandled Task Exception", t.Exception.Flatten().ToString());
     }, TaskContinuationOptions.OnlyOnFaulted);
 }