示例#1
0
        private void ShowNavigationItemController_CustomShowNavigationItem(object sender, CustomShowNavigationItemEventArgs e)
        {
            ViewShortcut shortcut = e.ActionArguments.SelectedChoiceActionItem.Data as ViewShortcut;

            if (shortcut != null)
            {
                oldListView = Application.ProcessShortcut(shortcut) as ListView;
                if (oldListView != null)
                {
                    e.Handled = true;
                    NonPersistentObjectSpace nonPersistentObjectSpace = (NonPersistentObjectSpace)Application.CreateObjectSpace(typeof(ViewFilterContainer));
                    IObjectSpace             persistentObjectSpace    = Application.CreateObjectSpace(typeof(ViewFilterObject));
                    nonPersistentObjectSpace.AdditionalObjectSpaces.Add(persistentObjectSpace);
                    ViewFilterContainer newViewFilterContainer = nonPersistentObjectSpace.CreateObject <ViewFilterContainer>();
                    newViewFilterContainer.ObjectType = oldListView.ObjectTypeInfo.Type;
                    newViewFilterContainer.Filter     = GetFilterObject(persistentObjectSpace, ((IModelListViewAdditionalCriteria)oldListView.Model).AdditionalCriteria, newViewFilterContainer.ObjectType);
                    DetailView filterDetailView = Application.CreateDetailView(nonPersistentObjectSpace, newViewFilterContainer);
                    filterDetailView.Caption      = String.Format("Filter for the {0} ListView", oldListView.Caption);
                    filterDetailView.ViewEditMode = ViewEditMode.Edit;
                    e.ActionArguments.ShowViewParameters.CreatedView  = filterDetailView;
                    e.ActionArguments.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
                    DialogController dialogCotnroller = Application.CreateController <DialogController>();
                    dialogCotnroller.Accepting  += new EventHandler <DialogControllerAcceptingEventArgs>(dialogCotnroller_Accepting);
                    dialogCotnroller.Cancelling += dialogCotnroller_Cancelling;
                    dialogCotnroller.ViewClosed += dialogCotnroller_ViewClosed;
                    e.ActionArguments.ShowViewParameters.Controllers.Add(dialogCotnroller);
                }
            }
        }
示例#2
0
        void dialogCotnroller_Accepting(object sender, DialogControllerAcceptingEventArgs e)
        {
            ViewFilterContainer currentViewFilterContainer = (ViewFilterContainer)e.AcceptActionArgs.CurrentObject;
            ListView            targetView = GetTargetView();

            ((IModelListViewAdditionalCriteria)targetView.Model).AdditionalCriteria = currentViewFilterContainer.Criteria;
            targetView.CollectionSource.Criteria["ByViewFilterObject"] = CriteriaEditorHelper.GetCriteriaOperator(currentViewFilterContainer.Criteria, currentViewFilterContainer.ObjectType, targetView.ObjectSpace);
            oldListView = null;
            ShowView(targetView, e.ShowViewParameters);
        }
示例#3
0
        void dialogCotnroller_Accepting(object sender, DialogControllerAcceptingEventArgs e)
        {
            ViewFilterContainer currentViewFilterContainer = (ViewFilterContainer)e.AcceptActionArgs.CurrentObject;
            ListView            targetView = GetTargetView();

            ((IModelListViewAdditionalCriteria)targetView.Model).AdditionalCriteria = currentViewFilterContainer.Criteria;
            targetView.CollectionSource.Criteria["ByViewFilterObject"] = CriteriaEditorHelper.GetCriteriaOperator(currentViewFilterContainer.Criteria, currentViewFilterContainer.ObjectType, targetView.ObjectSpace);
            ShowViewParameters parameters = new ShowViewParameters(targetView);

            parameters.TargetWindow = TargetWindow.Current;
            parameters.Context      = TemplateContext.View;
            ShowViewSource source = new ShowViewSource(Frame, showNavigationItemController.ShowNavigationItemAction);

            Application.ShowViewStrategy.ShowView(parameters, source);
            oldListView = null;
        }
示例#4
0
 void ShowNavigationItemAction_Execute(object sender, SingleChoiceActionExecuteEventArgs e)
 {
     if (e.ShowViewParameters.CreatedView is ListView)
     {
         oldListView = (ListView)e.ShowViewParameters.CreatedView;
         NonPersistentObjectSpace nonPersistentObjectSpace = (NonPersistentObjectSpace)Application.CreateObjectSpace(typeof(ViewFilterContainer));
         IObjectSpace             persistentObjectSpace    = Application.CreateObjectSpace(typeof(ViewFilterObject));
         nonPersistentObjectSpace.AdditionalObjectSpaces.Add(persistentObjectSpace);
         ViewFilterContainer newViewFilterContainer = nonPersistentObjectSpace.CreateObject <ViewFilterContainer>();
         newViewFilterContainer.ObjectType = oldListView.ObjectTypeInfo.Type;
         newViewFilterContainer.Filter     = GetFilterObject(persistentObjectSpace, ((IModelListViewAdditionalCriteria)oldListView.Model).AdditionalCriteria, newViewFilterContainer.ObjectType);
         DetailView filterDetailView = Application.CreateDetailView(nonPersistentObjectSpace, newViewFilterContainer);
         filterDetailView.Caption          = String.Format("Filter for the {0} ListView", oldListView.Caption);
         filterDetailView.ViewEditMode     = ViewEditMode.Edit;
         e.ShowViewParameters.CreatedView  = filterDetailView;
         e.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
         DialogController dialogCotnroller = Application.CreateController <DialogController>();
         dialogCotnroller.Accepting  += new EventHandler <DialogControllerAcceptingEventArgs>(dialogCotnroller_Accepting);
         dialogCotnroller.ViewClosed += dialogCotnroller_ViewClosed;
         e.ShowViewParameters.Controllers.Add(dialogCotnroller);
     }
 }