Exemplo n.º 1
0
        void HandleSearchEntryKeyPressed(object sender, KeyPressEventArgs e)
        {
            if (PerformCommand != null)
            {
                bool cmdPressed = (e.Event.State & Gdk.ModifierType.Mod2Mask) != 0;
                SearchPopupCommand command;

                switch ((Gdk.Key)e.Event.KeyValue)
                {
                case Gdk.Key.Down:
                case Gdk.Key.downarrow:
                    if (cmdPressed)
                    {
                        goto case Gdk.Key.Page_Down;
                    }

                    command = SearchPopupCommand.NextItem;
                    break;

                case Gdk.Key.Up:
                case Gdk.Key.uparrow:
                    if (cmdPressed)
                    {
                        goto case Gdk.Key.Page_Up;
                    }

                    command = SearchPopupCommand.PreviousItem;
                    break;

                case Gdk.Key.KP_Page_Down:
                case Gdk.Key.Page_Down:
                    command = SearchPopupCommand.NextCategory;
                    break;

                case Gdk.Key.KP_Page_Up:
                case Gdk.Key.Page_Up:
                    command = SearchPopupCommand.PreviousCategory;
                    break;

                case Gdk.Key.Escape:
                    command = SearchPopupCommand.Cancel;
                    break;

                case Gdk.Key.Return:
                case Gdk.Key.KP_Enter:
                    command = SearchPopupCommand.Activate;
                    break;

                default:
                    return;
                }

                var kargs = new SearchEntryCommandArgs(command);
                PerformCommand?.Invoke(sender, kargs);
                e.RetVal = kargs.Handled;
            }
        }
Exemplo n.º 2
0
 void AttachToolbarEvents(SearchBar bar)
 {
     bar.PerformCommand += (o, e) => {
         PerformCommand?.Invoke(o, e);
     };
     bar.KeyPressed += (o, e) => {
         SearchEntryChanged?.Invoke(o, e);
     };
     bar.LostFocus += (o, e) => {
         SearchEntryLostFocus?.Invoke(o, e);
     };
     bar.SelectionActivated += (o, e) => {
         SearchEntryActivated?.Invoke(o, e);
     };
     bar.LostFocus += (sender, e) => {
         exitAction?.Invoke(Gtk.DirectionType.TabForward);
     };
 }
Exemplo n.º 3
0
 public LogInViewModel()
 {
     Voter        = new Voter();
     LogInCommand = new PerformCommand(LogIn);
 }
Exemplo n.º 4
0
 public void PerformComposistion(PerformCommand command)
 {
     throw new NotImplementedException();
 }