Ejemplo n.º 1
0
        private void ActivitiesListView_SameFrameItemDropped(object sender, EventArgs e)
        {
            object droppedItem = ((DragInfo)sender).Data as object;

            if (droppedItem != null)
            {
                if (droppedItem is Activity)
                {
                    Activity draggedActivity   = droppedItem as Activity;
                    Activity activityDroppedOn = DragDrop2.GetRepositoryItemHit(ListView) as Activity;

                    if (activityDroppedOn != null)
                    {
                        if (activityDroppedOn.ActivitiesGroupID != draggedActivity.ActivitiesGroupID)
                        {
                            //need to shift groups
                            try
                            {
                                mContext.BusinessFlow.MoveActivityBetweenGroups(draggedActivity, mContext.BusinessFlow.GetActivitiesGroupByName(activityDroppedOn.ActivitiesGroupID), mContext.BusinessFlow.Activities.IndexOf(activityDroppedOn));
                            }
                            catch (Exception ex)
                            {
                                Reporter.ToLog(eLogLevel.DEBUG, "Error occurred while dragging Activity to other group", ex);
                            }
                            ListView.UpdateGrouping();
                        }
                        else
                        {
                            //need to move in group
                            mContext.BusinessFlow.MoveActivityInGroup(draggedActivity, mContext.BusinessFlow.Activities.IndexOf(activityDroppedOn));
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void listActions_ItemDropped(object sender, EventArgs e)
        {
            object droppedItem = ((DragInfo)sender).Data as object;

            if (droppedItem != null)
            {
                int mouseIndex     = -1;
                int lastAddedIndex = -1;
                Act actDroppedOn   = DragDrop2.GetRepositoryItemHit(ListView) as Act;

                if (actDroppedOn != null)
                {
                    mouseIndex = ListView.DataSourceList.IndexOf(actDroppedOn);
                }

                lastAddedIndex = ActionsFactory.AddActionsHandler(droppedItem, mContext, mouseIndex);

                if (lastAddedIndex > mouseIndex)
                {
                    ListView.xListView.SelectedItems.Clear();
                    for (int itemIndex = mouseIndex; itemIndex < lastAddedIndex; itemIndex++)
                    {
                        RepositoryItemBase repoBaseItem = ListView.DataSourceList[itemIndex] as RepositoryItemBase;
                        if (repoBaseItem != null)
                        {
                            ListView.xListView.SelectedItems.Add(repoBaseItem);
                        }
                    }
                }
            }
        }
        private void ListVars_ItemDropped(object sender, EventArgs e)
        {
            object droppedItem = ((DragInfo)sender).Data as object;

            if (droppedItem != null)
            {
                VariableBase droppedAtVar = DragDrop2.GetRepositoryItemHit(ListView) as VariableBase;

                VariableBase varDropped = droppedItem as VariableBase;

                VariableBase instance = (VariableBase)varDropped.CreateInstance(true);

                if (droppedAtVar != null)
                {
                    int targetIndex = GetVariablesList().IndexOf(droppedAtVar);

                    GetVariablesList().Insert(targetIndex, instance);
                    ListView.xListView.SelectedItem = instance;
                }
                else
                {
                    GetVariablesList().Add(instance);

                    int selectedActIndex = -1;
                    if (GetVariablesList().CurrentItem != null)
                    {
                        selectedActIndex = GetVariablesList().IndexOf((VariableBase)GetVariablesList().CurrentItem);
                    }
                    if (selectedActIndex >= 0)
                    {
                        GetVariablesList().Move(GetVariablesList().Count - 1, selectedActIndex + 1);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public GherkinPage()
        {
            InitializeComponent();

            folder = WorkSpace.UserProfile.Solution.BusinessFlowsMainFolder;

            GherkinTextEditor.AddToolbarTool(General.GetImage("@Save_16x16.png"), Save_Click, "Save Gherkin Feature");
            GherkinTextEditor.SaveButton.Visibility = Visibility.Collapsed;

            GherkinTextEditor.AddToolbarTool(General.GetImage("@Grid_16x16.png"), AddTable, "Add Examples Table");

            DragDrop2.HookEventHandlers(GherkinTextEditor);

            // Set the grids
            SetScenariosGridView();
            ScenariosGrid.SetTitleLightStyle = true;
            ScenariosGrid.DataSourceList     = mGherkinScenarioDefinition;

            SetStepsGridView();
            StepsGrid.SetTitleLightStyle = true;
            StepsGrid.DataSourceList     = mGherkinSteps;

            TagsGrid.DataSourceList     = mTags;
            TagsGrid.SetTitleLightStyle = true;
            SetTagsGrid();


            SetErrorsGridView();
            ErrorsGrid.SetTitleLightStyle = true;
            ErrorsGrid.DataSourceList     = mErrorsList;

            OptimizedStepsGrid.SetTitleLightStyle = true;
            SetOptimizedGridView();
        }
Ejemplo n.º 5
0
        private void ActivitiesListView_ItemDropped(object sender, EventArgs e)
        {
            object droppedItem = ((DragInfo)sender).Data as object;

            if (droppedItem != null)
            {
                if (droppedItem is Activity)
                {
                    string   activityGroupID   = null;
                    int      activityIndex     = -1;
                    Activity activityDroppedOn = DragDrop2.GetRepositoryItemHit(ListView) as Activity;

                    if (activityDroppedOn != null)
                    {
                        activityGroupID = activityDroppedOn.ActivitiesGroupID;
                        activityIndex   = ListView.xListView.Items.IndexOf(activityDroppedOn);
                    }

                    List <Activity> list = new List <Activity>();
                    list.Add((Activity)droppedItem);
                    ActionsFactory.AddActivitiesFromSRHandler(list, mContext.BusinessFlow, activityGroupID, activityIndex);
                    if (activityIndex != -1)
                    {
                        ListView.xListView.SelectedIndex = activityIndex;
                    }
                }
                else if (droppedItem is ActivitiesGroup)
                {
                    List <ActivitiesGroup> list = new List <ActivitiesGroup>();
                    list.Add((ActivitiesGroup)droppedItem);
                    ActionsFactory.AddActivitiesGroupsFromSRHandler(list, mContext.BusinessFlow);
                }
            }
        }
 private void xUnMapTestCaseGrid_PreviewDragItem(object sender, EventArgs e)
 {
     if (DragDrop2.DrgInfo.DataIsAssignableToType(typeof(ALMTestCaseManualMappingConfig), true) ||
         DragDrop2.DrgInfo.DataIsAssignableToType(typeof(ALMTSTest), true))
     {
         // OK to drop
         if (DragDrop2.DrgInfo.Data is ALMTestCaseManualMappingConfig)
         {
             if (DragDrop2.DrgInfo.DragSource == DragDrop2.DrgInfo.DragTarget)
             {
                 return;
             }
             DragDrop2.SetDragIcon(true, false);
         }
         else
         {
             DragDrop2.SetDragIcon(true);
         }
     }
     else
     {
         // Do Not Drop
         DragDrop2.SetDragIcon(false);
     }
 }
Ejemplo n.º 7
0
        public UCTreeView()
        {
            InitializeComponent();

            Tree.SelectedItemChanged         += Tree_SelectedItemChanged;
            Tree.PreviewMouseRightButtonDown += Tree_PreviewMouseRightButtonDown;
            Tree.MouseDoubleClick            += Tree_MouseDoubleClick;

            //Hook Drag Drop handler
            //TODO: add flag to decide if Drag and drop is needed
            DragDrop2.HookEventHandlers(this);
        }
Ejemplo n.º 8
0
 private void grdVariables_PreviewDragItem(object sender, EventArgs e)
 {
     if (DragDrop2.DrgInfo.DataIsAssignableToType(typeof(VariableBase)))
     {
         // OK to drop
         DragDrop2.SetDragIcon(true);
     }
     else
     {
         // Do Not Drop
         DragDrop2.SetDragIcon(false);
     }
 }
Ejemplo n.º 9
0
 private void grdActivitiesGroups_PreviewDragItem(object sender, EventArgs e)
 {
     if (DragDrop2.DragInfo.DataIsAssignableToType(typeof(ActivitiesGroup)))
     {
         // OK to drop
         DragDrop2.SetDragIcon(true);
     }
     else
     {
         // Do Not Drop
         DragDrop2.SetDragIcon(false);
     }
 }
        private void xMapActivityGroupToTestCaseGrid_DragOver(object sender, DragEventArgs e)
        {
            ucGrid r = (ucGrid)sender;

            if (sender is ucGrid && (sender as ucGrid).Name == xMapActivityGroupToTestCaseGrid.Name)
            {
                var obj = DragDrop2.GetGridItemHit(xMapActivityGroupToTestCaseGrid);
                if (obj is ALMTestCaseManualMappingConfig && (obj as ALMTestCaseManualMappingConfig).activitiesGroup != null)
                {
                    int selectedIndex = xMapActivityGroupToTestCaseGrid.DataSourceList.IndexOf((obj as ALMTestCaseManualMappingConfig));
                    xMapActivityGroupToTestCaseGrid.Drop -= xUnMapTestCaseGrid_ItemDropped;
                }
            }
        }
Ejemplo n.º 11
0
        private void listActions_ItemDropped(object sender, EventArgs e)
        {
            object droppedItem = ((DragInfo)sender).Data as object;

            if (droppedItem != null)
            {
                int mouseIndex   = -1;
                Act actDroppedOn = DragDrop2.GetRepositoryItemHit(ListView) as Act;

                if (actDroppedOn != null)
                {
                    mouseIndex = ListView.DataSourceList.IndexOf(actDroppedOn);
                }
                DroppedItemHandler(droppedItem, mouseIndex);
            }
        }
Ejemplo n.º 12
0
        public UcListView()
        {
            InitializeComponent();

            //Hook Drag Drop handler
            mIsDragDropCompatible = true;
            DragDrop2.HookEventHandlers(this);

            if (Tags == null)
            {
                Tags = new ObservableList <Guid>();
            }

            xTagsFilter.Init(Tags);
            xTagsFilter.TagsStackPanlChanged += TagsFilter_TagsStackPanlChanged;
        }
Ejemplo n.º 13
0
 // Drag Drop handlers
 private void listActions_PreviewDragItem(object sender, EventArgs e)
 {
     if (DragDrop2.DragInfo.DataIsAssignableToType(typeof(Act)) ||
         DragDrop2.DragInfo.DataIsAssignableToType(typeof(ApplicationPOMModel)) ||
         DragDrop2.DragInfo.DataIsAssignableToType(typeof(ElementInfo)) ||
         DragDrop2.DragInfo.DataIsAssignableToType(typeof(RepositoryFolder <ApplicationAPIModel>)) ||
         DragDrop2.DragInfo.DataIsAssignableToType(typeof(ApplicationAPIModel)))
     {
         // OK to drop
         DragDrop2.SetDragIcon(true);
     }
     else
     {
         // Do Not Drop
         DragDrop2.SetDragIcon(false);
     }
 }
        private void xUnMapTestCaseGrid_ItemDropped(object sender, EventArgs e)
        {
            object draggedItem = ((DragInfo)sender).Data as object;

            if (draggedItem == null)
            {
                return;
            }
            // Get Drop Item Data
            var dropItem    = DragDrop2.GetGridItemHit(xMapActivityGroupToTestCaseGrid);
            int targetIndex = GetItemIndex(xMapActivityGroupToTestCaseGrid, dropItem as ALMTestCaseManualMappingConfig);

            // Drag item from Mapped grid.
            if (draggedItem is ALMTestCaseManualMappingConfig)
            {
                if ((draggedItem as ALMTestCaseManualMappingConfig).aLMTSTest is null)
                {
                    return;
                }
                int sourceIndex = GetItemIndex(xMapActivityGroupToTestCaseGrid, draggedItem);
                // Drag Source & Target is Mapped Grid items.
                if (((DragInfo)sender).DragSource == ((DragInfo)sender).DragTarget)
                {
                    // Drag & Drop to same row.
                    if (sourceIndex == targetIndex)
                    {
                        return;
                    }
                    ReplaceMappedTestCaseHandler(draggedItem as ALMTestCaseManualMappingConfig, dropItem as ALMTestCaseManualMappingConfig);
                }
                // Drag from Mapped grid to UnMapped Grid items.
                else
                {
                    UnMapTestCaseHandler(draggedItem as ALMTestCaseManualMappingConfig);
                }
            }
            // Source item is from UnMapped Grid.
            if (draggedItem is ALMTSTest)
            {
                MapTestCaseHandler(draggedItem as ALMTSTest, (ALMTestCaseManualMappingConfig)xMapActivityGroupToTestCaseGrid.DataSourceList[targetIndex]);
            }
        }
 // Drag Drop handlers
 private void ListVars_PreviewDragItem(object sender, EventArgs e)
 {
     if (DragDrop2.DrgInfo.DataIsAssignableToType(typeof(VariableBase), true))
     {
         if (DragDrop2.DrgInfo.Data is ObservableList <RepositoryItemBase> )
         {
             DragDrop2.SetDragIcon(true, true);
         }
         else
         {
             DragDrop2.SetDragIcon(true);
         }
         // OK to drop
     }
     else
     {
         // Do Not Drop
         DragDrop2.SetDragIcon(false);
     }
 }
Ejemplo n.º 16
0
 private void ActivitiesListView_PreviewDragItem(object sender, EventArgs e)
 {
     if (DragDrop2.DrgInfo.DataIsAssignableToType(typeof(Activity), true) ||
         DragDrop2.DrgInfo.DataIsAssignableToType(typeof(ActivitiesGroup), true))
     {
         if (DragDrop2.DrgInfo.Data is ObservableList <RepositoryItemBase> )
         {
             DragDrop2.SetDragIcon(true, true);
         }
         else
         {
             // OK to drop
             DragDrop2.SetDragIcon(true);
         }
     }
     else
     {
         // Do Not Drop
         DragDrop2.SetDragIcon(false);
     }
 }
Ejemplo n.º 17
0
        void IDragDrop.Drop(DragInfo Info)
        {
            // first check if we did drag and drop on the same ListView then it is a move - reorder
            if (Info.DragSource == this)
            {
                EventHandler mHandler = SameFrameItemDropped;
                if (mHandler != null)
                {
                    mHandler(Info, new EventArgs());
                }
                else
                {
                    RepositoryItemBase draggedItem = Info.Data as RepositoryItemBase;

                    if (draggedItem != null)
                    {
                        RepositoryItemBase draggedOnItem = DragDrop2.GetRepositoryItemHit(this) as RepositoryItemBase;
                        if (draggedOnItem != null)
                        {
                            DragDrop2.ShuffleControlsItems(draggedItem, draggedOnItem, this);
                        }
                    }
                }
                //if (!(xMoveUpBtn.Visibility == System.Windows.Visibility.Visible)) return;  // Do nothing if reorder up/down arrow are not allowed
                return;
            }

            // OK this is a dropped from external
            EventHandler handler = ItemDropped;

            if (handler != null)
            {
                handler(Info, new EventArgs());
            }
            // TODO: if in same grid then do move,
        }