Ejemplo n.º 1
0
        void Container_Closed(object sender, PaneClosedEventArgs e)
        {
            ContentPane contentPane = sender as ContentPane;

            if (contentPane != null)
            {
                contentPane.Closed -= Container_Closed;                           //no memory leaks

                IRegion region = contentPane.GetValue(RegionProperty) as IRegion; //get the region associated with the ContentPane so that we can remove it.
                if (region != null)
                {
                    if (region.Views.Contains(contentPane)) //we are dealing with a ContentPane directly
                    {
                        region.Remove(contentPane);
                    }

                    var item = contentPane.Content; //this view was injected and set as the content of our ContentPane
                    if (item != null && region.Views.Contains(item))
                    {
                        region.Remove(item);
                    }
                }

                ClearContainerForItem(contentPane); //reduce memory leaks
            }
        }
Ejemplo n.º 2
0
        private void OnPaneClosed(object sender, PaneClosedEventArgs e)
        {
            var pane = sender as ContentPane;

            // if the pane was closed because it was removed from the source collection
            // then we don't want to do anything. however if it is remove pane then
            // we want to try and remove it from the source collection
            if (pane != null && IsContainerInUse(pane) && pane.CloseAction == PaneCloseAction.RemovePane)
            {
                var cv = CollectionViewSource.GetDefaultView(ItemsSource) as IEditableCollectionView;

                Debug.Assert(null != cv && cv.CanRemove, "The ContentPane is being removed from the XamDockManager but it is still referenced by the source collection and it is not possible to remove it from the source collection.");

                if (cv.CanRemove)
                {
                    var dataItem = GetItemForContainer(pane);
                    cv.Remove(dataItem);
                    var item = pane.Content as WorkflowDesignerViewModel;
                    if (item?.ResourceModel != null)
                    {
                        WorkspaceItemRepository.Instance.Remove(item.ResourceModel);
                    }
                    item?.RemoveUnsavedWorkflowName(item.DisplayName);
                }
            }
        }
Ejemplo n.º 3
0
        private void OnPaneClosed(object sender, PaneClosedEventArgs e)
        {
            var pane = sender as ContentPane;

            // if the pane was closed because it was removed from the source collection
            // then we don't want to do anything. however if it is remove pane then
            // we want to try and remove it from the source collection
            if (pane != null && (IsContainerInUse(pane) && pane.CloseAction == PaneCloseAction.RemovePane))
            {
                var cv = CollectionViewSource.GetDefaultView(ItemsSource) as IEditableCollectionView;

                Debug.Assert(null != cv && cv.CanRemove, "The ContentPane is being removed from the XamDockManager but it is still referenced by the source collection and it is not possible to remove it from the source collection.");

                if (cv.CanRemove)
                {
                    var dataItem = GetItemForContainer(pane);
                    cv.Remove(dataItem);
                }
            }
        }
Ejemplo n.º 4
0
        void OnPaneClosed(object sender, PaneClosedEventArgs e)
        {
            if (sender is ContentPane pane && IsContainerInUse(pane) && pane.CloseAction == PaneCloseAction.RemovePane)
            {
                var cv = CollectionViewSource.GetDefaultView(ItemsSource) as IEditableCollectionView;

                Debug.Assert(cv != null && cv.CanRemove, "The ContentPane is being removed from the XamDockManager but it is still referenced by the source collection and it is not possible to remove it from the source collection.");

                if (cv != null && cv.CanRemove)
                {
                    var dataItem = GetItemForContainer(pane);
                    cv.Remove(dataItem);
                    var item = pane.Content as WorkflowDesignerViewModel;
                    if (item?.ResourceModel != null)
                    {
                        WorkspaceItemRepository.Instance.Remove(item.ResourceModel);
                    }

                    item?.RemoveUnsavedWorkflowName(item.DisplayName);
                }
            }
        }
Ejemplo n.º 5
0
        void LayoutManager_PaneClosedEvent(object sender, PaneClosedEventArgs e)
        {
            BaseViewModel vm = e.DockableViewModel as BaseViewModel;

            if (vm is BaseDockingViewModel)
            {
                if (this.AllViewModels.Contains(vm as BaseDockingViewModel))
                {
                    this.AllViewModels.Remove(vm as BaseDockingViewModel);
                }
                if (this.UnknownOpenedModels.Contains(vm as BaseDockingViewModel))
                {
                    this.UnknownOpenedModels.Remove(vm as BaseDockingViewModel);
                }
            }

            if (vm != null)
            {
                if (!vm.IsDisposed)
                {
                    vm.Dispose();
                }
            }
        }
Ejemplo n.º 6
0
 void OnContentPaneClosed(object sender, PaneClosedEventArgs e)
 {
     this.OnClosed();
     this.HookEvents(false);
 }
Ejemplo n.º 7
0
        private void OnPaneClosed(object sender, PaneClosedEventArgs e)
        {
            var pane = sender as ContentPane;

            // if the pane was closed because it was removed from the source collection
            // then we don't want to do anything. however if it is remove pane then 
            // we want to try and remove it from the source collection
            if(pane != null && (IsContainerInUse(pane) && pane.CloseAction == PaneCloseAction.RemovePane))
            {
                var cv = CollectionViewSource.GetDefaultView(ItemsSource) as IEditableCollectionView;

                Debug.Assert(null != cv && cv.CanRemove, "The ContentPane is being removed from the XamDockManager but it is still referenced by the source collection and it is not possible to remove it from the source collection.");

                if(cv.CanRemove)
                {
                    var dataItem = GetItemForContainer(pane);
                    cv.Remove(dataItem);
                }
            }
        }