コード例 #1
0
ファイル: SettingsViewModel.cs プロジェクト: nagyistge/See4Me
        public SettingsViewModel(CognitiveClient cognitiveClient, ILauncherService launcherService)
        {
            this.cognitiveClient = cognitiveClient;
            this.launcherService = launcherService;

            this.CreateCommands();
        }
コード例 #2
0
        public MainViewModel(CognitiveClient cognitiveClient, IStreamingService streamingService, ISpeechService speechService)
        {
            this.cognitiveClient  = cognitiveClient;
            this.streamingService = streamingService;
            this.speechService    = speechService;

            this.CreateCommands();
        }
コード例 #3
0
        public RecognizeTextViewModel(CognitiveClient cognitiveClient, IMediaPicker mediaPicker, ISpeechService speechService)
        {
            this.cognitiveClient = cognitiveClient;
            this.mediaPicker     = mediaPicker;
            this.speechService   = speechService;

            this.CreateCommands();
        }
コード例 #4
0
ファイル: ViewModelLocator.cs プロジェクト: nagyistge/See4Me
        static ViewModelLocator()
        {
            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

            SimpleIoc.Default.Register <CognitiveClient>(() =>
            {
                VisionSettings visionSettings = null;
                using (var stream = typeof(ViewModelLocator).GetTypeInfo().Assembly.GetManifestResourceStream(Constants.VisionSettingsFile))
                {
                    using (var reader = new StreamReader(stream))
                        visionSettings = JsonConvert.DeserializeObject <VisionSettings>(reader.ReadToEnd());
                }

                var visionSettingsProvider = new SimpleVisionSettingsProvider(visionSettings);
                var cognitiveClient        = new CognitiveClient(visionSettingsProvider);

                var cognitiveSettings = cognitiveClient.Settings;
                cognitiveSettings.EmotionSubscriptionKey    = ServiceKeys.EmotionSubscriptionKey;
                cognitiveSettings.VisionSubscriptionKey     = ServiceKeys.VisionSubscriptionKey;
                cognitiveSettings.FaceSubscriptionKey       = ServiceKeys.FaceSubscriptionKey;
                cognitiveSettings.TranslatorSubscriptionKey = ServiceKeys.TranslatorSubscriptionKey;

                return(cognitiveClient);
            });

            SimpleIoc.Default.Register <ISpeechService>(() =>
            {
                var language = GetLanguage();
                var service  = new SpeechService {
                    Language = language
                };
                return(service);
            });

            SimpleIoc.Default.Register <Services.IDialogService, Services.DialogService>();
            SimpleIoc.Default.Register <IStreamingService, StreamingService>();
            SimpleIoc.Default.Register <ISettingsService, SettingsService>();
            SimpleIoc.Default.Register <INetworkService, NetworkService>();
            SimpleIoc.Default.Register <ILauncherService, LauncherService>();
            SimpleIoc.Default.Register <IAppService, AppService>();
            SimpleIoc.Default.Register <IMediaPicker, MediaPicker>();

            SimpleIoc.Default.Register <MainViewModel>();
            SimpleIoc.Default.Register <SettingsViewModel>();
            SimpleIoc.Default.Register <AboutViewModel>();
            SimpleIoc.Default.Register <RecognizeTextViewModel>();
            SimpleIoc.Default.Register <PrivacyViewModel>();

            OnInitialize();
        }
コード例 #5
0
        static ViewModelLocator()
        {
            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

            SimpleIoc.Default.Register <CognitiveClient>(() =>
            {
                var visionSettingsProvider = new LocalVisionSettingsProvider();
                var cognitiveClient        = new CognitiveClient(visionSettingsProvider);

                var cognitiveSettings = cognitiveClient.Settings;
                cognitiveSettings.EmotionSubscriptionKey    = ServiceKeys.EmotionSubscriptionKey;
                cognitiveSettings.VisionSubscriptionKey     = ServiceKeys.VisionSubscriptionKey;
                cognitiveSettings.TranslatorSubscriptionKey = ServiceKeys.TranslatorSubscriptionKey;

                return(cognitiveClient);
            });

            SimpleIoc.Default.Register <ISpeechService>(() =>
            {
                var language = GetLanguage();
                var service  = new SpeechService {
                    Language = language
                };
                return(service);
            });

            SimpleIoc.Default.Register <Services.IDialogService, Services.DialogService>();
            SimpleIoc.Default.Register <IStreamingService, StreamingService>();
            SimpleIoc.Default.Register <ISettingsService, SettingsService>();
            SimpleIoc.Default.Register <INetworkService, NetworkService>();
            SimpleIoc.Default.Register <ILauncherService, LauncherService>();
            SimpleIoc.Default.Register <IAppService, AppService>();
            SimpleIoc.Default.Register <IMediaPicker, MediaPicker>();

            SimpleIoc.Default.Register <MainViewModel>();
            SimpleIoc.Default.Register <SettingsViewModel>();
            SimpleIoc.Default.Register <AboutViewModel>();
            SimpleIoc.Default.Register <RecognizeTextViewModel>();
            SimpleIoc.Default.Register <PrivacyViewModel>();

            OnInitialize();
        }
コード例 #6
0
 public AssistantBotDialog()
 {
     _cognitiveClient = new CognitiveClient();
 }