Example #1
0
        public Programme()
        {
            //var cultureInfo = new System.Globalization.CultureInfo("pl-PL");
            //Thread.CurrentThread.CurrentCulture = cultureInfo;
            //Thread.CurrentThread.CurrentUICulture = cultureInfo;
#if DEBUG
#else
            InitializeCrashHandler();
#endif

            userId       = GetCommandLineArgValue(@"-userid");
            runningMutex = new Mutex(false, "Local\\" + "{9D13D6B0-F44E-4d48-BE80-07A49C0FD691}" + userId, out isApplicationNotRunningYet);

            if (string.IsNullOrEmpty(userId) == false)
            {
                Messenger.Properties.Settings.ReloadSettings(userId);
            }

            if (isApplicationNotRunningYet && Messenger.Properties.Settings.Default.NoSplash == false)
            {
                screen = new SplashScreen("SplashScreen.png");
                screen.Show(false);
            }

            presentitiesStorage = (PresentitiesCollectionStorage)(ApplicationSettingsBase.Synchronized(new PresentitiesCollectionStorage()));

            if (Messenger.Properties.Settings.Default.SettingsUpgrated == false)
            {
                try
                {
                    presentitiesStorage.Upgrade();
                    presentitiesStorage.Save();

                    Messenger.Properties.Settings.Default.Upgrade();
                    Messenger.Properties.Settings.Default.SettingsUpgrated = true;
                    Messenger.Properties.Settings.Default.Save();
                }
                catch
                {
                }
            }

            if (Messenger.Properties.Settings.Default.EndpointId == 0)
            {
                Messenger.Properties.Settings.Default.EndpointId = Environment.TickCount;
                Messenger.Properties.Settings.Default.Save();
            }

            Messenger.Properties.Settings.Default.PropertyChanged += Settings_PropertyChanged;

            Messenger.Properties.Settings.Default.AutoSaveSettings = true;

            //MessengerCommands.Initialize();

            //InitializeUccapi();
            //InitializeCommandBindings();
        }
Example #2
0
            private void TryLoadAppSettings()
            {
                var appSettingsType = GetType().Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(ApplicationSettingsBase))).First();

                if (appSettingsType != null)
                {
                    var defProp = appSettingsType?.GetProperty("Default");
                    if (defProp != null)
                    {
                        Settings = (ApplicationSettingsBase)defProp.GetValue(null, null);
                    }
                    else
                    {
                        Settings = (ApplicationSettingsBase)ApplicationSettingsBase.Synchronized((ApplicationSettingsBase)Activator.CreateInstance(appSettingsType));
                    }
                }
                else
                {
                    throw new ApplicationException("Assembly hosting MRUManager must already have a settings instance derived from ApplicationSettingsBase.");
                }
            }