Beispiel #1
0
        public Endpoint(Hub.IFactory hubFactory, Registration.IFactory registrationFactory)
        {
            _debug = new ObservableStreamWriter();

            _hubFactory          = hubFactory;
            _registrationFactory = registrationFactory;

            _registrations = new Registration.Collection();
        }
Beispiel #2
0
        public Endpoint(Hub.IFactory hubFactory, Registration.IFactory registrationFactory)
        {
            _debug = new ObservableStreamWriter();

            _hubFactory = hubFactory;
            _registrationFactory = registrationFactory;

            _registrations = new Registration.Collection();
        }
Beispiel #3
0
        public static void Main(string [] argv)
        {
            Thread.CurrentThread.SetInvariantCulture();

            Application.Initialize(argv);

            var log    = new Subject <string>();
            var shell  = new Shell();
            var writer = new ObservableStreamWriter();

            writer.Chunks.Subscribe(log);
            Console.SetOut(writer);

            var autoReloadFiles = new List <AbsoluteFilePath>();

            foreach (var arg in argv)
            {
                var path = (AbsoluteFilePath)shell.ResolveAbsolutePath(arg);
                if (path.Name.Extension == ".cs")
                {
                    autoReloadFiles.Add(AbsoluteFilePath.Parse(arg));
                }
                else
                {
                    throw new Exception("Invalid argument, expected filepaths which ends with '.cs'.");
                }
            }

            UserSettings.Settings = PersistentSettings.Load(
                usersettingsfile: AbsoluteDirectoryPath.Parse(Environment.CurrentDirectory) / new FileName("autoreload-config.json"));

            if (autoReloadFiles.Count == 0)
            {
                if (Platform.OperatingSystem == OS.Mac)
                {
                    autoReloadFiles.Add(AbsoluteFilePath.Parse(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/../../../AutoReloadContent.cs"));
                }
                else
                {
                    autoReloadFiles.Add(AbsoluteFilePath.Parse("../../AutoReloadContent.cs"));
                }
            }

            var createDebugWindow = new Action(() =>
                                               Application.Desktop.CreateSingletonWindow(
                                                   Observable.Return(true),
                                                   dialog =>
                                                   new Window()
            {
                Title      = Observable.Return("Debug"),
                Size       = Property.Create <Optional <Size <Points> > >(new Size <Points>(600, 500)).ToOptional(),
                Content    = Debugging.CreateDebugControl(),
                Background = Theme.Background,
                Border     = Stroke.Create(1, Color.White),
                Foreground = Color.White,
            }
                                                   ));

            Application.Desktop.CreateSingletonWindow(
                isVisible: Observable.Return(true),
                window: window =>
            {
                return(new Window
                {
                    Title = Observable.Return("Fuse - Autoreload"),
                    Menu = Menu.Item("Debug", createDebugWindow) +
                           Menu.Submenu("Themes",
                                        Menu.Option(
                                            value: Themes.OriginalLight,
                                            name: "Light theme",
                                            property: Theme.CurrentTheme) +
                                        Menu.Option(
                                            value: Themes.OriginalDark,
                                            name: "Dark theme",
                                            property: Theme.CurrentTheme)),
                    Content = Layout.Dock()
                              .Bottom(
                        LogView.Create(log.Select(s => s), Observable.Return(Color.Black))
                        .WithHeight(200)
                        .WithBackground(Color.White))
                              .Fill(AutoreloadControl(shell, autoReloadFiles, log.ToProgress()).Switch()),
                    Background = Theme.Background,
                    Border = Stroke.Create(1, Color.White),
                    Foreground = Color.White,
                });
            });

            Application.Run();
        }