void NewObjectViewControllerOnObjectCreating(object sender, ObjectCreatingEventArgs objectCreatingEventArgs) { if (_previousObject == null && (objectCreatingEventArgs.ShowDetailView && View is DetailView)) { _previousObject = View.CurrentObject; } }
private void ControllerOnObjectCreating(object sender, ObjectCreatingEventArgs args) { if (typeof(ModelDifferenceObject).IsAssignableFrom(args.ObjectType)) { throw new UserFriendlyException(new Exception("Only cloned is allowed")); } }
protected override void ProcessObjectCreating(ObjectCreatingEventArgs e) { if (!typeof(IDashboardDefinition).IsAssignableFrom(e.ObjectType)) { base.ProcessObjectCreating(e); } }
private void newObjectViewController_ObjectCreating(object sender, ObjectCreatingEventArgs e) { e.ShowDetailView = false; if (e.ObjectSpace is DevExpress.ExpressApp.Xpo.XPNestedObjectSpace) { e.ObjectSpace = application.CreateObjectSpace(); } }
private void newObjectViewController_ObjectCreating(object sender, ObjectCreatingEventArgs e) { e.ShowDetailView = false; // B196715 if (e.ObjectSpace is INestedObjectSpace) { e.ObjectSpace = application.CreateObjectSpace(); } }
void newObjectViewController_ObjectCreating(object sender, ObjectCreatingEventArgs e) { var detailView = View as DetailView; if (detailView != null && detailView.ViewEditMode == ViewEditMode.Edit && _defaultValues != null) { InitializeObjectValues(View.CurrentObject); } }
// private crmCLegalPerson comp = null; // private IObjectSpace compos = null; /// <summary> /// Этот метод позволяет создать другой объект, чем тот, что задаётся выбором пункта меню или подменю New. /// Однако, не удаётся пока передать этот объект дальше в метод CustomNewActionController_CustomAddObjectToCollection /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CustomNewActionController_ObjectCreating(object sender, ObjectCreatingEventArgs e) { // if (e.ObjectType == typeof(crmLegalPerson)) { // compos = e.ObjectSpace; // comp = (crmLegalPerson) e.ObjectSpace.CreateObject(e.ObjectType); // e.NewObject = comp.Party; // e.NewObject = comp; // } // }
private void DocumentDataController_ObjectCreating(object sender, ObjectCreatingEventArgs e) { if (!e.Cancel && typeof(IDocumentData).IsAssignableFrom(e.ObjectType) && Frame.Context != TemplateContext.LookupControl && Frame.Context != TemplateContext.LookupWindow) { e.ShowDetailView = false; IDocumentData documentData = (IDocumentData)e.ObjectSpace.CreateObject(e.ObjectType); e.NewObject = documentData; ShowDesigner(documentData, e.ObjectSpace); } }
// private csCComponent comp; // private IObjectSpace os; private void CustomNewActionController_ObjectCreating(object sender, ObjectCreatingEventArgs e) { if (e.ObjectType == typeof(fmIDirection)) { e.NewObject = e.ObjectSpace.CreateObject <fmCDirection>(); } if (e.ObjectType == typeof(fmISubjectExt)) { e.NewObject = e.ObjectSpace.CreateObject <fmCSubjectExt>(); } if (e.ObjectType == typeof(fmIOrderExt)) { e.NewObject = e.ObjectSpace.CreateObject <fmCOrderExt>(); } }
private void DocumentoItemController_ObjectCreating(object sender, ObjectCreatingEventArgs e) { var documento = this.GetMasterObject <Documento>(); var subramo = documento.Subramo; if (subramo == null) { throw new UserFriendlyException("Debe indicar el Ramo/Subramo para crear un Item."); } var documentoItemType = string.IsNullOrEmpty(documento.Subramo.TipoItem) ? typeof(DocumentoItem) : XafTypesInfo.Instance.FindTypeInfo(documento.Subramo.TipoItem).Type; e.NewObject = e.ObjectSpace.CreateObject(documentoItemType); }
/// <summary> /// Этот метод позволяет создать другой объект, чем тот, что задаётся выбором пункта меню или подменю New. /// Однако, не удаётся пока передать этот объект дальше в метод CustomNewActionController_CustomAddObjectToCollection /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CustomNewActionController_ObjectCreating(object sender, ObjectCreatingEventArgs e) { foreach (Type type in e.ObjectType.GetInterfaces()) { if (type == typeof(IVersionSupport)) { e.NewObject = e.ObjectSpace.CreateObject(e.ObjectType); IVersionSupport vobj = e.NewObject as IVersionSupport; if (vobj != null) { //!!!Паша нужно правильно определить vobj.VersionState сейчас заглушка vobj.VersionState = VersionStates.VERSION_NEW; vobj.VersionAfterConstruction(); } } } }
private void Controller_ObjectCreating(object sender, ObjectCreatingEventArgs e) { foreach (var member in ((InventoryTransaction)View.CurrentObject).ClassInfo.Members) { if (member.MemberType == typeof(Shop) && member.GetValue(View.CurrentObject) == null) { e.Cancel = true; MessageOptions options = new MessageOptions(); options.Duration = 4000; options.Message = "Please cheose the shop and date before adding any item"; options.Type = InformationType.Warning; options.Web.Position = InformationPosition.Top; options.Win.Caption = "Warrning"; options.Win.Type = WinMessageType.Flyout; Application.ShowViewStrategy.ShowMessage(options); break; } } //if (((InventoryTransaction)View.CurrentObject).Shop == null || ((InventoryTransaction)View.CurrentObject).Period == null || //(View.CurrentObject.GetType().GetProperty("Destination") != null && View.CurrentObject.GetType().GetProperty("Destination").GetValue(View.CurrentObject) == null)) { }
private void LicensingKeyNewObjectViewController_ObjectCreating(object sender, ObjectCreatingEventArgs e) { if (e.ObjectType == typeof(LicensingKey)) { var os = Application.CreateObjectSpace(typeof(EnterPassPhraseTextDialog)); var obj = os.CreateObject <EnterPassPhraseTextDialog>(); var dv = Application.CreateDetailView(os, obj); Application.ShowViewStrategy.ShowViewInPopupWindow(dv, () => { var os = Application.CreateObjectSpace(typeof(LicensingKey)); var key = os.CreateObject <LicensingKey>(); key.Name = obj.Name; key.PassPhrase = obj.PassPhrase1; var keyGenerator = Standard.Licensing.Security.Cryptography.KeyGenerator.Create(); var keyPair = keyGenerator.GenerateKeyPair(); key.PrivateKey = keyPair.ToEncryptedPrivateKeyString(key.PassPhrase); key.PublicKey = keyPair.ToPublicKeyString(); var dv = Application.CreateDetailView(os, key); Application.ShowViewStrategy.ShowView( new ShowViewParameters(dv), new ShowViewSource(Frame, Frame.GetController <NewObjectViewController>().NewObjectAction) ); }); e.Cancel = true; } }
private void ControllerOnObjectCreating(object sender, ObjectCreatingEventArgs args){ if (typeof(ModelDifferenceObject).IsAssignableFrom(args.ObjectType)) { throw new UserFriendlyException(new Exception("Only cloned is allowed")); } }
void newObjectViewController_ObjectCreating(object sender, ObjectCreatingEventArgs e) { e.ShowDetailView = false; // B196715 if (e.ObjectSpace is INestedObjectSpace) { e.ObjectSpace = _application.CreateObjectSpace(); } }
private void newObjController_ObjectCreating(object sender, ObjectCreatingEventArgs e) { IObjectSpace objectSpace = e.ObjectSpace; // objectdisposedexception fix currentDoctor = objectSpace.GetObject(currentDoctor); currentPacient = objectSpace.GetObject(currentPacient); MedService newMedService = objectSpace.CreateObject <MedService>(); if (currentVisitCase != null || currentMedService != null) { var lookAndFeel = new UserLookAndFeel(this); var result = XtraMessageBox.Show(lookAndFeel, "Создать новое посещение?", "Уточнение", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question); if (result == System.Windows.Forms.DialogResult.No) { result = XtraMessageBox.Show(lookAndFeel, "Услуга производится в ЛПУ?", "Уточнение", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question); // устанавливаем услугу по умолчанию SetService(newMedService, result == System.Windows.Forms.DialogResult.Yes); newMedService.Case = currentVisitCase != null ? currentVisitCase : currentMedService.VisitCase; e.NewObject = newMedService; objectSpace.CommitChanges(); // Обновление представления пациента ObjectSpace.CommitChanges(); ((DetailView)ObjectSpace.Owner).Refresh(); return; } } ShowViewParameters svp = new ShowViewParameters(); IObjectSpace os = Application.CreateObjectSpace(); DetailView dv = Application.CreateDetailView(os, new VisitCaseParameters()); svp.CreatedView = dv; svp.TargetWindow = TargetWindow.NewModalWindow; DialogController dc = new DialogController(); dc.Accepting += (o, e_) => { var visitCaseParameters = e_.AcceptActionArgs.CurrentObject as VisitCaseParameters; VisitCase newVisitCase = objectSpace.CreateObject <VisitCase>(); newVisitCase.Pacient = objectSpace.GetObject(currentPacient); newVisitCase.Cel = visitCaseParameters.CelPosesch; newVisitCase.Mesto = visitCaseParameters.Mesto; newMedService.Case = newVisitCase; // устанавливаем услугу по умолчанию SetService(newMedService, visitCaseParameters.Mesto == MestoObsluzhivaniya.LPU); objectSpace.CommitChanges(); // Обновление представления пациента ObjectSpace.CommitChanges(); ((DetailView)ObjectSpace.Owner).Refresh(); }; dc.CancelAction.Caption = "Отмена"; svp.Controllers.Add(dc); Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null)); e.NewObject = newMedService; }
/// <summary> /// Этот метод позволяет создать другой объект, чем тот, что задаётся выбором пункта меню или подменю New. /// Однако, не удаётся пока передать этот объект дальше в метод CustomNewActionController_CustomAddObjectToCollection /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CustomNewActionController_ObjectCreating(object sender, ObjectCreatingEventArgs e) { if (true) // Првоерка 1. Замена свойства аргумента e /* Закоменчено, т.к. убраны объекты на которых проводилось испытание * //e.Cancel * //e.ShowDetailView * * //e.ObjectSpace * e.ObjectSpace = Application.CreateObjectSpace(); * * //e.NewObject - подмена создаваемого объекта. Для простоты проверки всегда меняется на один и тот же по типу * // В данном случае crmSimpleContract, т.е. в любом месте интерфейса, где нажата кнопка New, будет создаваться * // новый crmSimpleContract. В методе DetailViewCreating для созданного объекта будет проверяться версионность * // и запускать создание версионной разновидности объекта, т.е. crmSimpleContractVersion * * crmSimpleContract sc = e.ObjectSpace.CreateObject<crmSimpleContract>(); * if (sc == null && sc.Current == null) return; * e.NewObject = sc.Current; // e.ObjectSpace.CreateObject<crmSimpleContract>(); */ { } //if (false) { // Првоерка 0. // // Запрет/разрешение стандартного создания объекта // e.Cancel = false; // //e.ShowDetailView = false; // DetailView не будет показан // #region Замена типа создаваемого объекта или только ObjectSpace // /* // // Можно заменить ObjectSpace // objectSpace = Application.CreateObjectSpace(); // e.ObjectSpace = objectSpace; // // Можно заменить аргументы события, что позволяет создать любой другой объект. // // CustomNewActionController_Execute // ObjectCreatingEventArgs args = new ObjectCreatingEventArgs(objectSpace, typeof(crmWorkPlan)); // // Запрет/разрешение стандартного создания объекта // args.Cancel = false; // //args.ShowDetailView = false; // DetailView не будет показан // e = args; // */ // #endregion //} //if (false) { // Првоерка 2. Пробуем заменить свойства аргумента e // // Без замены параметра e заменить тип создаваемого объекта не получилось // IObjectSpace objectSpace = e.ObjectSpace; // object newObj = objectSpace.CreateObject(e.ObjectType); // //newedObject = newObj; // // Здесь можно что-нибудь сделать с новосозданным объектом. // /* // crmWorkPlan wpObj = newObj as crmWorkPlan; // if (wpObj != null) { // crmWorkPlanVersion wpvObj = wpObj.Current as crmWorkPlanVersion; // if (wpObj != null && wpvObj != null) { // //wpObj.Current.crmContractDocument.Number = "№ " + System.DateTime.Now.ToString(); // wpvObj.Description = System.DateTime.Now.ToString(); // } // } // FM.Order.fmOrder orderObj = newObj as FM.Order.fmOrder; // if (orderObj != null) { // orderObj.Name = "Order № " + System.DateTime.Now.ToString(); // } // */ // // объект передаётся в CustomNewActionController_CustomAddObjectToCollection // e.NewObject = newObj; // //CollectionSource colSource = new CollectionSource(objectSpace, typeof(crmWorkPlan)); // //if (!colSource.IsLoaded) colSource.Reload(); // //ProcessNewObjectEventArgs pnoArgs = new ProcessNewObjectEventArgs(newObj, objectSpace, colSource); // //CustomNewActionController_CustomAddObjectToCollection(this, pnoArgs); //} }