Beispiel #1
0
        private void Delete(object sender, RoutedEventArgs e)
        {
            var data = ExtractContextAndData(MenuAction.Edit);

            if (data.Count() > 0)
            {
                e.Handled = true;

                LibraryRequestHandler.Delete(data.Cast <Recording>());

                Rebuild();
            }
        }
Beispiel #2
0
        private void Tree_KeyDown(object sender, KeyEventArgs e)
        {
            if (sender is MultiSelectTreeView)
            {
                KeyboardActions action = TranslateKey(e.Key);

                if (action == KeyboardActions.None)
                {
                    //Do nothing
                    return;
                }

                e.Handled = true;


                foreach (LibraryViewModel model in GetSelectedItems(ViewMode.MAX))
                {
                    switch (action)
                    {
                    case KeyboardActions.WeightUp:
                        model.Weight = Math.Min(model.Weight + 0.05, 1.0);
                        break;

                    case KeyboardActions.WeightDown:
                        model.Weight = Math.Max(model.Weight - 0.05, 0.0);
                        break;

                    case KeyboardActions.Play:
                        //play thing
                        return;

                    case KeyboardActions.None:
                    default:
                        throw new Exception($"Unexpected KeyboardAction: {action}");
                    }
                }

                LibraryRequestHandler.DatabaseUpdated();
            }
        }