using System;
using System.Linq;
using System.Collections.Generic;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp.SystemModule;
using DevExpress.ExpressApp.Xpo;

namespace SISBusiness.Module
{
    // For more typical usage scenarios, be sure to check out http://documentation.devexpress.com/#Xaf/clsDevExpressExpressAppWindowControllertopic.
    public partial class NavigationItemVCC : SISBusiness.Module.Win.SISShowNavigationItemController
    {
        public NavigationItemVCC()
        {
            InitializeComponent();
            RegisterActions(components);
            // Target required Windows (via the TargetXXX properties) and create their Actions.
        }
        protected override void OnActivated()
        {
            base.OnActivated();
            // Perform various tasks depending on the target Window.
        }
        protected override void OnDeactivated()
        {
            // Unsubscribe from previously subscribed events and release other references and resources.
            base.OnDeactivated();
        }
        
        protected override void ShowNavigationItem(SingleChoiceActionExecuteEventArgs args)
        {
            if (args.SelectedChoiceActionItem != null && args.SelectedChoiceActionItem.Enabled)
            {
                if (args.SelectedChoiceActionItem.Id == "NAVInvoiceReport_ListView")
                {
                    XPObjectSpace _onew = (XPObjectSpace)Application.CreateObjectSpace();
                    NAVInvoiceReport _NAVInvoiceReport = _onew.CreateObject<NAVInvoiceReport>(); 

                    args.ShowViewParameters.CreatedView = Application.CreateDetailView(_onew, "NAVInvoiceReport_DetailView", true, _NAVInvoiceReport);
                }
                else 
                {
                    base.ShowNavigationItem(args);
                }
            }
        }
    }
}
