void ApplicationOnDetailViewCreating(object sender, DetailViewCreatingEventArgs args)
 {
     if (!(args.View is XpandDetailView))
     {
         args.View = ViewFactory.CreateDetailView((XafApplication)sender, args.ViewID, args.ObjectSpace, args.Obj, args.IsRoot, args.EnableDelayedObjectLoading);
     }
 }
 protected override void OnDetailViewCreating(DetailViewCreatingEventArgs args)
 {
     base.OnDetailViewCreating(args);
     if (args.View == null)
     {
         args.View = defaultDetailView;
     }
 }
Exemple #3
0
        void application_DetailViewCreating(object sender, DetailViewCreatingEventArgs e)
        {
            //throw new NotImplementedException();
//            if (e.Obj is fmCDirection) {
//                e.ViewID = "fmIDirection_DetailView";
//            }
            //if (e.Obj is fmCSubjectExt) {
            //    e.ViewID = "fmISubjectExt_DetailView";
            //}
            //if (e.Obj is fmCOrderExt) {
            //    e.ViewID = "fmIOrderExt_DetailView";
            //}
        }
Exemple #4
0
 void OnDetailViewCreating(object sender, DetailViewCreatingEventArgs args) {
     args.View = ViewFactory.CreateDetailView(this, args.ViewID, args.Obj, args.ObjectSpace, args.IsRoot);
 }
Exemple #5
0
 void OnDetailViewCreating(object sender, DetailViewCreatingEventArgs args)
 {
     args.View = ViewFactory.CreateDetailView(this, args.ViewID, args.Obj, args.ObjectSpace, args.IsRoot);
 }
Exemple #6
0
 void ApplicationOnDetailViewCreating(object sender, DetailViewCreatingEventArgs args) {
     if (!(args.View is XpandDetailView))
         args.View = ViewFactory.CreateDetailView((XafApplication) sender, args.ViewID, args.ObjectSpace, args.Obj, args.IsRoot);
 }
 private void ApplicationOnDetailViewCreating(object sender, DetailViewCreatingEventArgs e){
     e.View.ControlsCreated+=ViewOnControlsCreated;
 }
 private void ApplicationOnDetailViewCreating(object sender, DetailViewCreatingEventArgs e)
 {
     e.View.ControlsCreated += ViewOnControlsCreated;
 }
        private void Application_DetailViewCreating(object sender, DetailViewCreatingEventArgs e)
        {
            // Образец: как менять представления в зависимости от условий
            //((XafApplication)sender).DetailViewCreating -= new EventHandler<DetailViewCreatingEventArgs>(Application_DetailViewCreating);
            //if (e.Obj is Transaction && Frame is NestedFrame) {
            //    Type parentType = ((NestedFrame)Frame).ViewItem.ObjectType;
            //    if (typeof(Consumer).IsAssignableFrom(parentType)) {
            //        e.ViewID = "Transaction_DetailView_FromConsumer";
            //    }
            //    if (typeof(Producer).IsAssignableFrom(parentType)) {
            //        e.ViewID = "Transaction_DetailView_FromProducer";
            //    }
            //}
            //...


            //Frame.Application.DetailViewCreating -= new EventHandler<DetailViewCreatingEventArgs>(Application_DetailViewCreating);
            ((XafApplication)sender).DetailViewCreating -= new EventHandler <DetailViewCreatingEventArgs>(Application_DetailViewCreating);

            Frame frame = Frame;

            //IObjectSpace objectSpace = Application.CreateObjectSpace();
            //object wp = objectSpace.CreateObject(typeof(crmWorkPlan));
            //string DetailViewId = frame.Application.FindDetailViewId(wp.GetType());


            if (false)   // Проверка 1

            /*  Закоменчено, т.к. убраны объекты на которых проводилось испытание
             * crmSimpleContract sc = e.Obj as crmSimpleContract;
             * if (sc != null) {
             *  object scv = sc.CurrentVersion;
             *  string DetailViewId = frame.Application.FindDetailViewId(scv.GetType());
             *
             *  TemplateContext tc = new TemplateContext();
             *  Frame newFrame = frame.Application.CreateFrame(tc);
             *
             *  //IObjectSpace objectSpace = Application.CreateObjectSpace();
             *  IObjectSpace objectSpace = e.ObjectSpace;
             *
             *  //object shownObject = objectSpace.GetObject(scv);
             *  object shownObject = scv;
             *
             *  DetailView newView = newFrame.Application.CreateDetailView(objectSpace, DetailViewId, false, shownObject);
             *  newFrame.SetView(newView, true, frame);
             *
             *  //e.ObjectSpace = objectSpace;
             *  //.View = newView;
             *
             *  DetailViewCreatingEventArgs args = new DetailViewCreatingEventArgs(DetailViewId, objectSpace, scv, false);
             *
             *  args.View = newView;
             *  e = args;
             * }
             */
            {
            }


            //if (false) {

            //    // Тип объекта, который надо обработать
            //    Type ChoiceType = e.Obj.GetType();   //((System.Type)(((SingleChoiceActionExecuteEventArgs)(e)).SelectedChoiceActionItem.Data)).UnderlyingSystemType;   //typeof(object);
            //    //if ((view.ObjectTypeInfo).Type == typeof(crmContractImplementation)) {
            //    //    ChoiceType = ((System.Type)(((SingleChoiceActionExecuteEventArgs)(e)).SelectedChoiceActionItem.Data)).UnderlyingSystemType;
            //    //}
            //    //if (ChoiceType == typeof(object)) {
            //    //    ChoiceType = (view.ObjectTypeInfo).Type;
            //    //}


            //    // Если поддерживается интерфейс:
            //    //if ((view.ObjectTypeInfo).Type.GetInterface("IVersionMainObject") != null) {
            //    if (ChoiceType.GetInterface("IVersionMainObject") != null) {
            //        IObjectSpace objectSpace = Application.CreateObjectSpace();

            //        //object obj = objectSpace.CreateObject((view.ObjectTypeInfo).Type);
            //        object obj = objectSpace.CreateObject(ChoiceType);
            //        IVersionMainObject mainObj = obj as IVersionMainObject;
            //        if (mainObj == null) return;

            //        VersionRecord objCurrent = mainObj.GetCurrent();
            //        if (objCurrent == null) return;

            //        // Определяем DetailView
            //        string DetailViewId = frame.Application.FindDetailViewId(objCurrent.GetType());

            //        // Запрет стандартного поведения
            //        //e.Action.Active[DesableStandartNewAction] = false;
            //        //e.ShowViewParameters.CreatedView = null;
            //        e.ViewID = DetailViewId;

            //        //// Показ:
            //        //TargetWindow openMode = TargetWindow.NewWindow;
            //        //CommonMethods.ShowConcreteDetailViewInWindow(frame, objectSpace, DetailViewId, objCurrent, openMode);

            //        //if (openMode == TargetWindow.NewModalWindow && (view as ListView) != null) ((ListView)view).CollectionSource.Reload();
            //    }
            //}


            //Frame.Application.DetailViewCreating += new EventHandler<DetailViewCreatingEventArgs>(Application_DetailViewCreating);
            ((XafApplication)sender).DetailViewCreating += new EventHandler <DetailViewCreatingEventArgs>(Application_DetailViewCreating);
        }