private void Application_Startup(object sender, StartupEventArgs e)
        {
            WinForms.Application.EnableVisualStyles();
            WinForms.Application.SetCompatibleTextRenderingDefault(false);

            if (!Multicaster.CheckAccess())
            {
                Dispatcher.InvokeShutdown();
                return;
            }
            Orchestrator.Run(LogicalScreens);
        }
Ejemplo n.º 2
0
        private Orchestrator(IEnumerable <Rect> screens)
        {
            Multicaster = new Multicaster();
            Multicaster.CommandReceived += Multicaster_CommandReceived;

            Hosts          = new ReadOnlyCollection <ViewHost>(screens.Select(s => new ViewHost(this, s)).ToArray());
            AvailableViews = new ViewCommandCollection(new[] {
                TryCreateSingletonCommand("Intro", Views.IntroView.TryCreateFactory(@"Intro\")),
                new ViewCommand(this, "Message", o => new Views.MessageView(o))
            }.Concat(Directory.EnumerateDirectories(Environment.CurrentDirectory)
                     .Where(d => !Path.GetFileName(d).Equals("Intro", StringComparison.OrdinalIgnoreCase) &&
                            Directory.EnumerateFiles(d, "*.jpg").Any())
                     .Select(d => new ViewCommand(this,
                                                  "Photos: " + Path.GetFileName(d),
                                                  o => new Views.SlideshowView(o, "Photos: " + Path.GetFileName(d), d)
                                                  ))
                     ).Concat(Directory.EnumerateDirectories(Environment.CurrentDirectory)
                              .Where(d => Directory.EnumerateFiles(d)
                                     .Any(p => Views.VideoView.extensions.Contains(Path.GetExtension(p))))
                              .Select(d => Views.VideoView.CreateFactory(this, d))
                              ));
        }