コード例 #1
0
        ///<summary>
        ///Initializes the Tobii Controller
        /// </summary>
        ///<returns>
        ///false if for any reason the initialization did not complete successfully, true otherwise.
        ///</returns>
        public bool Init()
        {
            if (!TecClient.IsInitialized)
            {
                try
                {
                    TecClient.Init("Recellection");

                    #region I think it works.. don't touch it...

                    Tobii.TecSDK.Core.Interaction.Contracts.UserProfileProperties newProfile = new Tobii.TecSDK.Core.Interaction.Contracts.UserProfileProperties("RecellectionProfile");
                    Tobii.TecSDK.Client.Utilities.UserProfile.Add("RecellectionProfile", "RecellectionProfile");
                    Tobii.TecSDK.Client.Utilities.UserProfile.SetCurrent("RecellectionProfile");
                    Tobii.TecSDK.Client.Utilities.UserProfile.Current.FeedbackSettings = new Tobii.TecSDK.Core.Interaction.Contracts.FeedbackSettings();
                    Tobii.TecSDK.Client.Utilities.UserProfile.Current.Enabled          = true;


                    //these lines will, it seems, create a new ClientApplicationProperties object
                    //based on the current client settings and current user profile.
                    //the new object sets OffWindowProcessing
                    //**there is probably an easier way to go about this**
                    //**have to wait and see if this will mess with the UserProfile outside of our software**
                    Tobii.TecSDK.Core.Interaction.Contracts.ClientApplicationProperties props =
                        new Tobii.TecSDK.Core.Interaction.Contracts.ClientApplicationProperties
                            (TecClient.ClientSettings, Tobii.TecSDK.Client.Utilities.UserProfile.Current);

                    props.OffWindowProcessing = true;
                    props.Enabled             = true;

                    //we copy our newly created ClientApplicationProperties object to our CurrentApplicationProfile
                    //the change is then applies by calling UpdateApplicationProfile
                    TecClient.CurrentApplicationProfile.CopyProperties(props);
                    TecClient.CurrentApplicationProfile.Enabled = true;
                    TecClient.UpdateApplicationProfile();

                    TecClient.ClientSettings.OffWindowProcessing = true;
                    TecClient.ClientSettings.ApplySettings();
                    TecClient.SettingsManager.ApplySettings();

                    SetFeedbackColor(Microsoft.Xna.Framework.Graphics.Color.White);

                    #endregion
                }
                catch (Exception)
                {
                    logger.Warn("The Tobii Controller did not initialize correctly");
                    return(false);
                }

                logger.Info("Successfully initialized the Tobii Controller");
                return(true);
            }
            else
            {
                //the controller was already initialized
                return(true);
            }
        }
コード例 #2
0
        ///<summary>
        ///Initializes the Tobii Controller
        /// </summary>
        ///<returns>
        ///false if for any reason the initialization did not complete successfully, true otherwise.
        ///</returns>
        public bool Init()
        {
            if (!TecClient.IsInitialized)
            {
                try
                {
                    TecClient.Init("Recellection");

                    #region I think it works.. don't touch it...

                    Tobii.TecSDK.Core.Interaction.Contracts.UserProfileProperties newProfile = new Tobii.TecSDK.Core.Interaction.Contracts.UserProfileProperties("RecellectionProfile");
                    Tobii.TecSDK.Client.Utilities.UserProfile.Add("RecellectionProfile", "RecellectionProfile");
                    Tobii.TecSDK.Client.Utilities.UserProfile.SetCurrent("RecellectionProfile");
                    Tobii.TecSDK.Client.Utilities.UserProfile.Current.FeedbackSettings = new Tobii.TecSDK.Core.Interaction.Contracts.FeedbackSettings();
                    Tobii.TecSDK.Client.Utilities.UserProfile.Current.Enabled = true;


                    //these lines will, it seems, create a new ClientApplicationProperties object
                    //based on the current client settings and current user profile.
                    //the new object sets OffWindowProcessing
                    //**there is probably an easier way to go about this**
                    //**have to wait and see if this will mess with the UserProfile outside of our software**
                    Tobii.TecSDK.Core.Interaction.Contracts.ClientApplicationProperties props = 
                        new Tobii.TecSDK.Core.Interaction.Contracts.ClientApplicationProperties
                            (TecClient.ClientSettings, Tobii.TecSDK.Client.Utilities.UserProfile.Current);
                    
                    props.OffWindowProcessing = true;                    
                    props.Enabled = true;
                    
                    //we copy our newly created ClientApplicationProperties object to our CurrentApplicationProfile
                    //the change is then applies by calling UpdateApplicationProfile
                    TecClient.CurrentApplicationProfile.CopyProperties(props);                    
                    TecClient.CurrentApplicationProfile.Enabled = true;
                    TecClient.UpdateApplicationProfile();
                    
                    TecClient.ClientSettings.OffWindowProcessing = true;
                    TecClient.ClientSettings.ApplySettings();
                    TecClient.SettingsManager.ApplySettings();

                    SetFeedbackColor(Microsoft.Xna.Framework.Graphics.Color.White);

                    #endregion
                }
                catch (Exception)
                {
                    logger.Warn("The Tobii Controller did not initialize correctly");
                    return false;
                }
    
                logger.Info("Successfully initialized the Tobii Controller");
                return true;
            }
            else
            {
                //the controller was already initialized
                return true;
            }
        }