Exemplo n.º 1
0
        public void Drop(IDropInfo drop_info)
        {
            ILayout source;

            if (drop_info.Data is ProgramLayoutViewModel)
            {
                source = (drop_info.Data as ProgramLayoutViewModel).AssociatedObject;
            }
            else if (drop_info.Data is IconLayoutViewModel)
            {
                source = (drop_info.Data as IconLayoutViewModel).AssociatedObject;
            }
            else
            {
                throw new Exception();
            }

            application_settings.Move(source, drop_info.InsertIndex);

            if (drop_info.Data is ProgramLayoutViewModel)
            {
                CurrentLayout = Layouts.OfType <ProgramLayoutViewModel>().Single(l => l.AssociatedObject == source);
            }
            else if (drop_info.Data is IconLayoutViewModel)
            {
                CurrentLayout = Layouts.OfType <IconLayoutViewModel>().Single(l => l.AssociatedObject == source);
            }
        }