Esempio n. 1
0
        public Synchronizer()
        {
            InitializeComponent();
            MaximizedBounds          = ClientRectangle;
            Worker.Collector         = getAllWindows;
            Worker.Stopped          += Worker_Stopped;
            Worker.Started          += Worker_Started;
            Worker.FailToStart      += Worker_FailToStart;
            Worker.WindowLost       += Worker_WindowLost;
            Worker.WorkingNotice    += Worker_WorkingNotice;
            Worker.SendKeyUpChanged += resetTips;
            Worker.AddSpecifyKey(Keys.Oemtilde);
            var yeller = new Yeller();

            yeller.Yelling += yellFree;
            Worker.Yellers.Add(yeller);
            Worker.Prepare();
        }
Esempio n. 2
0
        void yellFree(Yeller y, YellEventArgs e)
        {
            var i = e.Index;

            switch (i)
            {
            case Yeller.TERMINALED:
                resetTips();
                break;

            case Yeller.FINISHED:
                setTips("yeller");
                Handle.SwitchToThisWindow();
                break;

            default:
                tips.Text = $@"Type ""{(y.Text.Substring(0, i + 1) + y.Text.Substring(i + 1).ToLower())}"" to set this at top.";
                return;
            }
        }
Esempio n. 3
0
        public static void AddSpecifyKey(Keys startKey)
        {
            if (startKey == Keys.None)
            {
                specifier = null;
                return;
            }
            var s = Yellers.FirstOrDefault(y => y.Name == nameof(startKey));

            if (s != null)
            {
                if (s.IsYelling)
                {
                    return;
                }
                s.ShutUpKey = startKey;
                return;
            }
            specifier          = new Yeller(startKey);
            specifier.Name     = nameof(startKey);
            specifier.Yelling += (y, e) => {
                switch (e.Index)
                {
                case Yeller.STARTED:
                    y.Tag = new KeysQueue();
                    break;

                case Yeller.TERMINALED:
                    SpecifyFunction((KeysQueue)y.Tag);
                    y.Tag = null;
                    break;

                default:
                    var tag = (KeysQueue)y.Tag;
                    tag.Insert(e.Key);
                    y.Tag = tag;
                    return;
                }
            };
        }