Example #1
0
        private void DoStartup(StartupEventArgs e)
        {
            FileManager.EnableMovieSheets = true;

            new ThumbGen.Core.Loggy().InitLogging("ThumbGen");

            FileManager.Configuration = new Configuration();

            FileManager.PrepareSatelliteFolders();

            FileManager.ExtractProfiles();

            FileManager.PrepareExternalFiles();

            FileManager.PopulateMyGalleryResults();

            FileManager.LoadLastUsedProfile();

            ThumbGen.Core.UpdatesManager.ClearBakFiles();

            CommandLineManager _cmdManager = new CommandLineManager(e.Args);

            if (_cmdManager.HasValidArgs())
            {
                /* there are some params -> do stuff without a GUI */
                _cmdManager.Process();
            }
            else
            {
                // do stuff with GUI

                SplashW = new SplashWindow();
                SplashW.Show();

                // important to reset MainWindow here as it is set to SplashWindow!!
                Application.Current.MainWindow = null;

                // IMPORTANT- must add the theming Fluent dictionary here, to the app.xaml (to be available in the whole app)
                // can't be done directly in app.xaml coz the dll is not available at runtime
                // <ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Office2010/Silver.xaml"/>
                ResourceDictionary _resDict = new ResourceDictionary();
                _resDict.Source = new Uri("pack://application:,,,/Fluent;Component/Themes/Office2010/Silver.xaml", UriKind.RelativeOrAbsolute);
                this.Resources.MergedDictionaries.Add(_resDict);

                // trick needed to force loading the Fluent.dll when the mainwindow is not a RibbonWindow (weird...)
                Fluent.RibbonWindow _t = new Fluent.RibbonWindow();
                _t.Close();
                _t = null;

                // show the mainwindow
                new ThumbGenMainWindow().ShowDialog();
            }

            _cmdManager.Dispose();

            this.Shutdown();
        }