示例#1
0
        private void OnRowDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var row     = sender as GridViewRow;
            var details = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;

            if (details == null || row == null)
            {
                return;
            }

            details.CurrentDraggedOverItem = row.DataContext;

            if (details.CurrentDraggedItem == details.CurrentDraggedOverItem)
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
                return;
            }

            details.CurrentDropPosition = GetDropPositionFromPoint(e.GetPosition(row), row);
            int dropIndex       = (this.AssociatedObject.Items as IList).IndexOf(row.DataContext);
            int draggedItemIdex = (this.AssociatedObject.Items as IList).IndexOf(DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedItem"));

            if (dropIndex >= row.GridViewDataControl.Items.Count - 1 && details.CurrentDropPosition == DropPosition.After)
            {
                details.DropIndex = dropIndex;
                return;
            }

            dropIndex         = draggedItemIdex > dropIndex ? dropIndex : dropIndex - 1;
            details.DropIndex = details.CurrentDropPosition == DropPosition.Before ? dropIndex : dropIndex + 1;
        }
示例#2
0
        private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var draggedItem = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedItem");
            var details     = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;

            if (details == null || draggedItem == null)
            {
                return;
            }

            if (e.Effects == DragDropEffects.Move || e.Effects == DragDropEffects.All)
            {
                ((sender as RadGridView).ItemsSource as IList).Remove(draggedItem);
            }

            if (e.Effects != DragDropEffects.None)
            {
                var collection = (sender as RadGridView).ItemsSource as IList;
                int index      = details.DropIndex < 0 ? 0 : details.DropIndex;
                index = details.DropIndex > collection.Count - 1 ? collection.Count : index;

                collection.Insert(index, draggedItem);
            }

            HideDropPositionFeedbackPresenter();
        }
示例#3
0
        private void OnDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            object sourceItem = DragDropPayloadManager.GetDataFromObject(e.Data, __dragSource);

            TreeListViewRow      destinationRow  = (e.OriginalSource as TreeListViewRow) ?? (e.OriginalSource as FrameworkElement).ParentOfType <TreeListViewRow>();
            GridViewScrollViewer destinationTree = (e.OriginalSource as GridViewScrollViewer) ?? (e.OriginalSource as FrameworkElement).ParentOfType <GridViewScrollViewer>();

            if (destinationRow != null && destinationRow.Item != sourceItem)
            {
                e.Effects = !IsChildOf(destinationRow, sourceItem) ? DragDropEffects.Move : DragDropEffects.None;
                if (e.Effects == DragDropEffects.Move)
                {
                    DragDropPayloadManager.SetData(e.Data, __dragTarget, destinationRow.Item);
                }
            }
            else if (destinationTree != null)
            {
                DragDropPayloadManager.SetData(e.Data, __dragTarget, string.Empty);
            }
            else
            {
                e.Effects = DragDropEffects.None;
            }

            e.Handled = true;
        }
        private static void TrayDropped(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            RadToolBarTray destinationTray = sender as RadToolBarTray;
            DragDropInfo   info            = GetDragDropInfo(e.Data);

            if (destinationTray == null || info == null)
            {
                return;
            }

            var positionInfo = BandsUtilities.CalculateToolBarPositionInfo(info.ToolBar, destinationTray, e.GetPosition(destinationTray));

            if (!destinationTray.Items.Contains(info.ToolBar))
            {
                MoveToolBarToTray(info, destinationTray);
            }

            bool allowNewBandCreation = GetNewBandMode(destinationTray) != NewBandMode.None;

            BandsUtilities.UpdateToolBarPosition(destinationTray, info.ToolBar, positionInfo, allowNewBandCreation);

            ClearHitTesting(destinationTray.Items);
            HideNewBandIndicator(destinationTray);

            e.Handled = true;
        }
示例#5
0
        private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var data = (IList)DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");

            if (data == null)
            {
                return;
            }
            if (e.Effects != DragDropEffects.None)
            {
                var destinationItem = (e.OriginalSource as FrameworkElement).ParentOfType <RadTreeViewItem>();
                var dropDetails     = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;

                if (destinationItems != null)
                {
                    var backup = new Backup();
                    for (int i = 0; i < dropDetails.CurrentDraggedItem.Count; i++)
                    {
                        var    source     = (dropDetails.CurrentDraggedItem[i] as ProductViewModel);
                        var    dest       = (dropDetails.CurrentDraggedOverItem as ProductViewModel);
                        string sourcePath = System.IO.Path.GetDirectoryName(source.FullPath);
                        if (destinationItems.Count == 0)
                        {
                            RadTreeView_LoadOnDemand(null, e);
                        }
                        backup.CopyFile(sourcePath, dest.FullPath, source.Name);
                        int dropIndex = dropDetails.DropIndex >= destinationItems.Count ? destinationItems.Count : dropDetails.DropIndex < 0 ? 0 : dropDetails.DropIndex;
                        this.destinationItems.Insert(dropIndex, data[i]);
                    }
                }
            }
        }
示例#6
0
        private void OnApplicationTreeDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;

            if (options == null)
            {
                return;
            }

            // The condition after the first OR operator is needed to deny the drop of items in Application File. (sub-items)
            RadTreeViewItem dropTargetItem = options.DropTargetItem;

            var draggedItem = options.DraggedItems.First();

            if (dropTargetItem == null ||
                (dropTargetItem != null &&
                 options.DropTargetItem.DataContext is Resource &&
                 options.DropPosition == DropPosition.Inside) ||
                draggedItem is PartitionViewModel)
            {
                options.DropAction = DropAction.None;
            }

            options.UpdateDragVisual();
        }
示例#7
0
        private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            TreeViewDragDropOptions options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;

            if (options == null)
            {
                return;
            }
            var draggedItem = options.DraggedItems.Cast <ProductViewModel>().ToList();

            if (draggedItem == null)
            {
                return;
            }

            if (e.Effects != DragDropEffects.None)
            {
                var collection = (sender as System.Windows.Controls.ListBox).ItemsSource as IList;
                foreach (var s in draggedItem)
                {
                    collection.Add(s);
                }
            }

            e.Handled = true;
        }
        private void OnDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            TreeViewDragDropOptions options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;

            if (options == null)
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
                return;
            }
            var draggedItem = options.DraggedItems.FirstOrDefault();
            var itemsType   = (this.AssociatedObject.ItemsSource as IList).AsQueryable().ElementType;


            if (draggedItem.GetType() != itemsType)
            {
                e.Effects = DragDropEffects.None;
            }
            else
            {
                (options.DragVisual as TreeViewDragVisual).IsDropPossible = true;
                options.DropAction = DropAction.Move;
                options.UpdateDragVisual();
            }
            e.Handled = true;
        }
        private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            EstimateDetails draggedItem = (EstimateDetails)DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
            var             details     = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;
            var             currentRow  = e.OriginalSource as GridViewRow ?? (e.OriginalSource as FrameworkElement).ParentOfType <GridViewRow>();
            EstimateDetails targetItem  = currentRow != null ? (EstimateDetails)currentRow.Item : null;

            if (details == null || draggedItem == null || currentRow == null || targetItem == null)
            {
                return;
            }

            var draggedItemAreaId = draggedItem.NonstandardCategoryID > 0 ? draggedItem.NonstandardCategoryID : draggedItem.AreaId;
            var targetItemAreaId  = targetItem.NonstandardCategoryID > 0 ? targetItem.NonstandardCategoryID : targetItem.AreaId;

            if ((draggedItemAreaId == targetItemAreaId) &&
                (draggedItem.EstimateRevisionDetailsId != targetItem.EstimateRevisionDetailsId))
            {
                var collection = (sender as RadGridView).ItemsSource as IList;
                collection.Remove(draggedItem);
                collection.Insert((sender as RadGridView).Items.IndexOf(currentRow.Item), draggedItem);

                RetailSystemClient mrsClient = new RetailSystemClient();
                mrsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(Internal.Utilities.GetMetriconRetailSystemWcfClientEndpointUrl());
                mrsClient.MoveEstimateDetailItemCompleted += new EventHandler <MoveEstimateDetailItemCompletedEventArgs>(mrsClient_MoveEstimateDetailItemCompleted);
                mrsClient.MoveEstimateDetailItemAsync(draggedItem.EstimateRevisionDetailsId, targetItem.EstimateRevisionDetailsId, (App.Current as App).CurrentUserId);
            }
            else
            {
            }

            e.Handled = true;
        }
        private void OnDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var position = e.GetPosition(sender as Canvas);

            Canvas.SetTop(this.draggedImage, position.Y - this.relativeStartPoint.Y);
            Canvas.SetLeft(this.draggedImage, position.X - this.relativeStartPoint.X);
        }
示例#11
0
 private void OnDropCompleted(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
 {
     if (this.DraggingCandidate != null && this.MaximizedItem != null)
     {
         this.FinishDrag();
         e.Handled = true;
     }
 }
示例#12
0
        private void OnDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            Point mousepos = e.GetPosition(this.syntaxEditor.EditorPresenter);

            dropPos = this.syntaxEditor.EditorPresenter.GetPositionFromViewPoint(mousepos);
            this.syntaxEditor.CaretPosition.MoveToPosition(dropPos);
            this.syntaxEditor.Focus();
        }
示例#13
0
        private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var data = DragDropPayloadManager.GetDataFromObject(e.Data, typeof(string).FullName);

            ((IList)(sender as RadListBox).ItemsSource).Add(data);
            DragDropPayloadManager.SetData(e.Data, "IsDropSuccessful", true);
            e.Handled = true;
        }
 private void OnDragOver(object sender, DragEventArgs e)
 {
     if (!e.Handled)
     {
         e.Effects = DragDropEffects.None;
         e.Handled = true;
     }
 }
        private void OnDrop(object sender, DragEventArgs e)
        {
            e.Handled = true;
            FadeOut((FrameworkElement)e.Source);

            var mainViewModel = DataContext as MainViewModel;
            if (mainViewModel == null)
            {
                return;
            }

            var sourceElement = e.Source as FrameworkElement;
            if (sourceElement == null)
            {
                return;
            }

            var destination = sourceElement.DataContext as IDashboardPage;
            if (destination == null)
            {
                return;
            }

            var data = DragDropPayloadManager.GetDataFromObject(e.Data, "DragData") as DragDropParameter;

            if (data != null && data.DraggedItem is NavigationItemInfo)
            {
                //proportional
                var grid = Parent as Grid;
                if (grid != null)
                {
                    var parent = grid.Parent as Grid;
                    if (parent != null)
                    {
                        var main = VisualTreeHelper.GetParent(parent) as MainMenuMetroView;
                        if (main != null)
                        {
                            var ph = main.ActualHeight;
                            var pw = main.ActualWidth;

                            var ch = e.GetPosition(sourceElement).Y;
                            var cw = e.GetPosition(sourceElement).X;

                            var cprocentH = ch * 100 / sourceElement.ActualHeight;
                            var cprocentW = cw * 100 / sourceElement.ActualWidth;

                            var parentH = cprocentH * ph / 100;
                            var parentW = cprocentW * pw / 100;

                            var parameter = new DragDropParameter { DraggedItem = data.DraggedItem, Location = new Point(parentW, parentH) };

                            mainViewModel.IsMenuShown = false;
                            mainViewModel.DashboardVM.Value.AddGadgetToExecute(destination, parameter);
                        }
                    }
                }
            }
        }
        private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var text = DragDropPayloadManager.GetDataFromObject(e.Data, "Text") as string;

            if (text != null)
            {
                (sender as TextBox).Text += text;
            }
        }
        private void OnItemDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var item = (e.OriginalSource as FrameworkElement).ParentOfType <RadTreeViewItem>();

            if (item == null)
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
                return;
            }
            var position = GetPosition(item, e.GetPosition(item));

            if (item.Level == 0 && position != DropPosition.Inside)
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
                return;
            }
            RadTreeView tree        = sender as RadTreeView;
            var         draggedData = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
            var         dropDetails = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;

            if ((draggedData == null && dropDetails == null))
            {
                return;
            }
            if (position != DropPosition.Inside)
            {
                e.Effects = DragDropEffects.All;
                dropDetails.IsValidDrop = true;
                destinationItems        = item.Level > 0 ? (IList)item.ParentItem.ItemsSource : (IList)tree.ItemsSource;
                int index = destinationItems.IndexOf(item.Item);
                dropDetails.DropIndex = position == DropPosition.Before ? index : index + 1;
            }
            else
            {
                destinationItems = (IList)item.ItemsSource;
                int index = 0;

                if (destinationItems == null)
                {
                    e.Effects = DragDropEffects.None;
                    dropDetails.IsValidDrop = false;
                }
                else
                {
                    e.Effects               = DragDropEffects.All;
                    dropDetails.DropIndex   = index;
                    dropDetails.IsValidDrop = true;
                }
            }

            dropDetails.CurrentDraggedOverItem = item.Item;
            dropDetails.CurrentDropPosition    = position;

            e.Handled = true;
        }
示例#18
0
        private void OnDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;

            if (options.DropPosition != Telerik.Windows.Controls.DropPosition.Inside)
            {
                options.DropPosition = Telerik.Windows.Controls.DropPosition.Inside;
                options.UpdateDragVisual();
            }
        }
        private void DropHandler(object sender, DragEventArgs e)
        {
            //todo
            //var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;
            //if (options != null)
            //{
            //    options.DropAction = DropAction.None;
            //}

            //e.Handled = true;
        }
示例#20
0
        // Forbids the local machine tree view to drop anything
        private void OnLocalMachineTreeDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;

            if (options != null)
            {
                options.DropAction = DropAction.None;
                options.UpdateDragVisual();

                e.Handled = true;
            }
        }
        private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var text    = DragDropPayloadManager.GetDataFromObject(e.Data, "Text") as string;
            var listBox = sender as ListBox;

            if (text != null && listBox != null)
            {
                (listBox.ItemsSource as IList).Add(new MyObject()
                {
                    ID = ListBoxDragDropBehavior.lastAdded++, Name = text
                });
            }
        }
        private static void TrayDragLeft(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            RadToolBarTray tray = sender as RadToolBarTray;
            DragDropInfo   info = GetDragDropInfo(e.Data);

            if (tray == null || info == null)
            {
                return;
            }

            ClearHitTesting(tray.Items);
            HideNewBandIndicator(tray);
        }
        //TODO: fix hard code
        private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            if (e.Data != null && e.AllowedEffects != DragDropEffects.None)
            {
                var             treeListViewName = (sender as RadTreeListView).Name;
                TreeListViewRow destination      = e.OriginalSource as TreeListViewRow ?? (e.OriginalSource as FrameworkElement).ParentOfType <TreeListViewRow>();
                switch (treeListViewName)
                {
                case "ObjectTreeListView":
                    ObjectViewModelLocator.GetObjectVM().MoveSelection(destination);
                    break;

                case "TemplateTreeListView":
                    TemplateViewModelLocator.GetTemplateVM().MoveSelection(destination);
                    break;

                case "PropertyTreeListView":
                    PropertyViewModelLocator.GetPropertyVM().MoveSelection(destination);
                    break;

                case "ObjectAssociationTreeListView":
                    ObjectAssociationViewModel objectAssociationViewModel = ObjectAssociationViewModelLocator.GetObjectAssociationVM();
                    objectAssociationViewModel.AssociateWithObject(destination);
                    objectAssociationViewModel.FilteredObjectAssociations.View.Refresh();
                    break;

                case "ObjectRequirementTreeListView":
                    ObjectRequirementViewModel objectRequirementViewModel = ObjectRequirementViewModelLocator.GetObjectRequirementVM();
                    objectRequirementViewModel.AssociateWithObject(destination);
                    objectRequirementViewModel.FilteredObjectRequirements.View.Refresh();
                    break;

                case "TemplateAssociationTreeListView":
                    TemplateAssociationViewModel templateAssociationViewModel = TemplateAssociationViewModelLocator.GetTemplateAssociationVM();
                    templateAssociationViewModel.AssociateWithTemplate(destination);
                    templateAssociationViewModel.FilteredTemplateAssociations.View.Refresh();
                    break;

                case "TemplateRequirementTreeListView":
                    TemplateRequirementViewModel templateRequirementViewModel = TemplateRequirementViewModelLocator.GetTemplateRequirementVM();
                    templateRequirementViewModel.AssociateWithTemplate(destination);
                    templateRequirementViewModel.FilteredTemplateRequirements.View.Refresh();
                    break;

                case "RequirementTreeListView":
                    RequirementViewModelLocator.GetRequirementVM().MoveSelection(destination);
                    break;
                }
            }
        }
示例#24
0
 private void OnDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs args)
 {
     if (this.DraggingCandidate != null && this.MaximizedItem != null)
     {
         this.previousPosition = args.GetPosition(Window.GetWindow(this));
         var currentMousePosition = previousPosition;
         if (this == sender && this.DraggingCandidate != null &&
             this.lastMousePosition != currentMousePosition)
         {
             this.DragTiles(args, currentMousePosition);
             args.Handled = true;
         }
     }
 }
示例#25
0
        private void OnDragOverTree(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var options = DragDropPayloadManager.GetDataFromObject(e.Data, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;

            if (options != null && options.DropPosition == Telerik.Windows.Controls.DropPosition.Inside && options.DropTargetItem != null && options.DropTargetItem.Item is Division)
            {
                options.DropAction = DropAction.None;
                var dragVisual = options.DragVisual as TreeViewDragVisual;
                if (dragVisual != null)
                {
                    dragVisual.IsDropPossible = false;
                    dragVisual.DropActionText = "Cannot drop into ";
                }
            }
        }
        private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var item    = e.OriginalSource as RadListBoxItem ?? (e.OriginalSource as FrameworkElement).ParentOfType <RadListBoxItem>();
            var listBox = sender as RadListBox;

            if (item != null && listBox != null)
            {
                var targetColumn  = item.DataContext as GridViewColumn;
                var draggedColumn = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedColumn") as GridViewDataColumn;

                draggedColumn.DisplayIndex = targetColumn.DisplayIndex;

                RebindListBox();
            }
        }
示例#27
0
        private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs args)
        {
            var data = ((DataObject)args.Data).GetData("DragData");

            var param = new DragDropParameter
            {
                DraggedItem = data,
                ItemsSource = this.AssociatedObject.ItemsSource
            };

            if (this.DropCommand != null && this.DropCommand.CanExecute(param))
            {
                this.DropCommand.Execute(param);
            }
        }
示例#28
0
        private void OnDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var formats = DragDropPayloadManager.GetFormats(e.Data, true);

            if (formats.Contains(typeof(string).FullName))
            {
                e.Effects = DragDropEffects.Move;
            }
            else
            {
                e.Effects = DragDropEffects.None;
            }

            e.Handled = true;
        }
        private static void TrayDraggedOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            RadToolBarTray tray = sender as RadToolBarTray;
            DragDropInfo   info = GetDragDropInfo(e.Data);

            if (tray == null || info == null)
            {
                return;
            }

            var  positionInfo         = BandsUtilities.CalculateToolBarPositionInfo(info.ToolBar, tray, e.GetPosition(tray));
            bool allowNewBandCreation = GetNewBandMode(tray) == NewBandMode.Live;

            BandsUtilities.UpdateToolBarPosition(tray, info.ToolBar, positionInfo, allowNewBandCreation);
            UpdateNewBandIndicator(info, positionInfo, tray);
        }
示例#30
0
        private void OnDragOver(object sender, DragEventArgs e)
        {
            var item = (e.OriginalSource as FrameworkElement).ParentOfType<RadTreeViewItem>();
            var dropDetails = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;

            var position = GetPosition();
            if (dropDetails != null && item != null)
            {
                var destinationItem = item.Item as BasicConfigDTO;
                if (destinationItem != null)
                    dropDetails.CurrentDraggedOverItem = destinationItem;
                else dropDetails.CurrentDraggedItem = item.Item as RadTreeView;
                dropDetails.CurrentDropPosition = DropIndicationDetails.ConverDropPositionToString(position);
            }
            e.Handled = true;
        }
示例#31
0
        private static void OnWindowDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            if (e.AllowedEffects != DragDropEffects.None)
            {
                var position = e.GetPosition(rootVisual) - EndPointOffset;
                arrowVisual.X2 = position.X;
                arrowVisual.Y2 = position.Y;
                arrowVisual.UpdateGeometry();

                if (!arrowContainer.IsOpen &&
                    GetDistance(arrowVisual.X1, arrowVisual.Y1, arrowVisual.X2, arrowVisual.Y2) >= dragStartThreshold)
                {
                    arrowContainer.IsOpen = true;
                }
            }
        }
示例#32
0
        private void OnDrop(object sender, DragEventArgs e)
        {
            var draggedItem = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
            var details = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;

            if (details == null || draggedItem == null)
            {
                return;
            }

            if (e.Effects != DragDropEffects.None)
            {
                var destinationSpecialConfig = (e.OriginalSource as FrameworkElement).ParentOfType<RadTreeViewItem>();
                var realDestinationSpecialConfig = new SpecialConfigDTO();
                if (destinationSpecialConfig != null)
                    realDestinationSpecialConfig = destinationSpecialConfig.DataContext as SpecialConfigDTO;
                var collection = (sender as RadTreeView).ItemsSource as ObservableCollection<SpecialConfigDTO>;
                var item = draggedItem as ItemDTO;
                if (item != null && collection != null && ViewModel.SelContractAircraft != null)
                {
                    var newSpecialConfig = new SpecialConfigDTO
                    {
                        Id = RandomHelper.Next(),
                        ItemId = item.Id,
                        ItemNo = item.ItemNo,
                        FiNumber = item.FiNumber,
                        ContractAircraftId = ViewModel.SelContractAircraft.Id,
                        StartDate = DateTime.Now,
                    };
                    if (realDestinationSpecialConfig != null && realDestinationSpecialConfig.Id != 0)
                    {
                        newSpecialConfig.ParentId = realDestinationSpecialConfig.Id;
                        newSpecialConfig.RootId = realDestinationSpecialConfig.RootId;

                        realDestinationSpecialConfig.SubSpecialConfigs.Add(newSpecialConfig);
                    }
                    else
                    {
                        newSpecialConfig.RootId = newSpecialConfig.Id;
                        ViewModel.ViewSpecialConfigs.Add(newSpecialConfig);
                    }
                    ViewModel.SpecialConfigs.AddNew(newSpecialConfig);
                }
            }

            e.Handled = true;
        }
        private void OnDragOver(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var draggedItem = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
            var itemsType   = (this.AssociatedObject.ItemsSource as IList).AsQueryable().ElementType;


            if (draggedItem.GetType() != itemsType)
            {
                e.Effects = DragDropEffects.None;
            }

            //var dropDetails = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;
            //dropDetails.CurrentDraggedOverItem = this.AssociatedObject;
            //dropDetails.CurrentDropPosition = Controls.DropPosition.Inside;

            e.Handled = true;
        }
        private void OnTimelineDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            var position        = e.GetPosition(this.timeline);
            var dataItem        = (ITimelineItem)DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedItem");
            var source          = (IList)this.timeline.ItemsSource;
            var itemIndex       = source.IndexOf(dataItem);
            var groupUnderMouse = GetGroupUnderMouse(position);
            var rowIndex        = GetRowUnderMouse(position, groupUnderMouse);

            source.Remove(dataItem);

            dataItem.GroupKey  = groupUnderMouse.Key;
            dataItem.RowIndex  = rowIndex;
            dataItem.StartDate = this.timeline.ConvertPointToDateTime(position);

            source.Insert(itemIndex, dataItem);
        }
示例#35
0
        private void OnDragOver(object sender, DragEventArgs e)
        {
            if (popup.IsOpen)
            {
                var item = DragDropPayloadManager.GetDataFromObject(e.Data, "DragData") as DragDropParameter;
                if (item != null)
                {
                    var distance = Distance(item.Location, e.GetPosition(this));
                    if (distance > 30)
                    {
                        popup.IsOpen = false;
                    }
                }
            }

            e.Effects = DragDropEffects.None;
            e.Handled = true;
        }
示例#36
0
        private void OnDragOver(object sender, DragEventArgs e)
        {
            var sourceElement = e.Source as FrameworkElement;
            if (sourceElement == null)
            {
                e.Effects = DragDropEffects.None;
                return;
            }

            var destination = sourceElement.DataContext as DashboardPageViewModel;
            var item = DragDropPayloadManager.GetDataFromObject(e.Data, "DragData") as DragDropParameter;

            if (destination == null || item == null)
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
                return;
            }

            e.Effects = DragDropEffects.None;
        }
示例#37
0
        private void OnDrop(object sender, DragEventArgs e)
        {
            object draggedItem = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
            var details = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;

            if (details == null || draggedItem == null)
            {
                return;
            }

            if (e.Effects != DragDropEffects.None)
            {
                var gridView = sender as RadGridView;
                if (gridView != null)
                {
                    var collection = gridView.ItemsSource as IList;
                    if (collection != null) collection.Add(draggedItem);
                }
            }

            e.Handled = true;
        }
示例#38
0
        private void OnDragOver(object sender, DragEventArgs e)
        {
            var gridView = sender as RadGridView;
            object draggedItem = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
            if (draggedItem == null || gridView == null) return;
            //Type itemsType = gridView.CurrentItem.GetType();

            //if (draggedItem.GetType() != itemsType)
            //{
            //    e.Effects = DragDropEffects.None;
            //}

            var dropDetails = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;
            if (dropDetails == null) return;
            dropDetails.CurrentDraggedOverItem = gridView;
            dropDetails.CurrentDropPosition = DropIndicationDetails.ConverDropPositionToString(DropPosition.Inside);

            e.Handled = true;
        }
示例#39
0
        private void OnDrop(object sender, DragEventArgs e)
        {
            const int gadgetSize = 400;
            var sourceElement = e.Source as FrameworkElement;
            if (sourceElement == null)
            {
                e.Effects = DragDropEffects.None;
                return;
            }

            var destination = sourceElement.DataContext as DashboardPageViewModel;

            var item = DragDropPayloadManager.GetDataFromObject(e.Data, "DragData") as DragDropParameter;

            var panel = e.Source as Panel;

            if (destination != null && item != null && panel != null)
            {
                //Get the spatial relation between the destination item and the vis. root:

                var child = (panel.Children)[0];
                var scroll = child as ScrollContentPresenter;
                var location = e.GetPosition(this);

                if (scroll == null)
                    return;

                if (scroll.HorizontalOffset == 0f && (location.X > scroll.ViewportWidth - gadgetSize))
                {
                    scroll.SetHorizontalOffset(gadgetSize);
                }
                else
                {
                    location.X += scroll.HorizontalOffset;

                    if (location.X > (scroll.ViewportWidth + scroll.HorizontalOffset - gadgetSize))
                    {
                        scroll.SetHorizontalOffset(scroll.HorizontalOffset + gadgetSize);
                    }
                }

                if (scroll.VerticalOffset == 0f && (location.Y > scroll.ViewportHeight - gadgetSize))
                {
                    scroll.SetVerticalOffset(gadgetSize);
                }
                else
                {
                    location.Y += scroll.VerticalOffset;

                    if (location.Y > (scroll.ViewportHeight + scroll.VerticalOffset - gadgetSize))
                    {
                        scroll.SetVerticalOffset(scroll.VerticalOffset + gadgetSize);
                    }
                }

                item.Location = location;
                destination.AddGadgetCommand.Execute(item);

                e.Handled = true;
            }
        }
示例#40
0
        private void OnDrop(object sender, DragEventArgs e)
        {
            var data = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
            if (data == null) return;
            if (e.Effects != DragDropEffects.None)
            {
                var destinationItem = (e.OriginalSource as FrameworkElement).ParentOfType<RadTreeViewItem>();
                var realDestinationItem = destinationItem.DataContext as ListBoxDocumentItem;
                var realDraggedData = data as ListBoxDocumentItem;
                if (realDraggedData != null &&
                    (realDestinationItem != null && realDestinationItem.DocumentPathId == realDraggedData.DocumentPathId))
                {
                    MessageDialogs.Alert("目标文件夹与源文件夹是同一个文件夹!");
                    _canRemove = false;
                    return;
                }
                var dropDetails =
                    DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;

                if (_destinationItems != null)
                {
                    foreach (var trigger in _destinationItems)
                    {
                        var temp = trigger as ListBoxDocumentItem;
                        var realData = data as ListBoxDocumentItem;
                        if (realData != null &&
                            (temp != null && temp.Name.Equals(realData.Name, StringComparison.OrdinalIgnoreCase)))
                        {
                            MessageDialogs.Alert("目标文件夹的子文件夹中已有同名文件夹!");
                            _canRemove = false;
                            return;
                        }
                    }
                    var dropIndex = dropDetails != null && dropDetails.DropIndex >= _destinationItems.Count
                        ? _destinationItems.Count
                        : dropDetails != null && dropDetails.DropIndex < 0 ? 0 : dropDetails.DropIndex;
                    _destinationItems.Insert(dropIndex, data);
                    _canRemove = true;
                }
            }
        }
        private void OnApprovalDetailDrop(object sender, DragEventArgs e)
        {
            var draggedItem = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
            var details = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;

            if (details == null || draggedItem == null)
            {
                return;
            }

            if (e.Effects != DragDropEffects.None)
            {
                if (draggedItem is PlanHistoryDTO)
                {
                    var planHistory = draggedItem as PlanHistoryDTO;
                    ViewModel.AddNewRequestDetail(planHistory);
                }
            }

            e.Handled = true;
        }
        private void OnApprovalDetailDragOver(object sender, DragEventArgs e)
        {
            var draggedItem = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
            if (draggedItem == null || PlanDetail == null) return;

            var dropDetails = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;
            if (dropDetails == null) return;
            dropDetails.CurrentDraggedOverItem = PlanDetail;
            dropDetails.CurrentDropPosition = DropIndicationDetails.ConverDropPositionToString(DropPosition.Inside);

            e.Handled = true;
        }
示例#43
0
        private void OnItemDragOver(object sender, DragEventArgs e)
        {
            var item = (e.OriginalSource as FrameworkElement).ParentOfType<RadTreeViewItem>();
            if (item == null)
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
                return;
            }
            var position = GetPosition(e.GetPosition(item));
            if (item.Level == 0 && position != DropPosition.Inside)
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
                return;
            }
            var tree = sender as RadTreeView;
            var draggedData = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
            var dropDetails = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;

            if ((draggedData == null && dropDetails == null))
            {
                return;
            }
            if (position != DropPosition.Inside)
            {
                e.Effects = DragDropEffects.All;

                if (tree != null)
                    _destinationItems = item.Level > 0 ? (IList) item.ParentItem.ItemsSource : (IList) tree.ItemsSource;
                var index = _destinationItems.IndexOf(item.Item);
                if (dropDetails != null) dropDetails.DropIndex = position == DropPosition.Before ? index : index + 1;
            }
            else
            {
                _destinationItems = (IList) item.ItemsSource;
                const int index = 0;

                if (_destinationItems == null)
                {
                    e.Effects = DragDropEffects.None;
                }
                else
                {
                    e.Effects = DragDropEffects.All;
                    if (dropDetails != null) dropDetails.DropIndex = index;
                }
            }

            if (dropDetails != null)
            {
                dropDetails.CurrentDraggedOverItem = item.Item;
                dropDetails.CurrentDropPosition = DropIndicationDetails.ConverDropPositionToString(position);
            }

            e.Handled = true;
        }
		private void OnElementDragDropCompleted(object sender, DragEventArgs e)
		{
			MindmapShapeBase newShape;
			if (this.DraggingCandidate is MindmapRootShape)
				newShape = new MindmapFirstLevelShape();
			else
				newShape = new MindmapOuterShape();

			this.AddShape(newShape, this.GetTransformedPoint(e.GetPosition(this)), true);
			this.AddConnection(new RadDiagramConnection
			{
				Source = this.DraggingCandidate,
				Target = newShape
			}, true);

			this.DraggingCandidate = null;
			e.Handled = true;
		}
示例#45
0
        private void OnPlanLayDrop(object sender, DragEventArgs e)
        {
            object draggedItem = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
            var details = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;

            if (details == null || draggedItem == null)
            {
                return;
            }

            if (e.Effects != DragDropEffects.None)
            {
                if (draggedItem is PlanAircraftDTO)
                {
                    var planAircraft = draggedItem as PlanAircraftDTO;
                    ViewModel.OpenEditDialog(planAircraft, PlanDetailCreateSource.PlanAircraft);
                }
                else if (draggedItem is AircraftDTO)
                {
                    var aircraft = draggedItem as AircraftDTO;
                    PlanAircraftDTO planAircraft =
                        ViewModel.AllPlanAircrafts.SourceCollection.Cast<PlanAircraftDTO>()
                            .Where(p => p.Id == aircraft.AircraftId)
                            .FirstOrDefault(pa => pa.IsOwn);
                    ViewModel.OpenEditDialog(planAircraft, PlanDetailCreateSource.Aircraft);
                }
            }

            e.Handled = true;
        }
示例#46
0
        private void OnEnRouteDrop(object sender, DragEventArgs e)
        {
            object draggedItem = DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
            var details = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;

            if (details == null || draggedItem == null)
            {
                return;
            }

            if (e.Effects != DragDropEffects.None)
            {
                if (draggedItem is RequestDTO)
                {
                    var request = draggedItem as RequestDTO;
                    ViewModel.RemoveRequest(request);
                }
            }

            e.Handled = true;
        }
 private void OnDragOver(object sender, DragEventArgs e)
 {
     e.Effects = DragDropEffects.Copy;
     FadeIn((FrameworkElement)e.Source);
     e.Handled = true;
 }
 private void OnDragLeave(object sender, DragEventArgs e)
 {
     FadeOut((FrameworkElement)e.Source);
 }