Example #1
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            Logging.LogManager.RegisterDebugListener();

            StyleHelper.CreateStyleForwardersForDefaultStyles();

            var serviceLocator = ServiceLocator.Default;

            serviceLocator.RegisterType <IViewLocator, ViewLocator>();
            var viewLocator = serviceLocator.ResolveType <IViewLocator>();

            viewLocator.NamingConventions.Add("[UP].Views.[VM]");
            viewLocator.NamingConventions.Add("[UP].Views.LogicInBehavior.[VM]");
            viewLocator.NamingConventions.Add("[UP].Views.LogicInBehavior.[VM]View");
            viewLocator.NamingConventions.Add("[UP].Views.LogicInBehavior.[VM]Window");
            viewLocator.NamingConventions.Add("[UP].Views.LogicInViewBase.[VM]");
            viewLocator.NamingConventions.Add("[UP].Views.LogicInViewBase.[VM]View");
            viewLocator.NamingConventions.Add("[UP].Views.LogicInViewBase.[VM]Window");

            serviceLocator.RegisterType <IViewModelLocator, ViewModelLocator>();
            var viewModelLocator = serviceLocator.ResolveType <IViewModelLocator>();

            viewModelLocator.NamingConventions.Add("Catel.Examples.AdvancedDemo.ViewModels.[VW]ViewModel");

            // Register several different external IoC containers for demo purposes
            IoCHelper.MefContainer   = new CompositionContainer();
            IoCHelper.UnityContainer = new UnityContainer();
            serviceLocator.RegisterExternalContainer(IoCHelper.MefContainer);
            serviceLocator.RegisterExternalContainer(IoCHelper.UnityContainer);

            base.OnStartup(e);
        }
Example #2
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            // Example of best performance options for Catel (but at the cost of validation features)
            //Catel.Windows.Controls.UserControl.DefaultCreateWarningAndErrorValidatorForViewModelValue = false;
            //Catel.Windows.Controls.UserControl.DefaultSkipSearchingForInfoBarMessageControlValue = true;
            //Catel.Data.ModelBase.SuspendValidationForAllModels = true;

            var serviceLocator = ServiceLocator.Default;

            Catel.Environment.RegisterDefaultViewModelServices();

            var viewLocator = serviceLocator.ResolveType <IViewLocator>();

            viewLocator.Register(typeof(ProgressNotifyableViewModel), typeof(Views.SplashScreen));

            var viewModelLocator = serviceLocator.ResolveType <IViewModelLocator>();

            viewModelLocator.Register(typeof(Views.SplashScreen), typeof(ProgressNotifyableViewModel));

            var bootstrapper = new OrchestraBootstrapper();

            StyleHelper.CreateStyleForwardersForDefaultStyles(Current.Resources.MergedDictionaries[1]);

            bootstrapper.RunWithSplashScreen <ProgressNotifyableViewModel>();

            base.OnStartup(e);
        }
Example #3
0
        protected override void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            LogManager.AddDebugListener();
#endif

            Log.Info("Starting application");

            // Want to improve performance? Uncomment the lines below. Note though that this will disable
            // some features.
            //
            // For more information, see http://docs.catelproject.com/vnext/faq/performance-considerations/

            // Log.Info("Improving performance");
            // Catel.Windows.Controls.UserControl.DefaultCreateWarningAndErrorValidatorForViewModelValue = false;
            // Catel.Windows.Controls.UserControl.DefaultSkipSearchingForInfoBarMessageControlValue = true;

            // TODO: Register custom types in the ServiceLocator
            //Log.Info("Registering custom types");
            //var serviceLocator = ServiceLocator.Default;
            //serviceLocator.RegisterType<IMyInterface, IMyClass>();

            // To auto-forward styles, check out Orchestra (see https://github.com/wildgums/orchestra)
            StyleHelper.CreateStyleForwardersForDefaultStyles();

            var serviceLocator = ServiceLocator.Default;
            var shellService   = serviceLocator.ResolveType <IShellService>();
            shellService.CreateAsync <ShellWindow>();

            Log.Info("Calling base.OnStartup");

            base.OnStartup(e);
        }
Example #4
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            Catel.Logging.LogManager.AddDebugListener(true);

            var logPath = Path.Combine(GetType().Assembly.GetDirectory(), "debug.log");
            LogManager.AddListener(new FileLogListener(logPath, 25 * 1024));
#endif

            var languageService = ServiceLocator.Default.ResolveType <ILanguageService>();

            // Note: it's best to use .CurrentUICulture in actual apps since it will use the preferred language
            // of the user. But in order to demo multilingual features for devs (who mostly have en-US as .CurrentUICulture),
            // we use .CurrentCulture for the sake of the demo
            languageService.PreferredCulture = CultureInfo.CurrentCulture;
            languageService.FallbackCulture  = new CultureInfo("en-US");

            //var consoleLogListener = new ConsoleLogListener();
            //consoleLogListener.IgnoreCatelLogging = true;
            //LogManager.AddListener(consoleLogListener);

            Console.WriteLine(typeof(ILicenseService));

            StyleHelper.CreateStyleForwardersForDefaultStyles();

            base.OnStartup(e);
        }
        public virtual async Task InitializeBeforeShowingSplashScreenAsync()
        {
            InitializeLogging();

            var serviceLocator         = this.GetServiceLocator();
            var xamlResourceService    = serviceLocator.ResolveType <IXamlResourceService>();
            var themeService           = serviceLocator.ResolveType <IThemeService>();
            var orchestraThemeManager  = serviceLocator.ResolveType <IThemeManager>();
            var orcThemingThemeManager = serviceLocator.ResolveType <Orc.Theming.ThemeManager>();

            // Note: we only have to create style forwarders once
            var xamlResourceDictionaries = xamlResourceService.GetApplicationResourceDictionaries();

            foreach (var xamlResourceDictionary in xamlResourceDictionaries)
            {
                orchestraThemeManager.EnsureApplicationThemes(xamlResourceDictionary, false);
            }

            if (themeService.ShouldCreateStyleForwarders())
            {
                StyleHelper.CreateStyleForwardersForDefaultStyles();
            }

            orcThemingThemeManager.SynchronizeTheme();
        }
Example #6
0
        protected override async void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            //LogManager.AddDebugListener();
#endif

            var languageService = ServiceLocator.Default.ResolveType <ILanguageService>();

            // Note: it's best to use .CurrentUICulture in actual apps since it will use the preferred language
            // of the user. But in order to demo multilingual features for devs (who mostly have en-US as .CurrentUICulture),
            // we use .CurrentCulture for the sake of the demo
            languageService.PreferredCulture = CultureInfo.CurrentCulture;
            languageService.FallbackCulture  = new CultureInfo("en-US");

            //Log.Info("Starting application");

            StyleHelper.CreateStyleForwardersForDefaultStyles();

            //Log.Info("Calling base.OnStartup");

            var serviceLocator = ServiceLocator.Default;
            var shellService   = serviceLocator.ResolveType <IShellService>();
            await shellService.CreateWithSplashAsync <ShellWindow>();

            var filterSchemeManager = serviceLocator.ResolveType <IFilterSchemeManager>();
            await filterSchemeManager.LoadAsync();

            base.OnStartup(e);
        }
Example #7
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            //Logging.LogManager.AddDebugListener();

            StyleHelper.CreateStyleForwardersForDefaultStyles();

            var serviceLocator = ServiceLocator.Default;

            serviceLocator.RegisterType <IViewLocator, ViewLocator>();
            var viewLocator = serviceLocator.ResolveType <IViewLocator>();

            viewLocator.NamingConventions.Add("[UP].Views.[VM]");
            viewLocator.NamingConventions.Add("[UP].Views.LogicInBehavior.[VM]");
            viewLocator.NamingConventions.Add("[UP].Views.LogicInBehavior.[VM]View");
            viewLocator.NamingConventions.Add("[UP].Views.LogicInBehavior.[VM]Window");
            viewLocator.NamingConventions.Add("[UP].Views.LogicInViewBase.[VM]");
            viewLocator.NamingConventions.Add("[UP].Views.LogicInViewBase.[VM]View");
            viewLocator.NamingConventions.Add("[UP].Views.LogicInViewBase.[VM]Window");

            serviceLocator.RegisterType <IViewModelLocator, ViewModelLocator>();
            var viewModelLocator = serviceLocator.ResolveType <IViewModelLocator>();

            viewModelLocator.NamingConventions.Add("Catel.Examples.AdvancedDemo.ViewModels.[VW]ViewModel");

            base.OnStartup(e);
        }
Example #8
0
        public override bool TryInvoke(FrameworkElement owner, AutomationMethod method, out AutomationValue result)
        {
            StyleHelper.CreateStyleForwardersForDefaultStyles();

            result = AutomationValue.FromValue(10);

            return(true);
        }
Example #9
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            StyleHelper.CreateStyleForwardersForDefaultStyles();

            // TODO: Using a custom IoC container like Unity? Register it here:
            // Catel.IoC.ServiceLocator.Instance.RegisterExternalContainer(MyUnityContainer);

            base.OnStartup(e);
        }
Example #10
0
        public override bool TryInvoke(FrameworkElement owner, AutomationMethod method, out AutomationValue result)
        {
            result = AutomationValue.FromValue(true);

            StyleHelper.CreateStyleForwardersForDefaultStyles();
            ThemeManager.Current.SynchronizeTheme();

            return(true);
        }
Example #11
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            StyleHelper.CreateStyleForwardersForDefaultStyles();

            var serviceLocator = ServiceLocator.Default;

            serviceLocator.RegisterType <ILanguageService, Services.LanguageService>();

            base.OnStartup(e);
        }
Example #12
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            Catel.Logging.LogManager.AddDebugListener();
#endif

            StyleHelper.CreateStyleForwardersForDefaultStyles();

            base.OnStartup(e);
        }
Example #13
0
        protected override void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            LogManager.AddDebugListener(false);
#endif
            InitializeFonts();
            StyleHelper.CreateStyleForwardersForDefaultStyles();
            this.ApplyTheme();
            base.OnStartup(e);
        }
Example #14
0
        protected override void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            LogManager.AddDebugListener(true);
#endif

            var languageService = ServiceLocator.Default.ResolveType <ILanguageService>();

            // Note: it's best to use .CurrentUICulture in actual apps since it will use the preferred language
            // of the user. But in order to demo multilingual features for devs (who mostly have en-US as .CurrentUICulture),
            // we use .CurrentCulture for the sake of the demo
            languageService.PreferredCulture = CultureInfo.CurrentCulture;
            languageService.FallbackCulture  = new CultureInfo("en-US");

            Log.Info("Starting application");

            var serviceLocator = ServiceLocator.Default;

            // To force the loading of all assemblies at startup, uncomment the lines below:

            //Log.Info("Preloading assemblies");
            //AppDomain.CurrentDomain.PreloadAssemblies();


            // Want to improve performance? Uncomment the lines below. Note though that this will disable
            // some features.
            //
            // For more information, see https://catelproject.atlassian.net/wiki/display/CTL/Performance+considerations

            // Log.Info("Improving performance");
            // Catel.Data.ModelBase.DefaultSuspendValidationValue = true;
            // Catel.Windows.Controls.UserControl.DefaultCreateWarningAndErrorValidatorForViewModelValue = false;
            // Catel.Windows.Controls.UserControl.DefaultSkipSearchingForInfoBarMessageControlValue = true;


            // TODO: Register custom types in the ServiceLocator
            //Log.Info("Registering custom types");

            //serviceLocator.RegisterType<IMyInterface, IMyClass>();

            Log.Info("Registering application-wide commands");

            var commandManager = serviceLocator.ResolveType <ICommandManager>();
            commandManager.CreateCommandWithGesture(typeof(TestCommands), "AppWideTest");

            StyleHelper.CreateStyleForwardersForDefaultStyles();

            Log.Info("Calling base.OnStartup");

            base.OnStartup(e);
        }
Example #15
0
        public virtual async Task InitializeBeforeShowingSplashScreenAsync()
        {
            var serviceLocator = this.GetServiceLocator();
            var themeService   = serviceLocator.ResolveType <IThemeService>();

            // Note: we only have to create style forwarders once
            ThemeHelper.EnsureApplicationThemes(typeof(ApplicationInitializationServiceBase).Assembly, false);
            ThemeHelper.EnsureApplicationThemes(GetType().Assembly, false);

            if (themeService.ShouldCreateStyleForwarders())
            {
                StyleHelper.CreateStyleForwardersForDefaultStyles();
            }
        }
        protected override void OnStartup(StartupEventArgs e)
        {
            var languageService = ServiceLocator.Default.ResolveType <ILanguageService>();

            // Note: it's best to use .CurrentUICulture in actual apps since it will use the preferred language
            // of the user. But in order to demo multilingual features for devs (who mostly have en-US as .CurrentUICulture),
            // we use .CurrentCulture for the sake of the demo
            languageService.PreferredCulture = CultureInfo.CurrentCulture;
            languageService.FallbackCulture  = new CultureInfo("en-US");

            base.OnStartup(e);

            StyleHelper.CreateStyleForwardersForDefaultStyles();
        }
Example #17
0
        protected override void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            LogManager.AddDebugListener();
#endif

            Log.Info("Starting application");

            // To force the loading of all assemblies at startup, uncomment the lines below:

            //Log.Info("Preloading assemblies");
            //AppDomain.CurrentDomain.PreloadAssemblies();


            // Want to improve performance? Uncomment the lines below. Note though that this will disable
            // some features.
            //
            // For more information, see https://catelproject.atlassian.net/wiki/display/CTL/Performance+considerations

            // Log.Info("Improving performance");
            // Catel.Data.ModelBase.DefaultSuspendValidationValue = true;
            // Catel.Windows.Controls.UserControl.DefaultCreateWarningAndErrorValidatorForViewModelValue = false;
            // Catel.Windows.Controls.UserControl.DefaultSkipSearchingForInfoBarMessageControlValue = true;


            // TODO: Register custom types in the ServiceLocator
            //Log.Info("Registering custom types");

            if (File.Exists("Config.txt"))
            {
                using (var reader = new StreamReader("Config.txt"))
                {
                    set = ModelBase.Load <Settings>(reader.BaseStream, SerializationMode.Xml, _sc);
                }
            }
            else
            {
                set = new Settings();
            }
            var serviceLocator = ServiceLocator.Default;
            serviceLocator.RegisterInstance(typeof(Settings), set);

            StyleHelper.CreateStyleForwardersForDefaultStyles();

            Log.Info("Calling base.OnStartup");

            base.OnStartup(e);
        }
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            Catel.Logging.LogManager.AddDebugListener();
#endif

            StyleHelper.CreateStyleForwardersForDefaultStyles();

            var serviceLocator = ServiceLocator.Default;
            serviceLocator.RegisterType <IFamilyService, FamilyService>();

            var uiVisualizerService = serviceLocator.ResolveType <IUIVisualizerService>();
            uiVisualizerService.Register(typeof(PersonViewModel), typeof(PersonWindow));

            base.OnStartup(e);
        }
Example #19
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            StyleHelper.CreateStyleForwardersForDefaultStyles();

            // TODO: Using a custom IoC container like Unity? Register it here:
            // Catel.IoC.ServiceLocator.Instance.RegisterExternalContainer(MyUnityContainer);
            ServiceLocator.Default.RegisterType <IUpdateMessagesListTask, UpdateMessagesListTask>(RegistrationType.Transient);
            ServiceLocator.Default.RegisterType <IFolderWatcher, FolderWatcher>(RegistrationType.Singleton);
            ServiceLocator.Default.RegisterType <ITryFindParent, TryFindParent>(RegistrationType.Transient);
            ServiceLocator.Default.RegisterType <IUpdateMessagesListTask, UpdateMessagesListTask>(RegistrationType.Transient);
            ServiceLocator.Default.RegisterType <IOpenEmailFile, OpenEmailFile>(RegistrationType.Transient);
#if DEBUG
            Catel.Logging.LogManager.RegisterDebugListener();
#endif
            base.OnStartup(e);
        }
Example #20
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            Catel.Logging.LogManager.AddDebugListener();
#endif

            StyleHelper.CreateStyleForwardersForDefaultStyles();

            var serviceLocator = ServiceLocator.Default;

            serviceLocator.RegisterInstance <IConsoleService>(new ConsoleService());

            // Force load assembly
            Console.WriteLine(typeof(Solution));

            base.OnStartup(e);
        }
Example #21
0
        public virtual void EnsureApplicationThemes(ResourceDictionary resourceDictionary, bool createStyleForwarders = false)
        {
            Argument.IsNotNull(() => resourceDictionary);

            EnsureOrchestraTheme(createStyleForwarders);

            try
            {
                var applicationResourcesDictionary = GetTargetApplicationResourceDictionary();
                if (applicationResourcesDictionary is null == false)
                {
                    var alreadyAdded = false;

                    if (resourceDictionary.Source is null)
                    {
                        // Runtime, check by instance
                        alreadyAdded = (from dic in applicationResourcesDictionary.MergedDictionaries
                                        where ReferenceEquals(dic, resourceDictionary)
                                        select dic).Any();
                    }
                    else
                    {
                        // Defined, check by uri
                        alreadyAdded = (from dic in applicationResourcesDictionary.MergedDictionaries
                                        where dic.Source != null && dic.Source == resourceDictionary.Source
                                        select dic).Any();
                    }

                    if (!alreadyAdded)
                    {
                        applicationResourcesDictionary.MergedDictionaries.Add(resourceDictionary);
                    }

                    // Style forwarders only make sense once something actually changed. If it's a cascaded
                    // call, callers should explicitly call CreateStyleForwarders manually
                    if (createStyleForwarders)
                    {
                        StyleHelper.CreateStyleForwardersForDefaultStyles(applicationResourcesDictionary);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Warning(ex, $"Failed to add application theme '{resourceDictionary?.Source}'");
            }
        }
Example #22
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            Catel.Logging.LogManager.RegisterDebugListener();
#endif

            StyleHelper.CreateStyleForwardersForDefaultStyles();

            // TODO: Using a custom IoC container like Unity? Register it here:
            // Catel.IoC.ServiceLocator.Instance.RegisterExternalContainer(MyUnityContainer);

            base.OnStartup(e);

            var dependencyResolver = this.GetDependencyResolver();

            var commandManager = dependencyResolver.Resolve <ICommandManager>();
            commandManager.CreateCommand(Commands.Refresh, new InputGesture(Key.F5));
        }
Example #23
0
        protected override void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            LogManager.AddDebugListener();
#endif
            //var serviceLocator = ServiceLocator.Default;
            //var uiVisualizerService = serviceLocator.ResolveType<IUIVisualizerService>();
            //uiVisualizerService.Register(typeof(PentanViewModel), typeof(PentanWindow));
            Log.Info("Starting application");

            /// Языковые настройки, точка вместо запятой при вводе дробных чисел
            //System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
            //customCulture.NumberFormat.NumberDecimalSeparator = ".";
            //System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;

            // To force the loading of all assemblies at startup, uncomment the lines below:

            //Log.Info("Preloading assemblies");
            //AppDomain.CurrentDomain.PreloadAssemblies();


            // Want to improve performance? Uncomment the lines below. Note though that this will disable
            // some features.
            //
            // For more information, see https://catelproject.atlassian.net/wiki/display/CTL/Performance+considerations

            // Log.Info("Improving performance");
            // Catel.Data.ModelBase.DefaultSuspendValidationValue = true;
            // Catel.Windows.Controls.UserControl.DefaultCreateWarningAndErrorValidatorForViewModelValue = false;
            // Catel.Windows.Controls.UserControl.DefaultSkipSearchingForInfoBarMessageControlValue = true;


            // TODO: Register custom types in the ServiceLocator
            //Log.Info("Registering custom types");
            //var serviceLocator = ServiceLocator.Default;
            //serviceLocator.RegisterType<IMyInterface, IMyClass>();

            StyleHelper.CreateStyleForwardersForDefaultStyles();

            Log.Info("Calling base.OnStartup");

            base.OnStartup(e);
        }
Example #24
0
        protected override void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            LogManager.AddDebugListener();
#endif

            var fileLogListener = new FileLogListener();
            fileLogListener.FilePath           = "{AppDir}/{AssemblyName}";
            fileLogListener.IgnoreCatelLogging = true;

            LogManager.AddListener(fileLogListener);

            Log.Info("Starting application");

            // To force the loading of all assemblies at startup, uncomment the lines below:

            //Log.Info("Preloading assemblies");
            //AppDomain.CurrentDomain.PreloadAssemblies();


            // Want to improve performance? Uncomment the lines below. Note though that this will disable
            // some features.
            //
            // For more information, see https://catelproject.atlassian.net/wiki/display/CTL/Performance+considerations

            // Log.Info("Improving performance");
            // Catel.Data.ModelBase.DefaultSuspendValidationValue = true;
            // Catel.Windows.Controls.UserControl.DefaultCreateWarningAndErrorValidatorForViewModelValue = false;
            // Catel.Windows.Controls.UserControl.DefaultSkipSearchingForInfoBarMessageControlValue = true;


            // TODO: Register custom types in the ServiceLocator
            //Log.Info("Registering custom types");
            //var serviceLocator = ServiceLocator.Default;
            //serviceLocator.RegisterType<IMyInterface, IMyClass>();

            StyleHelper.CreateStyleForwardersForDefaultStyles();

            Log.Info("Calling base.OnStartup");

            base.OnStartup(e);
        }
Example #25
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var languageService = ServiceLocator.Default.ResolveType <ILanguageService>();

            // Note: it's best to use .CurrentUICulture in actual apps since it will use the preferred language
            // of the user. But in order to demo multilingual features for devs (who mostly have en-US as .CurrentUICulture),
            // we use .CurrentCulture for the sake of the demo
            languageService.PreferredCulture = CultureInfo.CurrentCulture;
            languageService.FallbackCulture  = new CultureInfo("en-US");

            // Some test logging, but important to load the assembly first
            var externalTypeToForceAssemblyLoad = typeof(LogViewerLogListener);

            Log.Info("Starting application");
            Log.Info("This log message should show up as debug");

            StyleHelper.CreateStyleForwardersForDefaultStyles();

            base.OnStartup(e);
        }
Example #26
0
        //private static readonly ILog log = LogManager.GetLogger(typeof (Program)) ;



        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            _versionNumber = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
            _log.InfoFormat("Starting Safe and Sound 2015 version {0}", _versionNumber);


            base.OnStartup(e);
#if DEBUG
            Catel.Logging.LogManager.RegisterDebugListener();
#endif

            StyleHelper.CreateStyleForwardersForDefaultStyles();

            // TODO: Using a custom IoC container like Unity? Register it here:
            //Catel.IoC.ServiceLocator.Instance.RegisterExternalContainer(MyUnityContainer);

            _serviceLocator = ServiceLocator.Default;
            _serviceLocator.RegisterType <IBackupSetService, BackupSetService>();
            _serviceLocator.RegisterType <IMessageBoxService, MessageBoxService>();
            _serviceLocator.RegisterInstance <ILog>(_log);
            var test = _serviceLocator.GetService(typeof(ILog));
            //test.l

            var uiVisualizerService = _serviceLocator.ResolveType <IUIVisualizerService>();
            uiVisualizerService.Register(typeof(BackupSetViewModel), typeof(BackupSetDialog));
            uiVisualizerService.Register(typeof(ExcludedDirectoriesViewModel), typeof(ExcludedDirectoriesWindow));
            uiVisualizerService.Register(typeof(DriveSelectionViewModel), typeof(DriveSelectionWindow));
            uiVisualizerService.Register(typeof(AboutViewModel), typeof(AboutDialog));



            var typeFactory          = this.GetTypeFactory();
            var shellWindowViewModel = typeFactory.CreateInstanceWithParametersAndAutoCompletion <MainWindowViewModel>();
            shellWindowViewModel.OnThemeChanged += shellWindowViewModel_OnThemeChanged;

            new SKnoxConsulting.SafeAndSound.Gui.Views.MainWindow(shellWindowViewModel).ShowDialog();

            // Bootstrapper bootstrapper = new Bootstrapper();
            // bootstrapper.Run();
        }
Example #27
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Application.Startup"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param>
        protected override void OnStartup(StartupEventArgs e)
        {
            StyleHelper.CreateStyleForwardersForDefaultStyles();

            // TODO: Using a custom IoC container like Unity? Register it here:
            // Catel.IoC.ServiceLocator.Instance.RegisterExternalContainer(MyUnityContainer);

            LogManager.AddDebugListener();

            var serviceLocator = IoC.ServiceLocator.Default;

            // Initialize composite validator provider to enable multiple validator sources
            var provider = new CompositeValidatorProvider();

            provider.Add(new ValidatorProvider());
            provider.Add(new FluentValidatorProvider());

            // serviceLocator.RegisterType<IValidatorProvider, ValidatorProvider>();
            serviceLocator.RegisterInstance <IValidatorProvider>(provider);

            base.OnStartup(e);
        }
Example #28
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var languageService = ServiceLocator.Default.ResolveType <ILanguageService>();

            // Note: it's best to use .CurrentUICulture in actual apps since it will use the preferred language
            // of the user. But in order to demo multilingual features for devs (who mostly have en-US as .CurrentUICulture),
            // we use .CurrentCulture for the sake of the demo
            languageService.PreferredCulture = CultureInfo.CurrentCulture;
            languageService.FallbackCulture  = new CultureInfo("en-US");

            FontImage.RegisterFont("FontAwesome", new FontFamily(new Uri("pack://application:,,,/Orc.Theming.Example;component/Resources/Fonts/", UriKind.RelativeOrAbsolute), "./#FontAwesome"));
            FontImage.DefaultFontFamily = "FontAwesome";

            // This shows the StyleHelper, but uses a *copy* of the Orchestra themes. The default margins for controls are not defined in
            // Orc.Theming since it's a low-level library. The final default styles should be in the shell (thus Orchestra makes sense)
            StyleHelper.CreateStyleForwardersForDefaultStyles();

            Log.Info("Starting application");
            Log.Info("This log message should show up as debug");

            base.OnStartup(e);
        }
Example #29
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var languageService = ServiceLocator.Default.ResolveType <ILanguageService>();

            // Note: it's best to use .CurrentUICulture in actual apps since it will use the preferred language
            // of the user. But in order to demo multilingual features for devs (who mostly have en-US as .CurrentUICulture),
            // we use .CurrentCulture for the sake of the demo
            languageService.PreferredCulture = CultureInfo.CurrentCulture;
            languageService.FallbackCulture  = new CultureInfo("en-US");

            // Some test logging, but important to load the assembly first
            var externalTypeToForceAssemblyLoad = typeof(LogViewerLogListener);

            Orc.Theming.FontImage.RegisterFont("FontAwesome", new FontFamily(new Uri("pack://application:,,,/Orc.Controls.Example;component/Resources/Fonts/", UriKind.RelativeOrAbsolute), "./#FontAwesome"));
            Orc.Theming.FontImage.DefaultFontFamily = "FontAwesome";

            StyleHelper.CreateStyleForwardersForDefaultStyles();

            Log.Info("Starting application");
            Log.Info("This log message should show up as debug");

            base.OnStartup(e);
        }
Example #30
0
        protected override void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            //LogManager.RegisterDebugListener();
#endif
            log4net.Config.XmlConfigurator.Configure();
            StyleHelper.CreateStyleForwardersForDefaultStyles();

            // ensure the UI elements are drawn using the current UI culture
            FrameworkElement.LanguageProperty.OverrideMetadata(
                typeof(FrameworkElement),
                new FrameworkPropertyMetadata(
                    XmlLanguage.GetLanguage(
                        CultureInfo.CurrentCulture.IetfLanguageTag)));

            ServiceLocator.Default.RegisterType <IEngine, FunaniEngine>();
            ServiceLocator.Default.RegisterType <ICommandQueue, FunaniCommandQueue>();

            var modelView = new MongoDbViewModel(Dispatcher);
            ServiceLocator.Default.RegisterInstance <IConsoleRedirect>(modelView);

            base.OnStartup(e);
        }