Exemple #1
0
        public void SetUp()
        {
            _row = new RowBuilder()
                   .WithId(1)
                   .WithField("http://www.test.com")
                   .Build();
            _column = new ColumnBuilder()
                      .WithIndex(0)
                      .Build();
            _layout = new ScatterPlotLayoutBuilder()
                      .WithLinkColumn(_column)
                      .Build();
            _view = new ScatterPlotBuilder()
                    .WithLayout(_layout)
                    .Build();

            _mockViewRepository = new Mock <IViewRepository>();
            _mockViewRepository.Setup(p => p.Get <ScatterPlot>())
            .Returns(_view);

            _mockRowRepository = new Mock <IRowRepository>();
            _mockRowRepository.Setup(p => p.Get(_row.Id))
            .Returns(_row);

            _mockProcess = new Mock <IProcess>();

            _handler = new ExecuteCommandHandler(
                _mockViewRepository.Object,
                _mockRowRepository.Object,
                _mockProcess.Object);
        }
Exemple #2
0
 public AppPopupMenuCommand(string cmdId, CommandMediator mediator, ExecuteCommandHandler executor, string caption, string desciption, int imageIndex) :
     this(cmdId, mediator, executor, caption, desciption)
 {
     Infragistics.Win.Appearance a = new Infragistics.Win.Appearance();
     a.Image = imageIndex;
     base.SharedProps.AppearancesSmall.Appearance = a;
 }
Exemple #3
0
        public AppContextMenuCommand(string cmdId, CommandMediator mediator, ExecuteCommandHandler executor, string captionResourceId, string descResourceId)
            : this()
        {
            string _text = Resource.Manager[captionResourceId];

            if (_text == null)
            {
                _text = captionResourceId;
            }
            base.Text = _text;

            _description = Resource.Manager[descResourceId];
            if (_description == null)
            {
                _description = descResourceId;
            }

            _id        = cmdId;
            _med       = mediator;
            OnExecute += executor;
            if (_med != null)
            {
                _med.RegisterCommand(cmdId, this);
            }
        }
Exemple #4
0
        public AppMenuCommand(string cmdId, CommandMediator mediator, ExecuteCommandHandler executor, string captionResourceId, string descResourceId)
            : this()
        {
            string t = Resource.Manager[captionResourceId];
            string d = Resource.Manager[descResourceId];

            if (t == null)
            {
                t = captionResourceId;
            }
            if (d == null)
            {
                d = descResourceId;
            }

            base.Text        = t;
            base.ToolTipText = d;

            base.Tag   = cmdId;
            this._id   = cmdId;
            _med       = mediator;
            OnExecute += executor;
            if (_med != null)
            {
                _med.RegisterCommand(cmdId, this);
            }
        }
Exemple #5
0
        public TestEnvironmentViewModel(
            IViewFactory viewFactory,
            IConnectionProvider connectionProvider,
            DbCommandProvider dbCommandProvider,
            ParameterViewModelBuilder parameterViewModelBuilder)
        {
            _viewFactory                            = viewFactory;
            _connectionProvider                     = connectionProvider;
            _dbCommandProvider                      = dbCommandProvider;
            _parameterViewModelBuilder              = parameterViewModelBuilder;
            _connectionProvider.ConnectionsChanged += (sender, args) =>
            {
                Connections = BuildConnectionList(args.Connections);
                ActiveTest.SelectedConnection = Connections.First();
                ExecuteCommandHandler?.RaiseCanExecuteChanged();
            };

            Connections = BuildConnectionList(_connectionProvider.GetConnections());
            Tests       = new ObservableCollection <QueryStressTestViewModel>();

            AddNewQueryStressTest();
            OnConnectionChanged();

            ExecuteCommandHandler            = new CommandHandler((_) => Execute());
            StopCommandHandler               = new CommandHandler((_) => Stop());
            NewQueryStressTestCommandHandler = new CommandHandler((_) => AddNewQueryStressTest());
            ConnectionDropdownClosedCommand  = new CommandHandler((_) => OnConnectionDropdownClosed());
            ConnectionChangedCommand         = new CommandHandler((_) => OnConnectionChanged());
            DbCommandSelected            = new CommandHandler((dbCommand) => InvokeDbCommand((DbCommand)dbCommand));
            OpenParameterSettingsCommand = new CommandHandler((_) => OpenParameterSettings());
            RemoveTestCommand            = new CommandHandler((test) => RemoveTest((QueryStressTestViewModel)test));
        }
 /// <summary>Создаёт экземпляр команды для методов без параметра.</summary>
 /// <param name="executeHandler">Делегат метода исполняющего команду.</param>
 /// <param name="canExecuteHandler">Делегат метода проверяющего состояние команды.</param>
 /// <param name="dispatcher">Диспетчер. Не может быть <see langword="null"/>.</param>
 public RelayCommand(ExecuteCommandHandler executeHandler, CanExecuteCommandHandler canExecuteHandler, Dispatcher dispatcher)
     : base(executeHandler, canExecuteHandler)
 {
     Dispatcher       = dispatcher ?? throw DispatcherNullException;
     requerySuggested = RaiseCanExecuteChanged;
     CommandManager.RequerySuggested += requerySuggested;
 }
Exemple #7
0
 public AppMenuCommand(string cmdId, ExecuteCommandHandler executor, string caption)
     : this()
 {
     base.Text  = caption;
     base.Tag   = cmdId;
     this._id   = cmdId;
     OnExecute += executor;
 }
Exemple #8
0
        public AppButtonToolCommand(string cmdId, CommandMediator mediator, ExecuteCommandHandler executor, string caption, string desciption, int imageIndex) :
            this(cmdId, mediator, executor, caption, desciption)
        {
            Appearance a = new Appearance();

            a.Image = imageIndex;
            base.SharedProps.AppearancesSmall.Appearance = a;
        }
        /// <summary>Создаёт экземпляр команды для методов без параметра.</summary>
        /// <param name="executeHandler">Делегат метода исполняющего команду.</param>
        /// <param name="canExecuteHandler">Делегат метода проверяющего состояние команды.</param>
        public RelayCommand(Action executeHandler, Func <bool> canExecuteHandler)
            : this((Type)null)
        {
            execute    = executeHandler ?? throw ExecuteHandlerNullException;
            canExecute = canExecuteHandler ?? throw CanExecuteHandlerNullException;

            executeObject    = ExecuteNoParameter;
            canExecuteObject = CanExecuteNoParameter;
        }
Exemple #10
0
        public AppStateButtonToolCommand(string cmdId, CommandMediator mediator, ExecuteCommandHandler executor, string caption, string description) :
            this(cmdId) {
            base.SharedProps.Caption    = caption;
            base.SharedProps.StatusText = description;

            OnExecute += executor;
            med        = mediator;
            med.RegisterCommand(cmdId, this);
        }
Exemple #11
0
        public AppStateButtonToolCommand(string cmdId, CommandMediator mediator, ExecuteCommandHandler executor, string caption, string description, int imageIndex, ShortcutHandler shortcuts) :
            this(cmdId, mediator, executor, caption, description)
        {
            Appearance a = new Appearance();

            a.Image = imageIndex;
            base.SharedProps.AppearancesSmall.Appearance = a;
            base.MenuDisplayStyle = StateButtonMenuDisplayStyle.DisplayToolImage;
            SetShortcuts(cmdId, shortcuts);
        }
Exemple #12
0
        public AppContextMenuCommand(string cmdId, CommandMediator mediator, ExecuteCommandHandler executor, string caption, string description) :
            this()
        {
            Text             = caption;
            this.description = description;

            Tag = cmdId;
            med = mediator;
            if (executor != null)
            {
                OnExecute += executor;
            }
            med.RegisterCommand(cmdId, this);
        }
Exemple #13
0
        public void RegisterCallbacks(ExecuteCommandHandler delExecuteCommand, GetAccountPrivilegesHandler delGetAccountPrivileges, GetVariableHandler delGetVariable, GetVariableHandler delGetSvVariable, GetMapDefinesHandler delGetMapDefines, TryGetLocalizedHandler delTryGetLocalized, RegisterCommandHandler delRegisterCommand, UnregisterCommandHandler delUnregisterCommand, GetRegisteredCommandsHandler delGetRegisteredCommands, GetWeaponDefinesHandler delGetWeaponDefines, GetSpecializationDefinesHandler delGetSpecializationDefines, GetLoggedInAccountUsernamesHandler delGetLoggedInAccountUsernames, RegisterEventsHandler delRegisterEvents)
        {
            this.m_delExecuteCommand       = delExecuteCommand;
            this.m_delGetAccountPrivileges = delGetAccountPrivileges;
            this.m_delGetVariable          = delGetVariable;
            this.m_delGetSvVariable        = delGetSvVariable;
            this.m_delGetMapDefines        = delGetMapDefines;
            this.m_delTryGetLocalized      = delTryGetLocalized;

            this.m_delRegisterCommand       = delRegisterCommand;
            this.m_delUnregisterCommand     = delUnregisterCommand;
            this.m_delGetRegisteredCommands = delGetRegisteredCommands;

            this.m_delGetWeaponDefines         = delGetWeaponDefines;
            this.m_delGetSpecializationDefines = delGetSpecializationDefines;

            this.m_delGetLoggedInAccountUsernames = delGetLoggedInAccountUsernames;
            this.m_delRegisterEvents = delRegisterEvents;

            this.SetupInternalDictionaries();
        }
Exemple #14
0
        public void RegisterCallbacks(ExecuteCommandHandler delExecuteCommand, GetAccountPrivilegesHandler delGetAccountPrivileges, GetVariableHandler delGetVariable, GetVariableHandler delGetSvVariable, GetMapDefinesHandler delGetMapDefines, TryGetLocalizedHandler delTryGetLocalized, RegisterCommandHandler delRegisterCommand, UnregisterCommandHandler delUnregisterCommand, GetRegisteredCommandsHandler delGetRegisteredCommands, GetWeaponDefinesHandler delGetWeaponDefines, GetSpecializationDefinesHandler delGetSpecializationDefines, GetLoggedInAccountUsernamesHandler delGetLoggedInAccountUsernames, RegisterEventsHandler delRegisterEvents)
        {
            _executeCommandDelegate       = delExecuteCommand;
            _getAccountPrivilegesDelegate = delGetAccountPrivileges;
            _getVariableDelegate          = delGetVariable;
            _getSvVariableDelegate        = delGetSvVariable;
            _getMapDefinesDelegate        = delGetMapDefines;
            _tryGetLocalizedDelegate      = delTryGetLocalized;

            _registerCommandDelegate       = delRegisterCommand;
            _unregisterCommandDelegate     = delUnregisterCommand;
            _getRegisteredCommandsDelegate = delGetRegisteredCommands;

            _getWeaponDefinesDelegate         = delGetWeaponDefines;
            _getSpecializationDefinesDelegate = delGetSpecializationDefines;

            _getLoggedInAccountUsernamesDelegate = delGetLoggedInAccountUsernames;
            _registerEventsDelegate = delRegisterEvents;

            SetupInternalDictionaries();
        }
Exemple #15
0
        // TODO: Change test structure so that this can be inlined
        internal static void Run(Stream stdin, Stream stdout)
        {
            var stdoutWriter = new StdoutWriter(stdout, new Utf8JsonWriter(stdout, new() {
                Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
            }));

            var flowWriter = new FlowWriter(stdoutWriter, new Utf8ValuePresenter());

            SetupRuntimeServices(flowWriter, stdoutWriter);

            var executeCommandHandler = new ExecuteCommandHandler(flowWriter, stdoutWriter);
            var shouldExit            = false;

            while (!shouldExit)
            {
                var command = Serializer.DeserializeWithLengthPrefix <ExecuteCommand?>(stdin, PrefixStyle.Base128);
                if (command == null)
                {
                    break; // end-of-input
                }
                executeCommandHandler.Execute(command);
            }
        }
 /// <summary>Создаёт экземпляр команды для методов без параметра.</summary>
 /// <param name="executeHandler">Делегат метода исполняющего команду.</param>
 /// <param name="canExecuteHandler">Делегат метода проверяющего состояние команды.</param>
 /// <remarks><see cref="Dispatcher"/> = <see cref="Application.Current"/>.<see cref="System.Windows.Threading.Dispatcher"/>.</remarks>
 public RelayCommand(ExecuteCommandHandler executeHandler, CanExecuteCommandHandler canExecuteHandler)
     : this(executeHandler, canExecuteHandler, Application.Current.Dispatcher)
 {
 }
 /// <summary>Создаёт экземпляр команды для методов без параметра.</summary>
 /// <param name="executeHandler">Делегат метода исполняющего команду.</param>
 /// <remarks><see cref="Dispatcher"/>=<see cref="Application.Current"/>.<see cref="System.Windows.Threading.Dispatcher"/>.<br/>
 /// <see cref="Commands.RelayCommand.CanExecute"/> = <see cref="Commands.RelayCommand.AlwaysTrue(object)"/></remarks>
 public RelayCommand(ExecuteCommandHandler executeHandler)
     : this(executeHandler, AlwaysTrue)
 {
 }
Exemple #18
0
 public AppStateButtonToolCommand(string cmdId, CommandMediator mediator, ExecuteCommandHandler executor, string caption, string description, ShortcutHandler shortcuts) :
     this(cmdId, mediator, executor, caption, description)
 {
     SetShortcuts(cmdId, shortcuts);
 }
 /// <summary>Создаёт экземпляр команды для методов без параметра.</summary>
 /// <param name="executeHandler">Делегат метода исполняющего команду.</param>
 /// <param name="dispatcher">Диспетчер. Не может быть <see langword="null"/>.</param>
 /// <remarks><see cref="Commands.RelayCommand.CanExecute"/>=<see cref="Commands.RelayCommand.AlwaysTrue(object)"/></remarks>
 public RelayCommand(ExecuteCommandHandler executeHandler, Dispatcher dispatcher)
     : this(executeHandler, AlwaysTrue, dispatcher)
 {
 }
Exemple #20
0
 public AppContextMenuCommand(string cmdId, CommandMediator mediator, ExecuteCommandHandler executor, string captionResourceId, string descResourceId, int imageIndex, ShortcutManager shortcuts)
     : this(cmdId, mediator, executor, captionResourceId, descResourceId)
 {
     SetShortcuts(cmdId, shortcuts);
 }
Exemple #21
0
 public AppContextMenuCommand(string cmdId, CommandMediator mediator, ExecuteCommandHandler executor, string captionResourceId, string descResourceId, int imageIndex)
     : this(cmdId, mediator, executor, captionResourceId, descResourceId)
 {
     _imageIndex = imageIndex;
 }
 ICommandBarButton ICommandBarItemCollection.AddButton(string identifier, string caption, ExecuteCommandHandler clickHandler, System.Windows.Forms.Keys keyBinding)
 {
     // TODO:  Add CommandBarItemCollection.RssBandit.AppServices.ICommandBarItemCollection.AddButton implementation
     return(null);
 }
 public ICommandBarButton AddButton(string identifier, string caption, System.Drawing.Image image, ExecuteCommandHandler clickHandler, System.Windows.Forms.Keys keyBinding)
 {
     // TODO:  Add CommandBarItemCollection.AddButton implementation
     return(null);
 }
 ICommandBarButton ICommandBarItemCollection.AddButton(string identifier, string caption, ExecuteCommandHandler clickHandler)
 {
     // TODO:  Add CommandBarItemCollection.ICommandBarItemCollection.AddButton implementation
     return(null);
 }
 public ICommandBarButton InsertButton(int index, string caption, ExecuteCommandHandler clickHandler)
 {
     // TODO:  Add CommandBarItemCollection.InsertButton implementation
     return(null);
 }
Exemple #26
0
 public AppContextMenuCommand(string cmdId, CommandMediator mediator, ExecuteCommandHandler executor, string caption, string description, int imageIndex, ShortcutHandler shortcuts) :
     this(cmdId, mediator, executor, caption, description, imageIndex)
 {
     SetShortcuts(cmdId, shortcuts);
 }
 /// <summary>Создаёт экземпляр команды для методов object параметром.</summary>
 /// <param name="executeHandler">Делегат метода исполняющего команду.</param>
 /// <param name="canExecuteHandler">Делегат метода проверяющего состояние команды.</param>
 public RelayCommand(ExecuteCommandHandler executeHandler, CanExecuteCommandHandler canExecuteHandler)
     : this(typeof(object))
 {
     executeObject    = executeHandler ?? throw ExecuteHandlerNullException;
     canExecuteObject = canExecuteHandler ?? throw CanExecuteHandlerNullException;
 }
Exemple #28
0
 public AppContextMenuCommand(string cmdId, CommandMediator mediator, ExecuteCommandHandler executor, string caption, string description, int imageIndex) :
     this(cmdId, mediator, executor, caption, description)
 {
     this.imageIndex = imageIndex;
 }