示例#1
0
        /// <summary>
        /// This is the entry-piont to the application, which gets called as soon as the application has finished starting up.
        /// </summary>
        /// <param name="eventArguments">The event arguments, that contains all necessary information about the application startup like the command line arguments.</param>
        protected override async Task OnStartedAsync(ApplicationStartedEventArgs eventArguments)
        {
            // Initializes the IOC container; in this sample the Simple IOC is used
            this.iocContainer = new SimpleIocContainer();

            // Binds the todo list item repository and some services to the IOC container, so that it can be automatically injected into view models
            this.iocContainer.RegisterType <IReadOnlyIocContainer>(() => this.iocContainer);
            this.iocContainer.RegisterType <TodoListItemsRepository>(Scope.Singleton);
            this.iocContainer.RegisterType <WindowNavigationService>(Scope.Singleton);
            this.iocContainer.RegisterType <ApplicationService>(Scope.Singleton);
            this.iocContainer.RegisterType <DialogService>(Scope.Singleton);

            // Navigates the user to the main view
            WindowNavigationService windowNavigationService = this.iocContainer.GetInstance <WindowNavigationService>();
            await windowNavigationService.NavigateAsync <MainWindow, MainView>(null, true);
        }
示例#2
0
 /// <summary>
 /// On application start
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public static void OnApplicationStartedHandler(object sender, ApplicationStartedEventArgs args)
 {
     try
     {
         Console.ForegroundColor = ConsoleColor.DarkMagenta;
         var topAndBottom = new string('-', Console.WindowWidth - 1);
         Console.Write(topAndBottom + "\n");
         Console.Write(topAndBottom + "\n");
         var padding = new string('-', (Console.WindowWidth - args.AppIdentifier.Length) / 2);
         Console.Write(padding);
         Console.ForegroundColor = ConsoleColor.White;
         Console.Write(args.AppIdentifier);
         Console.ForegroundColor = ConsoleColor.DarkMagenta;
         Console.Write(padding + "\n");
         Console.Write(topAndBottom + "\n");
         Console.Write(topAndBottom + "\n");
         Console.ForegroundColor = ConsoleColor.White;
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
示例#3
0
 /// <summary>
 /// Application started handler
 /// </summary>
 /// <param name="e"></param>
 public static void ApplicationStarted(ApplicationStartedEventArgs e)
 => InvokeEvent(null, OnApplicationStarted, e, nameof(OnApplicationStarted));
示例#4
0
 /// <summary>
 /// On application start
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public static void OnApplicationStartedHandler(object sender, ApplicationStartedEventArgs args)
 {
     Console.WriteLine(args.AppIdentifier);
 }