[DevExpress Support Team: CLONED FROM Q94961: How to reuse XAF Views and other standard module functionality in non-XAF apps, forms or controls]
I'm trying to use the example that you shared. Unfortunately, when creating everything you need, all data is protected. What should I do to be able to edit a new object?
Ps. I created an Add-In for Outlook to be able to add a button to the ribbon, and then after clicking the button, launch the XAF> application
C#public partial class Ribbon
{
XPObjectSpaceProvider directProvider = null;
ExpressAppWindowsFormsApplication theXafApplication = null;
private void Ribbon_Load(object sender, RibbonUIEventArgs e)
{
XpoTypesInfoHelper.GetXpoTypeInfoSource();
XafTypesInfo.Instance.RegisterEntity(typeof(IEDBaseObject));
directProvider = new XPObjectSpaceProvider(DevExpress.Xpo.DB.MSSqlConnectionProvider.GetConnectionString("DESKTOP-GU9BP9N\\SQLEXPRESS01", "sa", "!sql2017", "core"), null);
theXafApplication = new ExpressAppWindowsFormsApplication();
theXafApplication.SplashScreen = null;
theXafApplication.ShowViewStrategy = new ShowInMultipleWindowsStrategy(theXafApplication);
//theXafApplication.ConnectionString = ConfigurationManager.ConnectionStrings["XpoConnectionStringFromAppConfig"].ConnectionString;
//theXafApplication.ConnectionString = DevExpress.ExpressApp.Xpo.InMemoryDataStoreProvider.ConnectionString;//Dennis: For demo purposes only.
theXafApplication.ConnectionString = DevExpress.Xpo.DB.MSSqlConnectionProvider.GetConnectionString("", "", "", "");
theXafApplication.Setup();
}
private void Button1_Click(object sender, RibbonControlEventArgs e)
{
IObjectSpace objectSpace = theXafApplication.CreateObjectSpace(typeof(IEDBaseObject));
IEDBaseObject obj = objectSpace.CreateObject<IEDBaseObject>();
obj.Sygnatura = "TEST";
//obj.Save();
//objectSpace.CommitChanges();
ShowViewParameters svp = new ShowViewParameters();
DetailView dv = theXafApplication.CreateDetailView(objectSpace, obj, true);
dv.ViewEditMode = DevExpress.ExpressApp.Editors.ViewEditMode.Edit;
svp.CreatedView = dv;
svp.TargetWindow = TargetWindow.NewWindow;
theXafApplication.ShowViewStrategy.ShowView(svp, new ShowViewSource(theXafApplication.CreateFrame(TemplateContext.View), null));
}
}
how can I run the application without logging in with administrator rights? or to bypass the safety of types?
I have one more question:
will my plugin stop working after the automatic update of the application? I would not want to force end users to change the Outlook plugin after each application update.
>> how can I run the application without logging in with administrator rights? or to bypass the safety of types?
If you are using Security System, it is necessary to authenticate a user before starting the application. Try the solution provided at Q418121 - Pass login arguments to application.
>> will my plugin stop working after the automatic update of the application?
I do not have experience with the Outlook Add-In development, so I am afraid I cannot answer this question. However, if you distribute an XAF application as a .NET assembly file that is loaded by the Add-In, I expect that updating the application should be as simple as replacing the existing assembly with a new version.