static void Main() { #if EASYTEST DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register(); #endif Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached; if (Tracing.GetFileLocationFromSettings() == DevExpress.Persistent.Base.FileLocation.CurrentUserApplicationDataFolder) { Tracing.LocalUserAppDataPath = Application.LocalUserAppDataPath; } Tracing.Initialize(); P3TEKWindowsFormsApplication winApplication = new P3TEKWindowsFormsApplication(); // Refer to the https://documentation.devexpress.com/eXpressAppFramework/CustomDocument112680.aspx help article for more details on how to provide a custom splash form. //winApplication.SplashScreen = new DevExpress.ExpressApp.Win.Utils.DXSplashScreen("YourSplashImage.png"); SecurityAdapterHelper.Enable(); try { string connectionString = "net.tcp://127.0.0.1:1451/DataServer"; WcfSecuredClient wcfSecuredClient = new WcfSecuredClient(WcfDataServerHelper.CreateNetTcpBinding(), new EndpointAddress(connectionString)); MiddleTierClientSecurity security = new MiddleTierClientSecurity(wcfSecuredClient); security.IsSupportChangePassword = true; winApplication.Security = security; winApplication.CreateCustomObjectSpaceProvider += (s, e) => { e.ObjectSpaceProviders.Add(new MiddleTierServerObjectSpaceProvider(wcfSecuredClient)); e.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(winApplication.TypesInfo, null)); }; winApplication.Setup(); winApplication.Start(); wcfSecuredClient.Dispose(); } catch (Exception e) { winApplication.HandleException(e); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached; SecuredExportExampleWindowsFormsApplication winApplication = new SecuredExportExampleWindowsFormsApplication(); #if EASYTEST DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register(); var serverProcess = new System.Diagnostics.Process(); serverProcess.StartInfo.FileName = @"..\..\..\SecuredExportExample.MiddleTierSecurityServer\bin\EasyTest\SecuredExportExample.MiddleTierSecurityServer.exe"; serverProcess.Start(); System.Threading.Thread.Sleep(5000); #endif try { WcfDataServerHelper.AddKnownType(typeof(ExportPermissionRequest)); winApplication.ConnectionString = "net.tcp://127.0.0.1:1451/DataServer"; winApplication.DatabaseUpdateMode = DatabaseUpdateMode.Never; WcfSecuredClient wcfSecuredClient = new WcfSecuredClient(WcfDataServerHelper.CreateNetTcpBinding(), new EndpointAddress(winApplication.ConnectionString)); MiddleTierClientSecurity securityClient = new MiddleTierClientSecurity(wcfSecuredClient); securityClient.IsSupportChangePassword = true; winApplication.ApplicationName = "SecuredExportExample"; winApplication.Security = securityClient; winApplication.CreateCustomObjectSpaceProvider += (s, e) => { e.ObjectSpaceProvider = new MiddleTierServerObjectSpaceProvider(wcfSecuredClient); }; winApplication.Setup(); winApplication.Start(); wcfSecuredClient.Dispose(); } catch (Exception e) { winApplication.HandleException(e); } }