public void CommandChangeLocationTest() { Vertex[] vertices = new Vertex[Configuration.POINTS_AMOUNT]; for (int i = 0; i < vertices.Length; ++i) { vertices[i] = new Vertex(); } vertices[0].Location = new System.Windows.Point(1, 1); vertices[1].Location = new System.Windows.Point(3, 1); vertices[2].Location = new System.Windows.Point(4, 2); vertices[3].Location = new System.Windows.Point(2, 2); vertices[4].Location = new System.Windows.Point(1, 2); Pentagon pentagon = new Pentagon(vertices); System.Windows.Point[] points = new System.Windows.Point[Configuration.POINTS_AMOUNT]; points[0] = new System.Windows.Point(1, 1); points[1] = new System.Windows.Point(3, 1); points[2] = new System.Windows.Point(4, 2); points[3] = new System.Windows.Point(2, 2); points[4] = new System.Windows.Point(1, 2); System.Windows.Point[] expectedLocation = new System.Windows.Point[Configuration.POINTS_AMOUNT]; System.Array.Copy(pentagon.Points, expectedLocation, Configuration.POINTS_AMOUNT); UndoRedoManager undoRedoManager = new UndoRedoManager(); ChangeLocation changeLocation = new ChangeLocation(pentagon, points); undoRedoManager.Execute(changeLocation); CollectionAssert.AreEqual(pentagon.Points, points); undoRedoManager.Undo(); CollectionAssert.AreEqual(pentagon.Points, expectedLocation); }
void ReleaseDesignerOutlets() { if (BranchNameLabel != null) { BranchNameLabel.Dispose(); BranchNameLabel = null; } if (BranchNumberLabel != null) { BranchNumberLabel.Dispose(); BranchNumberLabel = null; } if (ChangeLocation != null) { ChangeLocation.Dispose(); ChangeLocation = null; } if (CityLabel != null) { CityLabel.Dispose(); CityLabel = null; } if (FaxLabel != null) { FaxLabel.Dispose(); FaxLabel = null; } if (Map != null) { Map.Dispose(); Map = null; } if (MapView != null) { MapView.Dispose(); MapView = null; } if (PhoneLabel != null) { PhoneLabel.Dispose(); PhoneLabel = null; } if (StreetLabel != null) { StreetLabel.Dispose(); StreetLabel = null; } }
public Task Handle(object command) { return(command switch { Create cmd => HandleCreate(cmd), UpdateStore cmd => HandleUpdateAsync(cmd.Id, async c => await UpdateStore(cmd.LocationId, c), c => c.UpdateStoreName(cmd.Name)), ChangeLocation cmd => HandleUpdateAsync(cmd.Id, async c => await ChangeLocationAsync(c, cmd.Location.Id)), DeleteStore cmd => HandleUpdateAsync(cmd.Id, _ => this._repository.RemoveAsync(cmd.Id)), _ => Task.CompletedTask });
public TriggerTests() { ClearTabels(); Mary = new People(1, "mary"); John = new People(2, "john"); Jane = new People(3, "Jane"); MaryChangeLocation = new ChangeLocation(1, 1, 55.792891m, 49.116969m, DateTime.Now); JohnChangeLocation = new ChangeLocation(2, 2, 55.792000m, 49.116969m, DateTime.Now); JaneChangeLocation = new ChangeLocation(3, 3, 55.792000m, 49.116969m, DateTime.Now); }
protected virtual ChangeLocation GetChangesLocationImpl(Document oldDocument, SyntaxNode newRoot, Document newDocument, IEnumerable <TextChange> textChanges, CancellationToken cancellationToken = default) { ChangeLocation accumulatedChangeLocation = ChangeLocation.None; foreach (TextChange change in textChanges) { ChangeLocation changeLocation = GetTextChangeLocation(change, newRoot); accumulatedChangeLocation = accumulatedChangeLocation | changeLocation; cancellationToken.ThrowIfCancellationRequested(); } return(accumulatedChangeLocation); }
public async Task <CodeMapRefreshMode> ShouldRefreshCodeMapAsync(Document oldDocument, SyntaxNode newRoot, Document newDocument, CancellationToken cancellationToken = default) { ChangeLocation changeLocation = await GetChangesLocationAsync(oldDocument, newRoot, newDocument, cancellationToken); if (changeLocation.ContainsLocation(ChangeLocation.Namespace)) { return(newRoot.ContainsDiagnostics ? CodeMapRefreshMode.Clear : CodeMapRefreshMode.Recalculate); } else if (changeLocation.ContainsLocation(ChangeLocation.Class)) { return(CodeMapRefreshMode.Recalculate); } return(CodeMapRefreshMode.NoRefresh); }
public PathChange( Configuration configuration, ChangeMode mode, ChangeLocation location, string relativePath, IReadFileSystem readFileSystem, IWriteFileSystem writeFileSystem) { Configuration = configuration; Mode = mode; Location = location; RelativePath = relativePath; ReadFileSystem = readFileSystem; WriteFileSystem = writeFileSystem; Source = Path.Combine(Configuration.SourcePath, RelativePath); Target = Path.Combine(Configuration.TargetPath, RelativePath); }
protected override ChangeLocation GetChangesLocationImpl(Document oldDocument, SyntaxNode newRoot, Document newDocument, IEnumerable <TextChange> textChanges, CancellationToken cancellationToken = default) { ChangeLocation accumulatedChangeLocation = ChangeLocation.None; foreach (TextChange change in textChanges) { ChangeLocation changeLocation = GetTextChangeLocation(change, newRoot); //Early exit if we found a change which require the refresh of code map if (changeLocation.ContainsLocation(ChangeLocation.Class) || changeLocation.ContainsLocation(ChangeLocation.Namespace)) { return(changeLocation); } accumulatedChangeLocation = accumulatedChangeLocation | changeLocation; cancellationToken.ThrowIfCancellationRequested(); } return(accumulatedChangeLocation); }
public void Handle(ChangeLocation command) { var root = _repository.Get(command.DataCollectorId.Value); root.ChangeLocation(command.Location); }
public void SetNewLocation(Vector3 pos, Quaternion dir) { _position = pos; _direction = dir; ChangeLocation?.Invoke(pos, dir); }
protected internal PathChange createSimplePathChange(ChangeLocation location = ChangeLocation.Unknown) { var config = createSimpleConfiguration(); return new PathChange(config, ChangeMode.Shallow, location, "fileordir", _readFileSystem.Object, _writeFileSystem.Object); }
private void ClearTabels() { Do(LocationIntersection.ClearAll()); Do(ChangeLocation.ClearAll()); Do(People.ClearAll()); }
public static bool ContainsLocation(this ChangeLocation location, ChangeLocation locationToCheck) => (location & locationToCheck) == locationToCheck;