Example #1
0
        private void GroupExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            var items = from item in this.SelectionService.CurrentSelection.OfType <DesktopElement>()
                        select item;

            ShortcutGroupElement   group = new ShortcutGroupElement();
            ShortcutGroupViewModel vm    = new ShortcutGroupViewModel();
            Point position = items.First().GetPosition();

            foreach (DesktopElement item in items)
            {
                vm.Shortcuts.Add(item.DataContext as IShortcutViewModel);

                this.RemoveElement(item);
            }

            group.DataContext = vm;

            this.SelectionService.ClearSelection();

            this.InvokeAsynchronouslyInBackground
            (
                () =>
            {
                this.AddElement(group, position);
            }
            );
        }
Example #2
0
        private void GroupExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            var items = from item in this.SelectionService.CurrentSelection.OfType<DesktopElement>()
                        select item;

            ShortcutGroupElement    group       = new ShortcutGroupElement();
            ShortcutGroupViewModel  vm          = new ShortcutGroupViewModel();
            Point                   position    = items.First().GetPosition();

            foreach (DesktopElement item in items)
            {
                vm.Shortcuts.Add(item.DataContext as IShortcutViewModel);

                this.RemoveElement(item);
            }

            group.DataContext = vm;

            this.SelectionService.ClearSelection();

            this.InvokeAsynchronouslyInBackground
            (
                () =>
                {
                    this.AddElement(group, position);
                }
            );
        }