Ejemplo n.º 1
0
        protected override void KeyDown(object sender, KeyboardKeyEventArgs e)
        {
            TableWidget table = (TableWidget)widgets[view.tableIndex];

            if (e.Key == Key.Enter)
            {
                string curServer = Get(view.hashIndex) ?? "";
                if (table.Count >= 1 && curServer == "")
                {
                    widgets[view.hashIndex].Text = table.Get(0).Hash;
                    ConnectToServer(0, 0);
                }
                else if (curServer != "" &&
                         (selectedWidget == null || selectedWidget == widgets[view.tableIndex]))
                {
                    ConnectToServer(0, 0);
                }
            }
            else if (e.Key == Key.Up)
            {
                table.SetSelected(table.SelectedIndex - 1);
                table.NeedRedraw();
            }
            else if (e.Key == Key.Down)
            {
                table.SetSelected(table.SelectedIndex + 1);
                table.NeedRedraw();
            }
            else
            {
                base.KeyDown(sender, e);
            }
        }