예제 #1
0
        private async void InitializeVoiceCommands()
        {
            string errorMessage = string.Empty;

            try
            {
                Uri         vcdUri = new Uri("ms-appx:///MyVoiceCommands.xml", UriKind.Absolute);
                StorageFile file   = await StorageFile.GetFileFromApplicationUriAsync(vcdUri);

                if (file != null)
                {
                    await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file);
                }
            }
            catch (Exception ex)
            {
                //voice command file not found or language not supported or file is invalid format (missing stuff), or capabilities not selected, etc etc
                errorMessage = ex.Message;
            }

            if (!string.IsNullOrEmpty(errorMessage))
            {
                await DisplayMessage(errorMessage);
            }
        }
예제 #2
0
        private async void RegisterVoiceCommands()
        {
            // SHOULD BE PERFORMED UNDER TRY/CATCH
            Uri         uriVoiceCommands = new Uri("ms-appx:///CortanaVCD.xml", UriKind.Absolute);
            StorageFile file             = await StorageFile.GetFileFromApplicationUriAsync(uriVoiceCommands);

            await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file);
        }
예제 #3
0
 /// <summary>
 /// 唯一构造函数
 /// </summary>
 /// <param name="logger">日志接口器</param>
 /// <param name="serializer">序列化接口器</param>
 /// <param name="apiaccesscontrol">api接入控制器</param>
 /// <param name="voiceCommandManager">语音指令管理器</param>
 /// <param name="trafficRestrictionManager">通行设置管理器</param>
 /// <param name="openGateReasonManager">开闸原因设置管理器</param>
 /// <param name="parkLotManager">车场管理器</param>
 public SystemSetController(ILogger logger, ISerializer serializer, APIAccessControl apiaccesscontrol,
                            VoiceCommandManager voiceCommandManager,
                            TrafficRestrictionManager trafficRestrictionManager,
                            OpenGateReasonManager openGateReasonManager,
                            ParkLotManager parkLotManager) : base(logger, serializer, apiaccesscontrol)
 {
     _voiceCommandManager       = voiceCommandManager;
     _trafficRestrictionManager = trafficRestrictionManager;
     _openGateReasonManager     = openGateReasonManager;
     _parkLotManager            = parkLotManager;
 }
예제 #4
0
        public static async void RegisterVcd()
        {
            try
            {
                StorageFile file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(VcdPath);

                await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.HResult + ex.Message);
            }
        }
        /// <summary>
        /// Installs the Voice Command Definition (VCD) file associated with the application.
        /// Based on OS version, installs a separate document based on version 1.0 of the schema or version 1.1.
        /// </summary>
        public static async void InstallVoiceCommands(string voiceCommandDefinitionPath = "ms-appx:///VoiceCommandDefinition_8.1.xml")
        {
            try {
                Uri vcdUri = new Uri(voiceCommandDefinitionPath);

                StorageFile voiceCommandDef = await StorageFile.GetFileFromApplicationUriAsync(vcdUri);

                await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(voiceCommandDef);
            }
            catch (Exception vcdEx) {
                Debug.WriteLine(vcdEx.Message);
            }
        }
예제 #6
0
        private async void RegisterVoiceCommands()
        {
            try
            {
                Uri         uriVoiceCommands = new Uri("ms-appx:///vcd.xml", UriKind.Absolute);
                StorageFile file             = await StorageFile.GetFileFromApplicationUriAsync(uriVoiceCommands);

                await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #7
0
        private async Task StartVoice()
        {
            var storageFile =
                await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///vcd.xml", UriKind.Absolute));

            try
            {
                await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(storageFile);
            }
            catch (Exception)
            {
                // ignore if not available
            }
        }
예제 #8
0
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.</param>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
#if WINDOWS_PHONE_APP
            // Install voice commands, safe to run on each new navigation
            if (e.NavigationMode == NavigationMode.New)
            {
                var voiceCommandFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///VoiceCommandDefinition_8.1.xml"));

                await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(voiceCommandFile);
            }
#endif

            this.navigationHelper.OnNavigatedTo(e);
        }
예제 #9
0
        private async void LoadCortana()
        {
            try
            {
                var storageFile =
                    await
                    StorageFile.GetFileFromApplicationUriAsync(
                        new Uri("ms-appx:///AudioticaCommands.xml"));

                await
                VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(
                    storageFile);
            }
            catch (FileNotFoundException) { }
        }
예제 #10
0
        /// <summary>
        /// Installs the Voice Command Definition (VCD) file associated with the application.
        /// Based on OS version, installs a separate document based on version 1.0 of the schema or version 1.1.
        /// </summary>
        private async void InstallVoiceCommands()
        {
            const string VcdPath = "ms-appx:///VoiceCommandDefinitions.xml";

            try
            {
                Uri vcdUri = new Uri(VcdPath);
                var file   = await StorageFile.GetFileFromApplicationUriAsync(vcdUri);

                await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file);

                App.LogAnalyticsEvent("InstallVoiceCommands", "OK", null, 0);
            }
            catch (Exception vcdEx)
            {
                Debug.WriteLine(vcdEx.ToString());
                this.StatusText.Text = "sorry, could not register voice commands - " + vcdEx.Message;

                GoogleAnalytics.EasyTracker.GetTracker().SendException("InstallVoiceCommands failed: " + vcdEx.Message, false);
            }
        }
예제 #11
0
        /// <summary>
        /// Install the voice commands
        /// </summary>
        private async void InstallVoiceCommands()
        {
            string error = string.Empty;

            try
            {
                const string Wp81VCDPath = "ms-appx:///VoiceCommandDefinition_SharePointCellenza.xml";
                Uri          vcdUri      = new Uri(Wp81VCDPath);
                StorageFile  file        = await StorageFile.GetFileFromApplicationUriAsync(vcdUri);

                await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file);
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
            if (string.IsNullOrEmpty(error) == false)
            {
                MessageDialog dialog = new MessageDialog("Error during voice command installation: " + error);
                await dialog.ShowAsync();
            }
        }
예제 #12
0
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (Debugger.IsAttached)
            {
                DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Navigate(e);
            try
            {
                Uri         uriVoiceCommands = new Uri("ms-appx:///VoiceCommands.xml", UriKind.Absolute);
                StorageFile file             = await StorageFile.GetFileFromApplicationUriAsync(uriVoiceCommands);

                await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(file);
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
            }
        }
예제 #13
0
        /// <summary>
        /// Register the VCD with Cortana.
        /// </summary>
        private async void RegisterVoiceCommandsAsync()
        {
            var storageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///vcd.xml"));

            await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(storageFile);
        }
예제 #14
0
        private async Task InstallVoiceCommandsAsync()
        {
            var storageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Cortana.xml"));

            await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(storageFile);
        }
예제 #15
0
 // Use this for initialization
 void Start()
 {
     voiceCommandManager = ObjectToToggle.GetComponent <VoiceCommandManager>();
 }
예제 #16
0
        private async void FirstTimeSetup()
        {
            var storageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Voice/VoiceCommandDefinitions.xml"));

            await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(storageFile);
        }
예제 #17
0
파일: Settings.cs 프로젝트: dumbie/RemoteMe
        //Check - Application Settings
        async Task SettingsCheck()
        {
            try
            {
                //Check - Screen always on
                if (!vApplicationSettings.ContainsKey("ScreenAlwaysOn"))
                {
                    vApplicationSettings["ScreenAlwaysOn"] = false;
                }

                //Check - Volume Skip Amount
                if (!vApplicationSettings.ContainsKey("VolSkip"))
                {
                    vApplicationSettings["VolSkip"] = "2";
                }

                //Check - Remote Screen Location
                if (!vApplicationSettings.ContainsKey("RemoteLocation"))
                {
                    if (AVFunctions.DevMobile())
                    {
                        vApplicationSettings["RemoteLocation"] = 2;
                    }
                    else
                    {
                        vApplicationSettings["RemoteLocation"] = 0;
                    }
                }

                //Check - Close app Tile/Voice
                if (!vApplicationSettings.ContainsKey("CmdCloseApp"))
                {
                    vApplicationSettings["CmdCloseApp"] = false;
                }

                //Check - Server ip adres
                if (!vApplicationSettings.ContainsKey("ServerIp"))
                {
                    vApplicationSettings["ServerIp"] = "192.168.0.";
                }

                //Check - Server port Arnold
                if (!vApplicationSettings.ContainsKey("ServerPort"))
                {
                    vApplicationSettings["ServerPort"] = "1000";
                }

                //Check - Server port AmbiPro
                if (!vApplicationSettings.ContainsKey("ServerPortAmbiPro"))
                {
                    vApplicationSettings["ServerPortAmbiPro"] = "1020";
                }

                //Load and check - Voice Commands for Cortana - Not awaiting to avoid slow startup
                try
                {
                    VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///VoiceCommands.xml")));
                    Debug.WriteLine("Successfully registered the Cortana voice commands.");
                }
                catch
                {
                    Debug.WriteLine("Failed to register the Cortana voice commands.");
                }
            }
            catch (Exception Ex)
            {
                await new MessageDialog("SettingsCheckError: " + Ex.Message, App.vApplicationName).ShowAsync();
            }
        }