public MacClientSessionViewControllers(SessionWindowController sessionWindowController)
        {
            if (sessionWindowController == null)
            {
                throw new ArgumentNullException(nameof(sessionWindowController));
            }

            WindowTabs = sessionWindowController.TabViewController;

            Status = (StatusToolbarViewController)NSStoryboard
                     .FromName("Main", NSBundle.MainBundle)
                     .InstantiateControllerWithIdentifier("StatusToolbar");
            Status.Session = sessionWindowController.Session;

            // Set up history. Provide initial seed from NSUsrDefaults if the history file does not exist.
            string [] history = null;
            if (!History.HistoryFile.FileExists)
            {
                history = NSUserDefaults.StandardUserDefaults.StringArrayForKey("repl.history");
            }

            ReplHistory = new History(history: history, persist: Prefs.Repl.SaveHistory.GetValue());

            PreferenceStore.Default.Subscribe(ObservePreferenceChange);

            ReplHistory.Append(String.Empty);

            Messages = new MessageViewController(
                Status,
                new NSAlertMessageViewDelegate(sessionWindowController.Window));

            WorkbookTargets = new WorkbookTargetsViewController();
        }
Exemplo n.º 2
0
        public override void MakeWindowControllers()
        {
            MainThread.Ensure();

            InstanceForWindowControllers = this;

            sessionWindowController = (SessionWindowController)NSStoryboard
                                      .FromName("Main", NSBundle.MainBundle)
                                      .InstantiateControllerWithIdentifier(nameof(SessionWindowController));

            InstanceForWindowControllers = null;

            Session.Subscribe(this);

            Session.Workbook.EditorHub.Events.Subscribe(
                new Observer <EditorEvent> (HandleEditorEvent));

            AddWindowController(sessionWindowController);

            Log.Info(TAG, $"Created {sessionWindowController.GetType ()}");
        }