private void Item_Redo_Click(object sender, RoutedEventArgs e) { try { if (HistoryRedo.Count > 0) { int last = HistoryRedo.Count - 1; if (HistoryRedo[last] is His_RemovedControl) { SpecialRemoved = true; } HistoryRedo[last].DoRedoAction(DesignCanvas, data); HistoryCommand historyCommand = HistoryRedo[last]; HistoryRedo.RemoveAt(last); HistoryUndo.Add(historyCommand); Undo_MI.IsEnabled = true; if (HistoryRedo.Count == 0) { Redo_MI.IsEnabled = false; } } else { Redo_MI.IsEnabled = false; } } catch (Exception ex) { Debug.WriteLine("Redo Error: " + ex); } }
public TexoCommand( IEnvironmentService environment, IInputHistoryService history) { this.environment = new EnvironmentCommand(environment); this.history = new HistoryCommand(history); }
public HistoryEvent(object source, HistoryCommand command, object param1, object param2) { Source = source; Command = command; Parameter1 = param1; Parameter2 = param2; }
public void Init() { h = new HistoryCommand(); h.Add("11"); h.Add("222"); h.Add("333"); }
public CmdControlViewModel() { this.DisplayName = "CMD Window"; historyCommand = new HistoryCommand(); cmdReader = new CmdReader(); cmdReader.Register(this); Init(); }
public void ShouldHaveCorrectCommandVersion() { // Arrange var command = new HistoryCommand(); // Act var usage = command.Usage; // Assert Assert.Equal(string.Format("dbversion {0} [options]", command.Name), usage); }
public void ShouldHaveCorrectDescription() { // Arrange var command = new HistoryCommand(); // Act var description = command.Description; // Assert Assert.Equal("Prints out a history of the installed versions.", description); }
public void ShouldHaveCorrectCommandName() { // Arrange var command = new HistoryCommand(); // Act var name = command.Name; // Assert Assert.Equal("history", name); }
public CommandSystem() { Commands = new Dictionary <string, Command>(); CommandLog = new CommandLog(); DateCommand dateCommand = new DateCommand(); HistoryCommand historyCommand = new HistoryCommand(CommandLog.GetLog, CommandLog.Clear, CommandLog.GetLogById); Commands.Add(dateCommand.Name, dateCommand); Commands.Add(historyCommand.Name, historyCommand); }
public MainViewModel() { _dataGrid = new ObservableCollection <DataGrid>(); _dataGrid = dataGridService.GetCurrent(); CurrentCommand = new CurrentCommand(this); ReservationCommand = new ReservationCommand(this); HistoryCommand = new HistoryCommand(this); DeleteCommand = new DeleteCommand(this); UpdateCommand = new UpdateCommand(this); AvaibleRoomsCommand = new AvaibleRoomsCommand(this); SetButtons(true, false, false, true, true); }
private HistoryCommand CreateCommand() { var command = new HistoryCommand(); command.VersionProvider = this.versionProvider.Object; command.MessageService = this.messageService; command.SessionFactoryProvider = this.sessionFactoryProvider.Object; command.SettingsService = this.settingsService.Object; command.PropertyService = this.propertyService.Object; command.ArchiveFactories = new[] { this.archiveFactory.Object }; command.SavedConnectionService = this.savedConnectionService.Object; return(command); }
public void Add(object source, HistoryCommand command, object param1, object param2) { if (_events.Count - 1 > _current) { for (int i = _events.Count - 1; i > _current; i--) { _events.RemoveAt(i); } } // Check if we're at our limit if (_events.Count == MaxEvents) { // Expire the first item in the collection _events.RemoveAt(0); } _events.Add(new HistoryEvent(source, command, param1, param2)); _current = _events.Count - 1; }