Exemple #1
0
            public void Work()
            {
                try {
                    if (!Directory.Exists(ApplicationData.Instance.GetConfigurationFileRootFolderAbsolutePath()) ||
                        !File.Exists(ApplicationData.Instance.GetConfigurationFileAbsolutePath()))
                    {
                        ConfigurationManager.CreateConfigurationDirectory();
                        ConfigurationManager.CreateEmptyConfiguration();
                    }

                    ConfigurationManager.Load();
                } catch (ConfigurationInvalidException) {
                    var result = MessageBox.Show(LocalizeHelper.GetLocalizedString("PreparationWindow_Ask_RecreateConfigurationFile"), ApplicationData.Instance.AppVersion, MessageBoxButton.YesNo);

                    if (result == MessageBoxResult.Yes)
                    {
                        ConfigurationManager.CreateEmptyConfiguration();
                        ConfigurationManager.Load();
                    }
                }

                if (ConfigurationManager.IsConfigurationReady())
                {
                    LocalizeHelper.SetCurrentUICulture(new System.Globalization.CultureInfo(ConfigurationManager.ConfigurationInstance.UIConfigurations.Language));
                }
            }
        public App()
        {
            Tweetinvi.TweetinviConfig.ApplicationSettings.TweetMode = Tweetinvi.TweetMode.Extended;
            Tweetinvi.TweetinviConfig.CurrentThreadSettings.InitialiseFrom(Tweetinvi.TweetinviConfig.ApplicationSettings);

            LocalizeHelper.SetCurrentUICulture(Thread.CurrentThread.CurrentUICulture);

            /* You MUST set instance of ApplicationData to make the application work.
             *
             * Example :
             *      ApplicationData.SetInstance(new ApplicationData() {
             *          AppVersion = "yyyyMMdd",
             *          AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"QuiqCompose"),
             *          ConfigurationFileRelativePath = null,
             *          ConfigurationFileName = @"Settings.xml",
             *          ImageCacheFolderRelativePath = @"Caches/Images",
             *          CryptoSalt = @"QC_SALT".ToSecureString(),
             *          TwitterApp = new TwitterAppInfo() {
             *              ConsumerKey = "~~~~".ToSecureString(),
             *              ConsumerSecretKey = "~~~~".ToSecureString()
             *          }
             *      });
             *
             * NOTE that at least `TwitterApp` property MUST be set (another properties has preset but `TwiterApp` doesn't)
             */
        }