Пример #1
0
        public static Task <string> Activate(string componentName, IDictionary <string, object> args)
        {
            var referenceId = Guid.NewGuid().ToString().Split('-').Last();

            ActivationService?.ActivateComponent(componentName, referenceId, args);
            return(Task.FromResult(referenceId));
        }
Пример #2
0
        private async void LoadDataAsync(IActivatedEventArgs e)
        {
            var activationInfo = ActivationService.GetActivationInfo(e);

            await Startup.ConfigureAsync();

            var shellArgs = new ShellArgs
            {
                ViewModel = activationInfo.EntryViewModel,
                Parameter = activationInfo.EntryArgs,
                UserInfo  = await TryGetUserInfoAsync(e as IActivatedEventArgsWithUser)
            };

#if SKIP_LOGIN
            rootFrame.Navigate(typeof(MainShellView), shellArgs);
            var loginService = ServiceLocator.Current.GetService <ILoginService>();
            loginService.IsAuthenticated = true;
#else
            rootFrame.Navigate(typeof(LoginView), shellArgs);
#endif

            Window.Current.Content = rootFrame;

            Window.Current.Activate();
        }
Пример #3
0
 public CohortController()
 {
     _activation = Config.Container.Resolve <ActivationService>(); //new ActivationService(user, auth, activation);
     _accounts   = Config.Container.Resolve <AccountService>();    // (new AccountService(user, security, auth));
     _email      = Config.Container.Resolve <EmailService>();      ////new EmailService(Cohort.Email.Engine, Cohort.Email.Provider, new EmailRepository());
     _stripe     = Config.Container.Resolve <StripeService>();
 }
Пример #4
0
        private ActivationService CreateActivationService()
        {
            var x = new ActivationService(this, typeof(ViewModels.SeriesViewModel));

            x = null;
            return(new ActivationService(this, typeof(ViewModels.LibraryViewModel)));
        }
Пример #5
0
 internal ActorRuntime(IActorSystem system, ActorEndpoint endpoint)
 {
     System      = system;
     Timers      = new TimerService(endpoint);
     Reminders   = new ReminderService(endpoint);
     Activation  = new ActivationService(endpoint);
 }
Пример #6
0
 protected override async void OnLaunched(LaunchActivatedEventArgs args)
 {
     if (!args.PrelaunchActivated)
     {
         await ActivationService.ActivateAsync(args);
     }
 }
Пример #7
0
        private async Task ActivateAsync(IActivatedEventArgs e)
        {
            var activationInfo = ActivationService.GetActivationInfo(e);

            var frame = Window.Current.Content as Frame;

            if (frame == null)
            {
                await Startup.ConfigureAsync();

                frame = new Frame();
                Window.Current.Content = frame;
                var shellArgs = new ShellArgs
                {
                    ViewModel = activationInfo.EntryViewModel,
                    Parameter = activationInfo.EntryArgs,
                    UserInfo  = await TryGetUserInfoAsync(e as IActivatedEventArgsWithUser)
                };
#if SKIP_LOGIN
                frame.Navigate(typeof(MainShellView), shellArgs);
                var loginService = ServiceLocator.Current.GetService <ILoginService>();
                loginService.IsAuthenticated = true;
#else
                frame.Navigate(typeof(LoginView), shellArgs);
#endif
                Window.Current.Activate();
            }
            else
            {
                var navigationService = ServiceLocator.Current.GetService <INavigationService>();
                await navigationService.CreateNewViewAsync(activationInfo.EntryViewModel, activationInfo.EntryArgs);
            }
        }
Пример #8
0
        private async System.Threading.Tasks.Task ActivateAsync(IActivatedEventArgs e)
        {
            if (!(Window.Current.Content is Frame rootFrame))
            {
                rootFrame = CreateRootFrame(e);
                Window.Current.Content = rootFrame;
            }

            ThemeSettingsService.Initialize();
            EditorSettingsService.Initialize();

            var appLaunchSettings = new Dictionary <string, string>()
            {
                {
                    "UseWindowsTheme", ThemeSettingsService.UseWindowsTheme.ToString()
                },
                {
                    "ThemeMode", ThemeSettingsService.ThemeMode.ToString()
                },
                {
                    "UseWindowsAccentColor", ThemeSettingsService.UseWindowsAccentColor.ToString()
                },
                {
                    "AppBackgroundTintOpacity", $"{(int) (ThemeSettingsService.AppBackgroundPanelTintOpacity * 100.0)}"
                },
                {
                    "ShowStatusBar", EditorSettingsService.ShowStatusBar.ToString()
                },
                {
                    "EditorDefaultLineEnding", EditorSettingsService.EditorDefaultLineEnding.ToString()
                },
                {
                    "EditorDefaultEncoding", EncodingUtility.GetEncodingName(EditorSettingsService.EditorDefaultEncoding)
                },
                {
                    "EditorDefaultTabIndents", EditorSettingsService.EditorDefaultTabIndents.ToString()
                },
                {
                    "EditorDefaultDecoding", EncodingUtility.GetEncodingName(EditorSettingsService.EditorDefaultDecoding)
                },
                {
                    "EditorFontFamily", EditorSettingsService.EditorFontFamily
                },
                {
                    "EditorFontSize", EditorSettingsService.EditorFontSize.ToString()
                },
                {
                    "IsSessionSnapshotEnabled", EditorSettingsService.IsSessionSnapshotEnabled.ToString()
                },
            };

            LoggingService.LogInfo($"AppLaunchSettings: {string.Join(";", appLaunchSettings.Select(x => x.Key + "=" + x.Value).ToArray())}");
            Analytics.TrackEvent("AppLaunch_Settings", appLaunchSettings);

            await ActivationService.ActivateAsync(rootFrame, e);

            Window.Current.Activate();
            ExtendAcrylicIntoTitleBar();
        }
Пример #9
0
        public static Task UnloadComponentsFromLibrary(string name)
        {
            var assemblies = AppDomain.CurrentDomain.GetAssemblies();
            var assembly   = assemblies.FirstOrDefault(m => m.FullName == name);

            ActivationService?.UnregisterAll(assembly);
            return(Task.FromResult(true));
        }
Пример #10
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            if (ApplicationData.Current.LocalSettings.Values.ContainsKey(StoredAccountKey))
            {
                ActivationService.Initalise();


                // Do not repeat app initialization when the Window already has content,
                // just ensure that the window is active
                if (!(Window.Current.Content is AppShell shell))
                {
                    // Create a AppShell to act as the navigation context and navigate to the first page
                    shell = new AppShell();

                    shell.AppFrame.NavigationFailed += OnNavigationFailed;

                    if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                    {
                        //ApplicationData.Current.LocalSettings.Values["PreviouslyLaunched"] = false;
                        //TODO: Load state from previously suspended application
                    }
                }

                // Place our app shell in the current Window
                Window.Current.Content = shell;

                if (shell.AppFrame.Content == null)
                {
                    shell.AppFrame.Navigate(typeof(Views.Overview.MainPage));
                }
            }
            else
            {
                if (!(Window.Current.Content is Frame rootFrame))
                {
                    rootFrame = new Frame();

                    rootFrame.NavigationFailed += OnNavigationFailed;

                    if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                    {
                        //TODO: Load state from previously suspended application
                    }

                    Window.Current.Content = rootFrame;
                }

                if (e.PrelaunchActivated == false)
                {
                    if (rootFrame.Content == null)
                    {
                        rootFrame.Navigate(typeof(Views.SignIn.MainPage), e.Arguments);
                    }
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
Пример #11
0
        public static Task LoadComponentsFromLibrary(string data)
        {
            var bytes     = Convert.FromBase64String(data);
            var assembly  = Assembly.Load(bytes);
            var container = ContainerService?.Configure(assembly);

            ActivationService?.RegisterAll(assembly, container);
            return(Task.FromResult(true));
        }
Пример #12
0
        /// <summary>
        /// Invoked when the application is activated by some means other than normal launching.
        /// </summary>
        /// <param name="args">Event data for the event.</param>
        protected override async void OnActivated(IActivatedEventArgs args)
        {
            Debug.WriteLine("OnActivated()");
            //isActivating = true;
            if (args.Kind == ActivationKind.VoiceCommand)
            {
                // The arguments can represent many different activation types. Cast it so we can get the
                // parameters we care about out.
                var commandArgs = args as VoiceCommandActivatedEventArgs;

                Windows.Media.SpeechRecognition.SpeechRecognitionResult speechRecognitionResult = commandArgs.Result;

                // Get the name of the voice command and the text spoken. See AdventureWorksCommands.xml for
                // the <Command> tags this can be filled with.
                string voiceCommandName = speechRecognitionResult.RulePath[0];
                string textSpoken       = speechRecognitionResult.Text;

                //Action(textSpoken);

                /*
                 * switch (voiceCommandName)
                 * {
                 *  case "lockDevice":
                 *      Action(textSpoken);
                 *      break;
                 *
                 *  default:
                 *      // If we can't determine what page to launch, go to the default entry point.
                 *
                 *      break;
                 * }
                 */
            }
            else if (args.Kind == ActivationKind.Protocol)
            {
                //var commandArgs = args as ProtocolActivatedEventArgs;
                //Windows.Foundation.WwwFormUrlDecoder decoder = new Windows.Foundation.WwwFormUrlDecoder(commandArgs.Uri.Query);
                //var param = decoder.GetFirstValueByName("LaunchContext");
                //EndDevice test = JsonConvert.DeserializeObject<EndDevice>(param);

                //XBeeAction.PowerOff(Convert.ToUInt64(test.MacAddress), test.EndPointId);

                //var protocolEventArgs = args as ProtocolActivatedEventArgs;

                //switch (protocolEventArgs.Uri.Scheme)
                //{
                //    case "main-launchapplist":
                //        NavigationService.Navigate("IOTOIApp.ViewModels.AppListViewModel", "");
                //        break;
                //}
            }
            else
            {
                await ActivationService.ActivateAsync(args);
            }
        }
Пример #13
0
        protected override async void OnActivated(IActivatedEventArgs args)
        {
            // initialize our services
            InitializeServices();

            // load our styles
            LoadStyles();

            await ActivationService.ActivateAsync(args);
        }
Пример #14
0
        protected override async void OnActivated(IActivatedEventArgs args)
        {
            // initialize config, localization, and telemetry services
            InitializeServices();

            // load styles
            LoadAppResourceDictionaries();

            await ActivationService.ActivateAsync(args);
        }
Пример #15
0
        private async System.Threading.Tasks.Task ActivateAsync(IActivatedEventArgs e)
        {
            if (!(Window.Current.Content is Frame rootFrame))
            {
                rootFrame = CreateRootFrame(e);
                Window.Current.Content = rootFrame;
            }

            ThemeSettingsService.Initialize();
            EditorSettingsService.Initialize();

            Analytics.TrackEvent("AppLaunch_Settings", new Dictionary <string, string>()
            {
                {
                    "UseWindowsTheme", ThemeSettingsService.UseWindowsTheme.ToString()
                },
                {
                    "ThemeMode", ThemeSettingsService.ThemeMode.ToString()
                },
                {
                    "UseWindowsAccentColor", ThemeSettingsService.UseWindowsAccentColor.ToString()
                },
                {
                    "AppBackgroundTintOpacity", $"{(int)(ThemeSettingsService.AppBackgroundPanelTintOpacity * 100.0)}"
                },
                {
                    "ShowStatusBar", EditorSettingsService.ShowStatusBar.ToString()
                },
                {
                    "EditorDefaultLineEnding", EditorSettingsService.EditorDefaultLineEnding.ToString()
                },
                {
                    "EditorDefaultEncoding", EncodingUtility.GetEncodingBodyName(EditorSettingsService.EditorDefaultEncoding)
                },
                {
                    "EditorDefaultTabIndents", EditorSettingsService.EditorDefaultTabIndents.ToString()
                },
                {
                    "EditorDefaultDecoding", EncodingUtility.GetEncodingBodyName(EditorSettingsService.EditorDefaultDecoding)
                },
                {
                    "EditorFontFamily", EditorSettingsService.EditorFontFamily
                },
                {
                    "EditorFontSize", EditorSettingsService.EditorFontSize.ToString()
                },
            });

            await ActivationService.ActivateAsync(rootFrame, e);

            //await LoggingService.InitializeAsync();

            Window.Current.Activate();
            ExtendAcrylicIntoTitleBar();
        }
Пример #16
0
        private async System.Threading.Tasks.Task ActivateAsync(IActivatedEventArgs e)
        {
            bool rootFrameCreated = false;

            if (!(Window.Current.Content is Frame rootFrame))
            {
                rootFrame = CreateRootFrame(e);
                Window.Current.Content = rootFrame;
                rootFrameCreated       = true;

                ThemeSettingsService.Initialize();
                EditorSettingsService.Initialize();
            }

            var appLaunchSettings = new Dictionary <string, string>()
            {
                { "OSArchitecture", SystemInformation.OperatingSystemArchitecture.ToString() },
                { "UseWindowsTheme", ThemeSettingsService.UseWindowsTheme.ToString() },
                { "ThemeMode", ThemeSettingsService.ThemeMode.ToString() },
                { "UseWindowsAccentColor", ThemeSettingsService.UseWindowsAccentColor.ToString() },
                { "AppBackgroundTintOpacity", $"{(int) (ThemeSettingsService.AppBackgroundPanelTintOpacity * 100.0)}" },
                { "ShowStatusBar", EditorSettingsService.ShowStatusBar.ToString() },
                { "EditorDefaultLineEnding", EditorSettingsService.EditorDefaultLineEnding.ToString() },
                { "EditorDefaultEncoding", EncodingUtility.GetEncodingName(EditorSettingsService.EditorDefaultEncoding) },
                { "EditorDefaultTabIndents", EditorSettingsService.EditorDefaultTabIndents.ToString() },
                { "EditorDefaultDecoding", EditorSettingsService.EditorDefaultDecoding == null ? "Auto" : EncodingUtility.GetEncodingName(EditorSettingsService.EditorDefaultDecoding) },
                { "EditorFontFamily", EditorSettingsService.EditorFontFamily },
                { "EditorFontSize", EditorSettingsService.EditorFontSize.ToString() },
                { "IsSessionSnapshotEnabled", EditorSettingsService.IsSessionSnapshotEnabled.ToString() },
                { "IsShadowWindow", (!IsFirstInstance && !IsGameBarWidget).ToString() },
                { "IsGameBarWidget", IsGameBarWidget.ToString() },
                { "AlwaysOpenNewWindow", EditorSettingsService.AlwaysOpenNewWindow.ToString() },
                { "IsHighlightMisspelledWordsEnabled", EditorSettingsService.IsHighlightMisspelledWordsEnabled.ToString() },
                { "IsLineHighlighterEnabled", EditorSettingsService.IsLineHighlighterEnabled.ToString() },
                { "EditorDefaultSearchEngine", EditorSettingsService.EditorDefaultSearchEngine.ToString() }
            };

            LoggingService.LogInfo($"AppLaunchSettings: {string.Join(";", appLaunchSettings.Select(x => x.Key + "=" + x.Value).ToArray())}");
            Analytics.TrackEvent("AppLaunch_Settings", appLaunchSettings);

            try
            {
                await ActivationService.ActivateAsync(rootFrame, e);
            }
            catch (Exception ex)
            {
                throw new Exception("AppFailedToActivate", ex);
            }

            if (rootFrameCreated)
            {
                Window.Current.Activate();
                ExtendAcrylicIntoTitleBar();
            }
        }
Пример #17
0
 public List <Activation> GetActivationsByLicenseId(int id)
 {
     try
     {
         return(ActivationService.GetActivationsByLicenseId(id));
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #18
0
 public Activation ActivateLicense(int licenseId, string cpuID)
 {
     try
     {
         return(ActivationService.ActivateLicense(licenseId, cpuID));
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #19
0
 public string AddActivation(ActivationParams p)
 {
     try
     {
         return(ActivationService.CreateActivation(p).ToString());
     }
     catch (Exception ex)
     {
         return(string.Format("Error: {0}", ex.Message));
     }
 }
Пример #20
0
 public Activation GetActivationById(int activationId)
 {
     try
     {
         return(ActivationService.GetActivationById(activationId));
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #21
0
 public string SaveActivationCode(int activationId, string activationCode)
 {
     try
     {
         return(ActivationService.SaveActivationCode(activationId, activationCode).ToString());
     }
     catch (Exception ex)
     {
         return(string.Format("Error: {0}{1}{2}", ex.Message, Environment.NewLine, ex.InnerException.ToString()));
     }
 }
Пример #22
0
 public string SaveActivation(ActivationParams p)
 {
     try
     {
         return(ActivationService.SaveActivation(p).ToString());
     }
     catch (Exception ex)
     {
         return(string.Format("Error: {0}{1}{2}", ex.Message, Environment.NewLine, ex.InnerException.ToString()));
     }
 }
Пример #23
0
 public HomeForm()
 {
     //Création du dossier de données
     if (!Directory.Exists(AppData))
     {
         Directory.CreateDirectory(AppData);
     }
     //Le service d'activation du logiciel
     als = new ActivationService("h61v6b7f", "ouatelse", "Ouatelse", Path.Combine(AppData, "ouatelse-eaf"));
     InitializeComponent();
     Utils.SetNotifyIcon(this.notifyIcon1);
 }
Пример #24
0
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            ApplicationLanguages.PrimaryLanguageOverride =
                AppSettings.UsePrimaryLanguageOverride ?
                AppSettings.PrimaryLanguageOverride :
                Windows.System.UserProfile.GlobalizationPreferences.Languages[0];

            if (!e.PrelaunchActivated)
            {
                await ActivationService.ActivateAsync(e);
            }
        }
Пример #25
0
 public string IsActivated(int licenseId, string cpuId)
 {
     try
     {
         ActivationService.IsActivated(licenseId, cpuId);
         return("true");
     }
     catch (Exception ex)
     {
         return(string.Format("Error: {0}", ex.Message));
     }
 }
Пример #26
0
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            // initialize our services
            InitializeServices();

            // load our styles
            LoadStyles();

            if (!args.PrelaunchActivated)
            {
                await ActivationService.ActivateAsync(args);
            }
        }
        private async Task InitializeAsync()
        {
            await ActivationService.InitializeAsync();

            var result = await DbUpdateService.DownloadIfAppropriateAsync().ConfigureAwait(true);

            if (result)
            {
                DismissExtendedSplash();

                await ActivationService.StartupAsync();
            }
        }
Пример #28
0
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            if (!e.PrelaunchActivated)
            {
                await ActivationService.ActivateAsync(e);
            }
            else
            {
                await FontFinder.LoadFontsAsync();

                await Ioc.Default.GetService <UserCollectionsService>().LoadCollectionsAsync();
            }
        }
Пример #29
0
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            if (!args.PrelaunchActivated)
            {
                await ActivationService.ActivateAsync(args);

                InitEnvironment();
                await m_Environment.InitializeUserAsync();

                // periodic timer for delete fingerevents < 14 days ago
                TimeSpan period = TimeSpan.FromHours(12); // alle 12 h schauen
                m_Environment.startDeleteFingerEventsTimer(period);
            }
        }
Пример #30
0
        private async System.Threading.Tasks.Task ActivateAsync(IActivatedEventArgs e)
        {
            if (!(Window.Current.Content is Frame rootFrame))
            {
                rootFrame = CreateRootFrame(e);
                Window.Current.Content = rootFrame;
            }

            ThemeSettingsService.Initialize();
            EditorSettingsService.Initialize();

            await ActivationService.ActivateAsync(rootFrame, e);

            Window.Current.Activate();
            ExtendAcrylicIntoTitleBar();
        }
Пример #31
0
        private async void LoadDataAsync(IActivatedEventArgs e)
        {
            var activationInfo = ActivationService.GetActivationInfo(e);

            await Startup.ConfigureAsync();

            var shellArgs = new ShellArgs
            {
                ViewModel = activationInfo.EntryViewModel,
                Parameter = activationInfo.EntryArgs,
                UserInfo  = await TryGetUserInfoAsync(e as IActivatedEventArgsWithUser)
            };

            rootFrame.Navigate(typeof(LoginView), shellArgs);
            Window.Current.Content = rootFrame;
            Window.Current.Activate();
        }
            public void Before_each_test()
            {
                clientLicenseRepoistory = new ClientLicenseRepository(objectSerializationProvider, symmetricEncryptionProvider);
                clientLicenseService = new ClientLicenseService(clientLicenseRepoistory);
                serviceProductsRepository = new ServiceProductsRepository(new ScutexServiceEntities());
                symmetricEncryptionProvider = new SymmetricEncryptionProvider();
                asymmetricEncryptionProvider = new AsymmetricEncryptionProvider();
                hashingProvider = new HashingProvider();
                objectSerializationProvider = new ObjectSerializationProvider();
                numberDataGenerator = new NumberDataGenerator();
                packingService = new PackingService(numberDataGenerator);
                commonRepository = new CommonRepository(new ScutexServiceEntities());
                clientRepository = new ClientRepository(new ScutexServiceEntities());
                keyGenerator = new KeyGenerator(symmetricEncryptionProvider, asymmetricEncryptionProvider, hashingProvider);
                masterService = new MasterService(commonRepository);
                activationLogRepository = new ActivationLogRepoistory(new ScutexServiceEntities());

                activationLogService = new ActivationLogService(activationLogRepository, hashingProvider);
                keyService = new KeyManagementService(clientRepository, licenseKeyService, activationLogService, hashingProvider, serviceProductsRepository);
                commonService = new CommonService();

                string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
                path = path.Replace("file:\\", "");

                var mockCommonService = new Mock<ICommonService>();
                mockCommonService.Setup(common => common.GetPath()).Returns(path + "\\Data\\Client\\");

                string masterServiceDataText;

                using (TextReader reader = new StreamReader(path + "\\Data\\MasterService.dat"))
                {
                    masterServiceDataText = reader.ReadToEnd().Trim();
                }

                masterServiceData = objectSerializationProvider.Deserialize<MasterServiceData>(masterServiceDataText);

                var mockCommonRepository = new Mock<ICommonRepository>();
                mockCommonRepository.Setup(repo => repo.GetMasterServiceData()).Returns(masterServiceData);

                keyPairService = new KeyPairService(mockCommonService.Object, mockCommonRepository.Object);
                controlService = new ControlService(symmetricEncryptionProvider, keyPairService, packingService, masterService, objectSerializationProvider, asymmetricEncryptionProvider);
                servicesRepository = new ServicesRepository(new ScutexEntities());
                serviceStatusProvider = new ServiceStatusProvider(symmetricEncryptionProvider, objectSerializationProvider, asymmetricEncryptionProvider);
                licenseActiviationProvider = new LicenseActiviationProvider(asymmetricEncryptionProvider, symmetricEncryptionProvider, objectSerializationProvider);
                servicesService = new ServicesService(servicesRepository, serviceStatusProvider, packingService, licenseActiviationProvider, null, null, null, null, null);
                licenseKeyService = new LicenseKeyService(keyGenerator, packingService, clientLicenseService);
                activationService = new ActivationService(controlService, keyService, keyPairService, objectSerializationProvider, asymmetricEncryptionProvider, null, null);

                string serviceData;

                using (TextReader reader = new StreamReader(path + "\\Data\\Service.dat"))
                {
                    serviceData = reader.ReadToEnd().Trim();
                }

                service = objectSerializationProvider.Deserialize<Service>(serviceData);
            }