Beispiel #1
0
 public static ConsoleUIController Create(
     IConsoleModel model,
     IConsoleUIView view,
     IConsoleInputDetectorModel inputDetector,
     IConsoleHintModel hint
     )
 {
     return(new ConsoleUIController(
                model,
                view,
                inputDetector,
                hint
                ));
 }
Beispiel #2
0
 public static ConsoleHintUIController Create(
     IConsoleHintModel model,
     IHintUIView hintView,
     IConsoleUIView consoleView,
     IConsoleInputDetectorModel input,
     IConsoleSettings settings
     )
 {
     return(new ConsoleHintUIController(
                model,
                hintView,
                consoleView,
                new ConsoleHintEntryUIViewFactory(),
                input,
                settings
                ));
 }
Beispiel #3
0
        public ConsoleHintUIController(
            IConsoleHintModel model,
            IHintUIView hintView,
            IConsoleUIView consoleView,
            IConsoleHintEntryUIViewFactory entryFactory,
            IConsoleInputDetectorModel input,
            IConsoleSettings settings
            )
        {
            this.model            = model;
            this.view             = hintView;
            this.entryFactory     = entryFactory;
            this.input            = input;
            this.settings         = settings;
            model.OnEnableChange += HandleEnableChange;
            consoleView.InputField.onValueChanged.AddListener(HandleInputValueChanged);

            hintView.SetActive(false);
        }
Beispiel #4
0
        public ConsoleUIController(
            IConsoleModel model,
            IConsoleUIView view,
            IConsoleInputDetectorModel input,
            IConsoleHintModel hintModel
            )
        {
            this.model     = model;
            this.view      = view;
            this.hintModel = hintModel;

            model.OnEnableChange += HandleModelEnableChange;
            model.OnOutputUpdate += HandleOutputUpdate;

            hintModel.OnHintSelected += HandleHintSelected;

            input.OnToggleVisibility += HandleOnToggleVisibility;
            input.OnSubmit           += HandleOnSubmit;

            view.Enabled = false;
        }
Beispiel #5
0
    public static void Initialize()
    {
        if (model != null)
        {
            return;
        }

        IConsoleSettings          settings           = ConsoleSettings.Instance;
        IConsoleInputHistoryModel historyModel       = ConsoleInputHistoryModelFactory.Create(settings);
        ICommandsCollectionModel  commandsCollection = CommandsCollectionFactory.Create(settings);

        model = ConsoleModelFactory.Create(historyModel, commandsCollection);

        IConsoleHintModel hintModel = ConsoleHintModelFactory.Create(
            historyModel,
            commandsCollection,
            settings
            );

        ConsoleUIView view = ConsoleUIViewFactory.Create(settings);
        IConsoleInputDetectorModel inputDetector = ConsoleInputDetectorModelFactory.Create(
            view,
            model,
            settings
            );

        ConsoleUIControllerFactory.Create(model, view, inputDetector, hintModel);
        ConsoleHintUIControllerFactory.Create(
            hintModel,
            view.HintUI,
            view,
            inputDetector,
            settings
            );
        Task.Run(commandsCollection.Initialize);
        inputDetector.Initialize();
    }