Пример #1
0
        private static void HandleUpdate(ClipboardData data)
        {
            if (data.IsEmpty)
            {
                return;
            }

            if (SameAsLast(data))
            {
                return;
            }

            if (IsEnabled)
            {
                if (Time.Now <= lastUpdate + updateTimeout)
                {
                    History[0] = data;
                }
                else
                {
                    History.Push(data);
                    GuiTool.Tooltip("saved", 500);
                }

                lastUpdate = Time.Now;
            }
        }
Пример #2
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);
            }
        }
Пример #3
0
 public static void Notification(string text)
 {
     if (!notifications)
     {
         return;
     }
     GuiTool.Notification("Window Docker", text);
 }
Пример #4
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();
        }
Пример #5
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);
 }