public static void FlattenToPathObject(this IObject3D item, UndoBuffer undoBuffer) { if (item is IPathObject pathObject) { using (item.RebuildLock()) { var newPathObject = new PathObject3D(); newPathObject.VertexSource = new VertexStorage(pathObject.VertexSource); // and replace us with the children var replaceCommand = new ReplaceCommand(new[] { item }, new[] { newPathObject }); if (undoBuffer != null) { undoBuffer.AddAndDo(replaceCommand); } else { replaceCommand.Do(); } newPathObject.MakeNameNonColliding(); } } }
public StatVM(StatsUserControl stat) { this.stat = stat; model = new StatModel(); generateComm = new ReplaceCommand(); this.generateComm.ReplaceUserControl += gener; }
public ClientViewModel(ClientBISmapUserControl clientBISmapUserControl, ContentControl page) { this.myview = clientBISmapUserControl; this.page = page; mapBISWinCommand = new ReplaceCommand(); addListCommand = new ReplaceCommand(); }
public ICommand Replace(int startIndex, int len, string newText) { var command = new ReplaceCommand(this, startIndex, len, newText); command.Do(); return(command); }
/// <summary> /// TEMP!!! Needs to include Character as an argument. /// </summary> public void SelectReplacement() { // TEMP: Just select whichever character hasn't fainted. var replacement = Party.Characters.FirstOrDefault(x => x.ActiveState != ActiveState.Fainted); ReplacementCharacterSelected.InvokeSafe(ReplaceCommand.Create(this, replacement)); }
public void When_deleting_item_in_cache_with_time_will_block_replace_operations() { Cache["foo2"] = new CachedItem(); var stream = new MemoryStream(); var command = new DeleteCommand(); command.SetContext(stream); command.Init("foo2", "500"); command.FinishedExecuting += () => wait.Set(); command.Execute(); wait.WaitOne(); Assert.AreEqual("DELETED\r\n", ReadAll(stream)); wait.Reset(); var buffer = new byte[] { 1, 2, 3, 4 }; stream = GetStreamWithData(buffer); var replaceCommand = new ReplaceCommand(); replaceCommand.SetContext(stream); replaceCommand.Init("foo2", "1", "6000", "4"); replaceCommand.FinishedExecuting += () => wait.Set(); replaceCommand.Execute(); wait.WaitOne(); Assert.AreEqual("NOT_STORED\r\n", ReadAll(6, stream)); }
public static void Replace(User user, string pTypeNames) { try { string[] splitted = pTypeNames.Trim().Split(','); string toFind = splitted[0].ToLower().Replace(" ", ""); string toReplace = string.Empty; if (splitted.Length >= 2) { toReplace = splitted[1].Trim().ToLower().Replace(" ", ""); } ReplaceCommand command = new ReplaceCommand(user, toFind, toReplace); if (command.Invoke()) { user.Player.MsgLoc($"{command.BlocksChanged} blocks changed."); } } catch (WorldEditCommandException e) { user.Player.ErrorLocStr(e.Message); } catch (Exception e) { Log.WriteError(Localizer.Do($"{e}")); } }
/// <summary> /// It's fast and not a thread-safety version of ReplaceRows method. /// TODO: remove it after sqlite thread-safety refactoring. /// </summary> /// <param name="rows"></param> /// <returns></returns> public Int64 ReplaceRowsTrans(IEnumerable <ITableRow> rows) { Int64 result = 0L; using (OpenCloseConnectionWrapper wrapper = this.Connection.OpenWrapper()) { using (SQLiteTransaction transaction = wrapper.Connection.BeginTransaction()) { ReplaceCommand replaceCommand = new ReplaceCommand( wrapper.Connection, this.TableDefinition, transaction ); foreach (ITableRow row in rows) { replaceCommand.AddRowForReplacing(row); } result = replaceCommand.Execute(100); transaction.Commit(); } } return(result); }
public async Task ReadResponse() { var command = new ReplaceCommand(); await StorageCommandValidator.AssertReadResponse(command, StorageCommandResult.Stored, true); await StorageCommandValidator.AssertReadResponse(command, StorageCommandResult.NotStored, false); await StorageCommandValidator.AssertReadResponseFailure<ReplaceCommand, bool>(command, StorageCommandResult.NotFound); await StorageCommandValidator.AssertReadResponseFailure<ReplaceCommand, bool>(command, StorageCommandResult.Exists); }
public void WhenOldValueValueNotPresent_ThenSetSame() { var sut = new ReplaceCommand("Jill", "Peter").SetValue(Value); sut.Execute(); Assert.That(sut.Result, Is.EqualTo(Value)); }
public void WhenNewValueIsNullOrEmpty_ThenReplaceWithEmpty(string newValue) { var sut = new ReplaceCommand("John", newValue).SetValue(Value); sut.Execute(); Assert.That(sut.Result, Is.EqualTo(" Smith Smith")); }
public void WhenOldValueIsNullOrEmpty_ThenSetSame(string oldValue) { var sut = new ReplaceCommand(oldValue, "Peter").SetValue(Value); sut.Execute(); Assert.That(sut.Result, Is.EqualTo(Value)); }
// BLimp mybl; public MapsViewModel(MapsUserControlxaml mapsUserControlxaml) { model = new MapModel(); this.myview = mapsUserControlxaml; initializeMap(); returnMapCommand = new ReplaceCommand(); returnMapCommand.ReplaceUserControl += returnWin; }
public ListViewModel(Window1 view) { myview = view; addListCommand = new ReplaceCommand(); mapBISWinCommand = new ReplaceCommand(); mapBISWinCommand.ReplaceUserControl += mapwindow; addListCommand.ReplaceUserControl += addList; }
public void WhenOldValuePresent_ThenReplaceWithNewValue() { var sut = new ReplaceCommand("John", "Peter").SetValue(Value); sut.Execute(); Assert.That(sut.Result, Is.EqualTo("Peter Smith Peter Smith")); }
private ICommand Replace(XTable table, ICommand command) { ReplaceCommand cmd = (ReplaceCommand)command; table.Replace(cmd.Key, cmd.Record); return(null); }
public SelectViewModel(selectUserControl selectUserControl, System.Windows.Controls.ContentControl page) { model = new ClientModel(); this.page = page; myview = selectUserControl; ericCommand = new ReplaceCommand(); ericCommand.ReplaceUserControl += mapfunction; }
public LoginViewModel(Views.LoginV loginUC) { loginuc = loginUC; MyReplaceUCCommand = new ReplaceCommand(); myloginmodel = new LoginModel(); MyReplaceUCCommand.ReplaceUserControl += OKbutt; myforgotcom = new ForgotCom(); myforgotcom.ReplaceUserControl += Forgotbutt; }
public void Transform() { InitNextTransform(); var replaceIndex = _random.Next(_commands.Count); var replacedICommand = GetReplacedVersionOf(replaceIndex); var replaceCommand = new ReplaceCommand(_commands, replacedICommand, replaceIndex); _replaced = replaceCommand; replaceCommand.Execute(); }
public async Task ReplaceCommandHandler_MissingTask_ReturnsNull() { var command = new ReplaceCommand { ItemNumber = 12, Text = "Replace" }; var result = await _handler.Handle(command, new CancellationToken()); result.Should().BeNull(); }
public AddclientVM(AddClientUserControlxaml addClientUserControlxaml) { model = new ClientModel(); this.myview = addClientUserControlxaml; this.addClientComm = new ReplaceCommand(); this.CancelComm = new ReplaceCommand(); addClientComm.ReplaceUserControl += addClientButton; CancelComm.ReplaceUserControl += cancel; }
private void RefreshCanExecute() { FindNextCommand.RaiseCanExecuteChanged(); FindPreviousCommand.RaiseCanExecuteChanged(); FindInDocumentCommand.RaiseCanExecuteChanged(); HighlightAllCommand.RaiseCanExecuteChanged(); ReplaceCommand.RaiseCanExecuteChanged(); ReplaceAllCommand.RaiseCanExecuteChanged(); }
// public System.Windows.Controls.ContentControl page; public UpdateDMViewModel(UpdateDelV view) { model = new DelModel(); this.myview = view; updateDelComm = new ReplaceCommand(); cancelComm = new ReplaceCommand(); this.updateDelComm.ReplaceUserControl += update; cancelComm.ReplaceUserControl += cancel; //this.page = page1; }
public async Task ReplaceCommandHandler_ReplacesPartsThatAreSpecified(string replace, string expected) { var command = new ReplaceCommand { ItemNumber = 2, Text = replace }; var result = await _handler.Handle(command, new CancellationToken()); result.Should().NotBeNull(); result.ToString().Should().Be(expected); }
public async Task ReplaceCommandHandler_ReplacedIsWrittenToFile() { var command = new ReplaceCommand { ItemNumber = 4, Text = "Replace" }; _ = await _handler.Handle(command, new CancellationToken()); _taskFile.TaskLines[2].Should().Be("Replace"); }
public async Task ReplaceCommandHandler_ReplacesText(int line, string expected) { var command = new ReplaceCommand { ItemNumber = line, Text = "Replace" }; var result = await _handler.Handle(command, new CancellationToken()); result.Should().NotBeNull(); result.ToString().Should().Be(expected); }
public async Task ReplaceCommandHandler_RemovesBlankLinesFromTodoFile() { var command = new ReplaceCommand { ItemNumber = 2, Text = "Replace" }; _ = await _handler.Handle(command, new CancellationToken()); _taskFile.TaskLines.Should().HaveCount(4); }
// public System.Windows.Controls.ContentControl page; public addDMviewModel(AddDelV view) { model = new DelModel(); this.myview = view; addDelComm = new ReplaceCommand(); this.addDelComm.ReplaceUserControl += add; cancelComm = new ReplaceCommand(); cancelComm.ReplaceUserControl += cancel; //this.page = page1; }
public DisViewModel(DistUserControl distUserControl, System.Windows.Controls.ContentControl page1) { model = new DistributionModel(); this.distUserControl = distUserControl; addDisComm = new ReplaceCommand(); successDisComm = new ReplaceCommand(); this.addDisComm.ReplaceUserControl += addButton; this.successDisComm.ReplaceUserControl += successButton; this.page = page1; }
public ClientViewModel(ClientUserControl clientUserControl, ContentControl page) { model = new ClientModel(); this.clientUserControl = clientUserControl; this.page = page; addWinCommand = new ReplaceCommand(); mapWinCommand = new ReplaceCommand(); addWinCommand.ReplaceUserControl += addwindow; mapWinCommand.ReplaceUserControl += mapwindow; }
public RepeatableFlexPageViewModel(INavigationService navigationService, IPageDialogService pageDlg) { FlexDirection.Value = Xamarin.Forms.FlexDirection.Row; FlexAlignItems.Value = Xamarin.Forms.FlexAlignItems.Start; FlexJustify.Value = Xamarin.Forms.FlexJustify.Start; FlexWrap.Value = Xamarin.Forms.FlexWrap.NoWrap; ScrollDirection.Value = ScrollOrientation.Horizontal; SetColors(DirectionColor, 0); SetColors(AColor, 3); SetColors(JColor, 3); SetColors(WrapColor, 0); DirectionCommand.Subscribe(x => { var idx = int.Parse(x); FlexDirection.Value = (Xamarin.Forms.FlexDirection)idx; SetScrollDirection(); SetColors(DirectionColor, idx); }); AlignItemsCommand.Subscribe(x => { var idx = int.Parse(x); FlexAlignItems.Value = (Xamarin.Forms.FlexAlignItems)idx; SetColors(AColor, idx); }); JustifyContentCommand.Subscribe(x => { var idx = int.Parse(x); FlexJustify.Value = (Xamarin.Forms.FlexJustify)idx; SetColors(JColor, idx); }); WrapCommand.Subscribe(x => { var idx = int.Parse(x); FlexWrap.Value = (Xamarin.Forms.FlexWrap)idx; SetScrollDirection(); SetColors(WrapColor, idx); }); BoxList = new ObservableCollection <Hoge>(Shuffle()); AddCommand.Subscribe(_ => { BoxList.Add(GetNextItem()); }); DeleteCommand.Subscribe(_ => { BoxList.Remove(BoxList.Last()); }); ReplaceCommand.Subscribe(__ => { BoxList[0] = GetNextItem(); }); ClearCommand.Subscribe(__ => { BoxList.Clear(); }); }
private void InitNextTransform() { _replaced = null; }
public ICommand Replace(int startIndex, int len, string newText) { var command = new ReplaceCommand(this, startIndex, len, newText); command.Do(); return command; }
public void Undo() { _replaced?.Undo(); _replaced = null; }