private void Input_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Tab) { ParamsPopup.IsOpen = !ParamsPopup.IsOpen; ParamsPopup.Width = Width; ParamsBox.Text = ""; if (ParamsPopup.IsOpen == true) { Dispatcher.BeginInvoke(DispatcherPriority.Input, new Action(delegate() { ParamsBox.Focus(); // Set Logical Focus Keyboard.Focus(ParamsBox); // Set Keyboard Focus })); } else { Dispatcher.BeginInvoke(DispatcherPriority.Input, new Action(delegate() { Input.Focus(); // Set Logical Focus Keyboard.Focus(Input); // Set Keyboard Focus })); } } if (e.Key == Key.Enter) { textEntered = Input.Text.ToLower(); args = ParamsBox.Text; bool inputHandled = false; foreach (IPlugin plugin in plugins) { try { inputHandled = plugin.CommandEntered(textEntered, ParamsBox.Text); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } } if (inputHandled == true) { return; } Process process = new Process(); ProcessStartInfo processStartInfo = new ProcessStartInfo(); foreach (Alias _alias in aliases) { //MessageBox.Show(_alias.alias + " " +_alias.full_path); if (textEntered == _alias.alias.ToLower()) { textEntered = _alias.full_path; if (args == "") { args = _alias.parameters; } break; } else if (textEntered.StartsWith(_alias.alias.ToLower() + "/")) { string sub = textEntered.Substring(textEntered.IndexOf('/')); textEntered = _alias.full_path + sub.Trim('/'); break; } } processStartInfo.FileName = textEntered; processStartInfo.UseShellExecute = true; processStartInfo.Arguments = args; processStartInfo.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) { processStartInfo.Verb = "runas"; } //processStartInfo.Arguments = "/c " + textEntered; process.StartInfo = processStartInfo; Visibility = Visibility.Hidden; try { process.Start(); ParamsPopup.IsOpen = false; ParamsBox.Text = ""; } catch (Exception ex) { //MessageBox.Show(textEntered); MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); Visibility = Visibility.Visible; Activate(); Input.Focus(); } } if (e.Key == Key.F5) { Reload(); MessageBox.Show("Refreshed Application List", "Refreshed", MessageBoxButton.OK, MessageBoxImage.Information); } }
private void OnSetStatusChanged(object ob) { ParamsBox box = (ParamsBox)ob; LocalDataBase.SetStatus(box.CurrentEntery, box.NewStatus); }