Esempio n. 1
0
 protected override void OnKeyDown(KeyEventArgs e)
 {
     base.OnKeyDown(e);
     switch (e.KeyCode)
     {
         case Keys.Up:
             switch (e.Modifiers)
             {
                 case Keys.None:
                     moveListViewIndex(-1);
                     e.Handled = true;
                     return;
                 case Keys.Control:
                     moveCboIndex(cboGrupp, -1);
                     e.Handled = true;
                     return;
             }
             break;
         case Keys.Down:
             switch (e.Modifiers)
             {
                 case Keys.None:
                     moveListViewIndex(1);
                     e.Handled = true;
                     return;
                 case Keys.Control:
                     moveCboIndex(cboGrupp, 1);
                     e.Handled = true;
                     return;
             }
             break;
         case Keys.Left:
             if (Photomic.Common.Util.findFocusedControl(this) is TextBox)
                 return;
             switch (e.Modifiers)
             {
                 case Keys.None:
                     if (getThumbnails() == null)
                         return;
                     getThumbnails().moveKeyboardFocus(-1);
                     var tn = getThumbnails().KeyboardFocus;
                     if (tn != null)
                         thumbnailClicked(tn, false);
                     e.Handled = true;
                     return;
             }
             break;
         case Keys.Right:
             if (Photomic.Common.Util.findFocusedControl(this) is TextBox)
                 return;
             switch (e.Modifiers)
             {
                 case Keys.None:
                     if (getThumbnails() == null)
                         return;
                     getThumbnails().moveKeyboardFocus(1);
                     var tn = getThumbnails().KeyboardFocus;
                     if (tn != null)
                         thumbnailClicked(tn, false);
                     e.Handled = true;
                     return;
             }
             break;
         case Keys.Insert:
             switch (e.Modifiers)
             {
                 case Keys.None:
                     läggTillPerson();
                     return;
             }
             break;
         case Keys.F2:
             switch (e.Modifiers)
             {
                 case Keys.None:
                     namngePerson();
                     return;
                 case Keys.Control:
                     if (lv.SelectedItems.Count == 1)
                     {
                         var person = (PlataDM.Person) lv.SelectedItems[0].Tag;
                         var strTemp = person.Förnamn;
                         person.Förnamn = person.Efternamn;
                         person.Efternamn = strTemp;
                         updateLV(null);
                     }
                     return;
             }
             break;
         case Keys.F5:
             switch (e.Modifiers)
             {
                 case Keys.None:
                     visaFullskärm(SelectedThumbnailKey);
                     return;
                 case Keys.Control:
                     {
                         if (getThumbnails() == null)
                             return;
                         var tn = getThumbnails()[SelectedThumbnailKey];
                         if (tn != null)
                             using (var dlg = new FKollaSkarpa(tn))
                                 dlg.ShowDialog(this);
                         return;
                     }
             }
             break;
         case Keys.F12:
             if (e.Modifiers == Keys.Control)
                 tmrAuto.Enabled = !tmrAuto.Enabled;
             break;
     }
 }
Esempio n. 2
0
        private bool handleKeys(Keys key)
        {
            switch ( key )
            {
                case Keys.Left:
                    _tns.moveKeyboardFocus( -1 );
                    break;
                case Keys.Right:
                    _tns.moveKeyboardFocus( 1 );
                    break;
                case Keys.Up:
                    _tns.moveKeyboardFocus( -Math.Max(-1,_tns.ImagesOnOneRow) );
                    break;
                case Keys.Down:
                    _tns.moveKeyboardFocus( Math.Max(1,_tns.ImagesOnOneRow) );
                    break;
                case Keys.F4:
                    _fRitaSiffror ^= true;
                    Invalidate();
                    return false;
                case Keys.F5:
                    if ( ModifierKeys==Keys.Control && _tn != null )
                        using ( var dlg = new FKollaSkarpa( _tn ) )
                            dlg.ShowDialog(this);
                    break;
                case Keys.Escape:
                    this.DialogResult = DialogResult.Cancel;
                    return true;
                case Keys.Enter:
                    this.DialogResult = DialogResult.OK;
                    return true;
                default:
                    return false;
            }

            _tn = _tns.KeyboardFocus;
            Invalidate( _rectFreeForThumbs );
            timer1.Enabled = false;
            timer1.Enabled = true;
            return true;
        }