Example #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);
            }
        }
Example #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);
        }
Example #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;
 }
Example #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);
            }
        }
Example #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;
            }
        }
        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
            }
        }
Example #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);
        }
Example #9
0
        private async void LoadCortana()
        {
            try
            {
                var storageFile =
                    await
                    StorageFile.GetFileFromApplicationUriAsync(
                        new Uri("ms-appx:///AudioticaCommands.xml"));

                await
                VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(
                    storageFile);
            }
            catch (FileNotFoundException) { }
        }
Example #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);
            }
        }
        /// <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();
            }
        }
Example #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);
            }
        }
Example #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);
        }
Example #14
0
        private async Task InstallVoiceCommandsAsync()
        {
            var storageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Cortana.xml"));

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

            await VoiceCommandManager.InstallCommandSetsFromStorageFileAsync(storageFile);
        }
Example #17
0
        //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();
            }
        }