Exemplo n.º 1
0
        /// <summary>
        /// Add process to the list
        /// </summary>
        private void AddProcess()
        {
            string processName = this.ProcessToAdd;

            // Add process
            bool IsAdded = ProcessInfos.Add(this.ProcessToAdd, this.Processes);

            this.ProcessToAdd = string.Empty;

            // Show snackbar
            var messageQueue = _SnackbarAdd.MessageQueue;
            var message      = Application.Current.MainWindow.FindResource(IsAdded ? "ProcessAdded" : "ProcessDuplicate");

            message = message.ToString().Replace("{name}", processName);

            Task.Factory.StartNew(() => messageQueue.Enqueue(message));
        }
Exemplo n.º 2
0
        /// <summary>
        /// KeyDown event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        void KListener_KeyDown(object sender, RawKeyEventArgs args)
        {
            try
            {
                SetKeyDown(args.Key);

                // Ctrl + F11 (Action on foreground app)
                if (IsKeyDown(Key.LeftCtrl) && IsKeyDown(Key.F11))
                {
                    WindowHandler.ChangeBorderStyle(WindowLib.GetForegroundWindow());
                }
                // Ctrl + F12 (Adds / Removes foreground app to / from list)
                else if (IsKeyDown(Key.LeftCtrl) && IsKeyDown(Key.F12))
                {
                    ProcessInfos.AddOrRemove(this.Processes);
                }
            }
            catch { }
        }