Beispiel #1
0
        public static void StartDesktopServices()
        {
            ServiceLocator.GetCurrentLocator = () =>
            {
                if (_currentService == null)
                {
                    _currentService = new ServiceLocator();
                }
                return(_currentService);
            };

            ServiceLocator.Start = (IServiceLocator service) =>
            {
                IProfiler        profiler  = new DesktopProfiler();
                IApplicationHost host      = new DesktopApplicationHost(profiler);
                ILocalizer       localizer = new DesktopLocalizer();
                IDbContext       dbContext = new SqlDbContext(
                    profiler as IDataProfiler,
                    host as IDataConfiguration,
                    localizer as IDataLocalizer);
                IRenderer       renderer = new XamlRenderer(profiler);
                IWorkflowEngine wfEngine = new WorkflowEngine(host, dbContext);
                service.RegisterService <IProfiler>(profiler);
                service.RegisterService <IApplicationHost>(host);
                service.RegisterService <IDbContext>(dbContext);
                service.RegisterService <IRenderer>(renderer);
                service.RegisterService <IWorkflowEngine>(wfEngine);
            };
        }
Beispiel #2
0
 public static String GetVersions()
 {
     ClearError();
     try
     {
         return(DesktopApplicationHost.GetVersions());
     }
     catch (Exception ex)
     {
         SetLastError(ex);
     }
     return(String.Empty);
 }
Beispiel #3
0
        public static void StartDesktopServices()
        {
            // TODO: LOCALE
            CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("uk-UA");

            ServiceLocator.GetCurrentLocator = () =>
            {
                if (_currentService == null)
                {
                    _currentService = new ServiceLocator();
                }
                return(_currentService);
            };

            ServiceLocator.Start = (IServiceLocator service) =>
            {
                IProfiler profiler                   = new DesktopProfiler();
                DesktopApplicationHost host          = new DesktopApplicationHost(profiler);
                IUserLocale            userLocale    = new DesktopUserLocale();
                ILocalizer             localizer     = new DesktopLocalizer(host, userLocale);
                ITokenProvider         tokenProvider = new DesktopTokenProvider();
                IDbContext             dbContext     = new SqlDbContext(
                    profiler as IDataProfiler,
                    host as IDataConfiguration,
                    localizer as IDataLocalizer,
                    tenantManager: null,
                    tokenProvider: tokenProvider);                     /*host as ITenantManager*/
                IRenderer             renderer         = new XamlRenderer(profiler, host);
                IWorkflowEngine       wfEngine         = new WorkflowEngine(host, dbContext, null);
                IDataScripter         scripter         = new VueDataScripter(host, localizer);
                IUserStateManager     userStateManager = new DesktopUserStateManager(host, dbContext);
                ILicenseManager       licManager       = new DesktopLicenseManager(dbContext);
                IExternalDataProvider dataProvider     = new ExternalDataContext();
                service.RegisterService <IProfiler>(profiler);
                service.RegisterService <IApplicationHost>(host);
                service.RegisterService <IDbContext>(dbContext);
                service.RegisterService <IRenderer>(renderer);
                service.RegisterService <IWorkflowEngine>(wfEngine);
                service.RegisterService <IDataScripter>(scripter);
                service.RegisterService <ILocalizer>(localizer);
                service.RegisterService <IUserStateManager>(userStateManager);
                service.RegisterService <ISupportUserInfo>(host);
                service.RegisterService <ILicenseManager>(licManager);
                service.RegisterService <IExternalDataProvider>(dataProvider);
                service.RegisterService <ITokenProvider>(tokenProvider);
                service.RegisterService <IUserLocale>(userLocale);
                host.TenantId = 1;
            };
        }
Beispiel #4
0
        public static Int32 VerifyLicense()
        {
            try
            {
                String companyCode = DesktopApplicationHost.GetCompanyCode();
                var    licManager  = ServiceLocator.Current.GetService <ILicenseManager>();
                if (String.IsNullOrEmpty(companyCode))
                {
                    return((Int32)LicenseErrors.BadCompany);
                }
                var rc = licManager.VerifyLicense(companyCode);
                switch (rc)
                {
                case LicenseState.Ok:
                    return((Int32)LicenseErrors.NoError);

                case LicenseState.NotFound:
                    return((Int32)LicenseErrors.NotInstalled);

                case LicenseState.InvalidSignature:
                    return((Int32)LicenseErrors.BadSignature);

                case LicenseState.Expired:
                    return((Int32)LicenseErrors.Expired);

                case LicenseState.InvalidCompany:
                    return((Int32)LicenseErrors.BadCompany);

                case LicenseState.FileCorrupt:
                    return((Int32)LicenseErrors.FileCorrupt);
                }
                return((Int32)LicenseErrors.Unknown);
            }
            catch (Exception /*ex*/)
            {
                return((Int32)LicenseErrors.Unknown);
            }
        }
Beispiel #5
0
 public static void StartApplication(String cnnString)
 {
     TryCatch(() => DesktopApplicationHost.StartApplication(cnnString));
 }