Inheritance: MonoBehaviour
Esempio n. 1
0
        /// <summary>
        /// Loads app global preferences
        /// </summary>
        public static void LoadGlobalSettings()
        {
            GlobalPreferences.PreferencesFilePath        = FileUtils.GetFullPathRelativeToApp("Settings.xml");
            GlobalPreferences.DefaultPreferencesFilePath = FileUtils.GetFullPathRelativeToApp("DefaultSettings.xml");

            CoreGlobals.AppGlobalPreferences = GlobalPreferences.Load();
        }
        public IHttpActionResult Update(int id, GlobalPreferences value)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                service.Update(id, value);
                return(StatusCode(HttpStatusCode.NoContent));
            }
            catch (NotSupportedException)
            {
                return(BadRequest());
            }
            catch (UnauthorizedAccessException)
            {
                return(StatusCode(HttpStatusCode.Forbidden));
            }
            catch (KeyNotFoundException)
            {
                return(NotFound());
            }
        }
Esempio n. 3
0
        private void OnLocaleInitialized(UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle <LocalizationSettings> oper)
        {
            _locale.AddOptions(LocalizationSettings.AvailableLocales.Locales.Select(x => {
                var result      = x.Identifier.CultureInfo.NativeName;
                var firstLetter = Char.ToUpper(result[0]);
                result          = result.Remove(0, 1);
                result          = firstLetter + result;

                return(result);
            }).ToList());

            string currentLocaleCode = GlobalPreferences.Get <string>("current_locale", null);

            if (currentLocaleCode != null)
            {
                LocalizationSettings.SelectedLocale = LocalizationSettings.AvailableLocales.Locales.Find(x => x.Identifier.Code == currentLocaleCode);
            }

            LocalizationChanged(LocalizationSettings.SelectedLocale);
        }
Esempio n. 4
0
        protected DBManager(IDocument document)
        {
            this.myDocument = document;
            globalPref      = new PreferencesManager <GlobalPreferences>("", null).ReadPreference();

            DBConnection = new SqlProxyConnection(GlobalInfo.DBaseInfo.dbManager.DB_ConnectionString);
            Dataset      = new DataSet(document.GetType().Name)
            {
                Locale = System.Globalization.CultureInfo.InvariantCulture
            };
            masterDataAdapterProperties = new DataAdapterProperties();
            slaveBindingCollection      = new BindingCollection();
            try
            {
                if (DBConnection.State != ConnectionState.Open)
                {
                    DBConnection.Open();
                }
            }
            catch (SqlException exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
Esempio n. 5
0
        public static void Main(String[] args)
        {
            // Disallow multiple instances
            if (FileUtils.IsACATRunning())
            {
                return;
            }

            Windows.TurnOffDPIAwareness();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var assembly = Assembly.GetExecutingAssembly();

            // get appname and copyright information
            object[] attributes = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
            var      appName    = (attributes.Length != 0)
                ? ((AssemblyTitleAttribute)attributes[0]).Title
                : String.Empty;

            var appVersion = "Version " + assembly.GetName().Version;

            attributes = assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
            var appCopyright = (attributes.Length != 0)
                ? ((AssemblyCopyrightAttribute)attributes[0]).Copyright
                : String.Empty;

            Log.Info("***** " + appName + ". " + appVersion + ". " + appCopyright + " *****");

            parseCommandLine(args);

            CoreGlobals.AppGlobalPreferences =
                GlobalPreferences.Load(FileUtils.GetPreferencesFileFullPath(GlobalPreferences.FileName));

            //Set the active user/profile information
            setUserName();
            setProfileName();

            //Create user and profile if they don't already exist
            if (!createUserAndProfile())
            {
                return;
            }

            if (!loadUserPreferences())
            {
                return;
            }

            Log.SetupListeners();

            if (!String.IsNullOrEmpty(_panelConfig))
            {
                Common.AppPreferences.PreferredPanelConfigNames = _panelConfig + ";" +
                                                                  Common.AppPreferences.PreferredPanelConfigNames;
            }

            Splash splash = new Splash(FileUtils.GetImagePath("SplashScreenImage.png"), appName, appVersion, appCopyright, 1000);

            splash.Show();

            Context.PreInit();
            Common.PreInit();

            if (!Context.Init())
            {
                splash.Close();
                splash = null;

                TimedMessageBox.Show(Context.GetInitCompletionStatus());
                if (Context.IsInitFatal())
                {
                    return;
                }
            }

            AuditLog.Audit(new AuditEvent("Application", "start"));

            Context.ShowTalkWindowOnStartup = Common.AppPreferences.ShowTalkWindowOnStartup;
            Context.AppAgentMgr.EnableContextualMenusForDialogs = Common.AppPreferences.EnableContextualMenusForDialogs;
            Context.AppAgentMgr.EnableContextualMenusForMenus   = Common.AppPreferences.EnableContextualMenusForMenus;

            if (splash != null)
            {
                splash.Close();
            }

            if (!Context.PostInit())
            {
                MessageBox.Show(Context.GetInitCompletionStatus(), "Initialization Error");
                return;
            }

            Common.Init();

            try
            {
                Application.Run();

                AuditLog.Audit(new AuditEvent("Application", "stop"));

                Context.Dispose();

                Common.Uninit();

                //Utils.Dispose();

                Log.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 6
0
        public static void Main(String[] args)
        {
            //Disallow multiple instances
            if (FileUtils.IsACATRunning())
            {
                return;
            }

            Windows.TurnOffDPIAwareness();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            parseCommandLine(args);

            // get appname and copyright information
            var assembly = Assembly.GetExecutingAssembly();

            object[] attributes = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
            var      appName    = (attributes.Length != 0) ? ((AssemblyTitleAttribute)attributes[0]).Title : String.Empty;

            var appVersion = string.Format(ACATTryout.Properties.Resources.Version0, assembly.GetName().Version);
            //attributes = assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
            //var appCopyright = (attributes.Length != 0) ? ((AssemblyCopyrightAttribute)attributes[0]).Copyright : String.Empty;
            var appCopyright = ACATTryout.Properties.Resources.AssemblyCopyright.Replace("\\n", Environment.NewLine);

            Log.Info("***** " + appName + ". " + appVersion + ". " + appCopyright + " *****");

            CoreGlobals.AppGlobalPreferences = GlobalPreferences.Load(FileUtils.GetPreferencesFileFullPath(GlobalPreferences.FileName));

            //Set the active user/profile information
            setUserName();
            setProfileName();

            //Create user and profile if they don't already exist
            if (!createUserAndProfile())
            {
                return;
            }

            if (!loadUserPreferences())
            {
                return;
            }

            Log.SetupListeners();

            Context.PreInit();
            Common.PreInit();

            try
            {
                if (!Context.Init(Context.StartupFlags.Minimal | Context.StartupFlags.TextToSpeech))
                {
                    MessageBox.Show("Context initialization error");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Context Init exception " + ex);
                return;
            }

            if (!Context.PostInit())
            {
                MessageBox.Show(Context.GetInitCompletionStatus(), "Initialization Error");
                return;
            }

            Common.Init();

            var formName = String.IsNullOrEmpty(_formName) ? "ACATTryoutForm" : _formName;
            var form     = PanelManager.Instance.CreatePanel(formName);

            if (form != null)
            {
                Context.AppPanelManager.Show(null, form as IPanel);
            }
            else
            {
                MessageBox.Show("Invalid form name " + form, "Error");
                return;
            }

            try
            {
                Application.Run();

                Context.Dispose();

                Common.Uninit();

                //Utils.Dispose();

                Log.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 7
0
        public static void Main(String[] args)
        {
            // Disallow multiple instances
            if (FileUtils.IsACATRunning())
            {
                return;
            }

            Windows.TurnOffDPIAwareness();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            parseCommandLine(args);

            var assembly = Assembly.GetExecutingAssembly();

            // get appname and copyright information
            object[] attributes = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
            var      appName    = (attributes.Length != 0)
                                ? ((AssemblyTitleAttribute)attributes[0]).Title
                                : String.Empty;

            var appVersion = string.Format(Resources.Version0, assembly.GetName().Version);
            //attributes = assembly.GetCustomAttributes(typeof (AssemblyCopyrightAttribute), false);
            //var appCopyright = (attributes.Length != 0)
            //                        ? ((AssemblyCopyrightAttribute) attributes[0]).Copyright
            //                        : String.Empty;
            var appCopyright = Resources.AssemblyCopyright.Replace("\\n", Environment.NewLine);

            Log.Info("***** " + appName + ". " + appVersion + ". " + appCopyright + " *****");

            CoreGlobals.AppGlobalPreferences = GlobalPreferences.Load(FileUtils.GetPreferencesFileFullPath(GlobalPreferences.FileName));

            //Set the active user/profile information
            setUserName();
            setProfileName();

            //Create user and profile if they don't already exist
            if (!createUserAndProfile())
            {
                return;
            }

            if (!loadUserPreferences())
            {
                return;
            }

            Log.SetupListeners();

            Splash splash = new Splash(FileUtils.GetImagePath("SplashScreenImage.png"), appName, appVersion, appCopyright, 1000);

            splash.Show();

            Context.PreInit();
            Common.PreInit();

            Context.AppAgentMgr.EnableAppAgentContextSwitch = false;

            if (!Context.Init(Context.StartupFlags.Minimal |
                              Context.StartupFlags.TextToSpeech |
                              Context.StartupFlags.WordPrediction |
                              Context.StartupFlags.AgentManager |
                              Context.StartupFlags.WindowsActivityMonitor |
                              Context.StartupFlags.Abbreviations))
            {
                splash.Close();
                splash = null;

                TimedMessageBox.Show(Context.GetInitCompletionStatus());
                if (Context.IsInitFatal())
                {
                    return;
                }
            }

            AuditLog.Audit(new AuditEvent("Application", "start"));

            Context.ShowTalkWindowOnStartup = false;
            Context.AppAgentMgr.EnableContextualMenusForDialogs     = false;
            Context.AppAgentMgr.EnableContextualMenusForMenus       = false;
            Context.AppAgentMgr.DefaultAgentForContextSwitchDisable = Context.AppAgentMgr.NullAgent;

            if (splash != null)
            {
                splash.Close();
            }

            if (!Context.PostInit())
            {
                MessageBox.Show(Context.GetInitCompletionStatus(), "Initialization Error");
                return;
            }

            Common.Init();

            Context.AppWindowPosition = Windows.WindowPosition.CenterScreen;

            var formName = String.IsNullOrEmpty(_formName) ? "TalkApplicationScanner" : _formName;
            var form     = PanelManager.Instance.CreatePanel(formName);

            if (form != null)
            {
                // Add ad-hoc agent that will handle the form
                IApplicationAgent agent = new TalkAppAgent();
                Context.AppAgentMgr.AddAgent(form.Handle, agent);

                Context.AppPanelManager.Show(form as IPanel);
            }
            else
            {
                MessageBox.Show("Invalid form name " + form, "Error");
                return;
            }

            try
            {
                Application.Run();

                AuditLog.Audit(new AuditEvent("Application", "stop"));

                Context.Dispose();

                Common.Uninit();

                //Utils.Dispose();

                Log.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 8
0
        public static void Main(String[] args)
        {
            //Disallow multiple instances
            if (FileUtils.CheckAppExistingInstance("ACATMutex"))
            {
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // get appname and copyright information
            var assembly = Assembly.GetExecutingAssembly();

            object[] attributes = assembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
            var      appName    = (attributes.Length != 0) ? ((AssemblyTitleAttribute)attributes[0]).Title : String.Empty;

            var appVersion = "Version " + assembly.GetName().Version.ToString();

            attributes = assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
            var appCopyright = (attributes.Length != 0) ? ((AssemblyCopyrightAttribute)attributes[0]).Copyright : String.Empty;

            Log.Info("***** " + appName + ". " + appVersion + ". " + appCopyright + " *****");

            CoreGlobals.AppGlobalPreferences = GlobalPreferences.Load(FileUtils.GetPreferencesFileFullPath(GlobalPreferences.FileName));

            //Set the active user/profile information
            setUserName();
            setProfileName();

            //Create user and profile if they don't already exist
            if (!createUserAndProfile())
            {
                return;
            }

            if (!loadUserPreferences())
            {
                return;
            }

            Log.SetupListeners();

            Context.PreInit();
            Common.PreInit();

            try
            {
                if (!Context.Init(Context.StartupFlags.Minimal))
                {
                    MessageBox.Show("Context initialization error");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Context Init exception " + ex);
                return;
            }

            Common.Init();

            var form = PanelManager.Instance.CreatePanel("ACATGettingStartedForm");

            if (form != null)
            {
                Context.AppPanelManager.Show(null, form as IPanel);
            }
            try
            {
                Application.Run();

                Context.Dispose();

                Common.Uninit();

                //Utils.Dispose();

                Log.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 9
0
        public async Task GetGlobalPreferencesWorking()
        {
            GlobalPreferences globalPreferences = await RpcClient.GetGlobalPreferencesWorkingAsync();

            Assert.IsTrue(globalPreferences.ModifiedTime > new DateTime(2000, 1, 1));
        }
Esempio n. 10
0
 private void LocalizationChanged(UnityEngine.Localization.Locale newLocale)
 {
     _locale.value = LocalizationSettings.AvailableLocales.Locales.FindIndex(x => x == newLocale);
     GlobalPreferences.Set("current_locale", newLocale.Identifier.Code);
 }
Esempio n. 11
0
 public void Update(int id, GlobalPreferences value)
 {
     throw new NotImplementedException();
 }
Esempio n. 12
0
 public void Create(GlobalPreferences value)
 {
     throw new NotImplementedException();
 }