예제 #1
0
        public override void CreateCommandConsole(CommandConsoleConfig config)
        {
            if (CreateUI == false)
            {
                return;
            }

            _commandConsoleConfig = config;

            _commandConsoleViewModel = new CommandConsoleViewModel();

            _commandConsoleWindow = new CommandConsoleWindow
            {
                Top    = config.Top,
                Left   = config.Left,
                Width  = config.Width,
                Height = config.Height
            };

            _commandConsoleWindow.DataContext = _commandConsoleViewModel;

            _profilerViewModel.LevelItemChanged += (sender, args) =>
            {
                OnLevelItemChanged(new LevelItemChangedEventArgs(args.Key, args.LevelId, args.Enabled));
            };

            _commandConsoleWindow.ClearOutput      += (sender, args) => _commandConsoleViewModel.ClearOutput();
            _commandConsoleWindow.IsVisibleChanged += (sender, args) => _commandConsoleConfig.Visible = _commandConsoleWindow.IsVisible;
            _commandConsoleWindow.LocationChanged  += (sender, args) => _commandConsoleLocationJustChanged = true;
            _commandConsoleWindow.SizeChanged      += (sender, args) => _commandConsoleLocationJustChanged = true;

            _commandConsoleWindow.ExecuteCommand  += (sender, args) => GearsetResources.Console.CommandConsole.ExecuteCommand(args.Command);
            _commandConsoleWindow.PreviousCommand += (sender, args) => _commandConsoleViewModel.CommandText = GearsetResources.Console.CommandConsole.PreviousCommand();
            _commandConsoleWindow.NextCommand     += (sender, args) => _commandConsoleViewModel.CommandText = GearsetResources.Console.CommandConsole.NextCommand();

            if (_commandConsoleConfig.Visible)
            {
                _commandConsoleWindow.Show();
            }

            _windows.Add(_commandConsoleWindow);

            _consoleScrollViewer = GetDescendantByType(_commandConsoleWindow.OutputListView, typeof(ScrollViewer)) as ScrollViewer;

            WindowHelper.EnsureOnScreen(_commandConsoleWindow);
            ElementHost.EnableModelessKeyboardInterop(_commandConsoleWindow);
        }
        public override void CreateCommandConsole(CommandConsoleConfig config)
        {
            if (CreateUI == false)
            {
                return;
            }

            _commandConsoleConfig = config;

            _commandConsoleWindowViewModel = new CommandConsoleWindowViewModel();

            _commandConsoleWindowViewModel.Execute += (sender, args) =>
            {
                OnExecuteCommand(new ExecuteCommandEventArgs(_commandConsoleWindowViewModel.CommandText));
            };

            _commandConsoleWindow = new CommandConsoleWindow {
                DataContext = _commandConsoleWindowViewModel, Padding = _windowPadding
            };
            _commandConsoleWindow.SizeChanged += (sender, args) =>
            {
                _commandConsoleConfig.Width  = _commandConsoleWindow.ActualWidth;
                _commandConsoleConfig.Height = _commandConsoleWindow.ActualHeight;
            };

            _commandConsoleWindow.LogListBox.ItemsSource = _commandConsoleWindowViewModel.Output;

            var commandConsoleTemplate = new DataTemplate(typeof(CommandConsoleWindowViewModel), parent =>
            {
                _commandConsoleWindow.Parent = parent;
                return(_commandConsoleWindow);
            });

            _gearsetUI.Resources.Add(commandConsoleTemplate.DataTemplateKey, commandConsoleTemplate);

            _commandConsoleScrollViewer = _commandConsoleWindow.ScrollViewer;

            InitialiseWindow(_commandConsoleWindowViewModel, config.Top, config.Left, config.Width, config.Height, config.Visible);

            _widgetWindowViewModel.CommandConsoleWindowVisible = config.Visible;
        }
예제 #3
0
 public abstract void CreateCommandConsole(CommandConsoleConfig config);