Exemple #1
0
        protected void Unnamed2_Click(object sender, EventArgs e)
        {
            PolyLine1.Points[1] = new Point(PolyLine1.Points[1].X, new Unit(PolyLine1.Points[1].Y.Value + 5));
            // house.Description += "Maziar";
            Path2.LastCommand.QuadricCurveTo(100, 10, 10, 10, true);

            var currentTranslate = Path2.Transform == null ? null : Path2.Transform.AsEnumerable().First(n => n.Type == TransformCommandType.Translate);

            if (currentTranslate == null)
            {
                currentTranslate = new TransformCommand(TransformCommandType.Translate, 0, 0);
                if (Path2.Transform == null)
                {
                    Path2.Transform = currentTranslate;
                }
                else
                {
                    Path2.Transform.Append(currentTranslate);
                }
            }
            currentTranslate.Parameters[0] = currentTranslate.Parameters[0] + 10;
            var command = MyPath.LastCommand;

            command.HorizontalLineTo(10);
            Use1.ZIndex++;
        }
Exemple #2
0
        private static string RunTransformationCore(string logFileContents, SarifVersion targetVersion)
        {
            string logFilePath         = @"c:\logs\mylog.sarif";
            string transformedContents = null;

            var mockFileSystem = new Mock <IFileSystem>();

            mockFileSystem.Setup(x => x.ReadAllText(logFilePath)).Returns(logFileContents);
            mockFileSystem.Setup(x => x.WriteAllText(logFilePath, It.IsAny <string>())).Callback <string, string>((path, contents) => { transformedContents = contents; });

            var transformCommand = new TransformCommand(mockFileSystem.Object, testing: true);

            var options = new TransformOptions
            {
                Inline        = true,
                TargetVersion = targetVersion,
                InputFilePath = logFilePath
            };

            int returnCode = transformCommand.Run(options);

            returnCode.Should().Be(0);

            return(transformedContents);
        }
 public void LoadData(string TransformCommandData)
 {
     transformCommand = JsonUtility.FromJson <TransformCommand>(TransformCommandData);
     this.position    = transformCommand.position;
     this.eulerAngles = transformCommand.eulerAngles;
     this.localScale  = transformCommand.localScale;
 }
        private static string RunTransformationCore(string logFileContents, SarifVersion targetVersion)
        {
            string        logFilePath         = @"c:\logs\mylog.sarif";
            StringBuilder transformedContents = new StringBuilder();

            // Complex: TransformCommand has codepaths that use Create and OpenRead, but also ReadAllText and WriteAllText
            var mockFileSystem = new Mock <IFileSystem>();

            mockFileSystem.Setup(x => x.ReadAllText(logFilePath)).Returns(logFileContents);
            mockFileSystem.Setup(x => x.OpenRead(logFilePath)).Returns(() => new MemoryStream(Encoding.UTF8.GetBytes(logFileContents)));
            mockFileSystem.Setup(x => x.Create(logFilePath)).Returns(() => new MemoryStreamToStringBuilder(transformedContents));
            mockFileSystem.Setup(x => x.WriteAllText(logFilePath, It.IsAny <string>())).Callback <string, string>((path, contents) => { transformedContents.Append(contents); });

            var transformCommand = new TransformCommand(mockFileSystem.Object);

            var options = new TransformOptions
            {
                Inline             = true,
                SarifOutputVersion = targetVersion,
                InputFilePath      = logFilePath
            };

            int returnCode = transformCommand.Run(options);

            returnCode.Should().Be(0);

            return(transformedContents.ToString());
        }
Exemple #5
0
 public void LoadTransformData()
 {
     commandHistory.Clear();
     string[] Lines = System.IO.File.ReadAllLines(ReplaySystem.RecordDataPath + $"/{name}.json");
     foreach (string str in Lines)
     {
         TransformCommand c = new TransformCommand(transform);
         c.LoadData(str);
         commandHistory.Add(c);
     }
 }
Exemple #6
0
        public static TModel TransformBase <TKey, TModel>(
            this BaseEntity <TKey> entity,
            TModel model,
            TransformCommand command,
            ModelTransformationContext context,
            IServiceResolver resolver)
            where TModel : IBaseModel <TKey>
        {
            model.Id         = entity.Id;
            model.CreatedBy  = entity.CreatedBy;
            model.CreatedOn  = entity.CreatedOn;
            model.ModifiedBy = entity.ModifiedBy;
            model.ModifiedOn = entity.ModifiedOn;

            return(model);
        }
Exemple #7
0
        public ImportedVm()
        {
            Timekeeping         = new Timekeeping();
            ShiftExtra          = new ShiftExtra();
            Transform           = new Transform();
            TimeList            = new ObservableCollection <Timekeeping>();
            ShiftExtraList      = new ObservableCollection <ShiftExtra>();
            AbsencesList        = new ObservableCollection <Absences>();
            CostCodesList       = new ObservableCollection <CostCodes>();
            ProjectsList        = new ObservableCollection <Project>();
            EmployeesList       = new ObservableCollection <Employee>();
            TimeHistoryList     = new ObservableCollection <TimekeepingHistory>();
            ShiftHistoryList    = new ObservableCollection <ShiftExtraHistory>();
            AbsencesHistoryList = new ObservableCollection <AbsencesHistory>();
            TransformedList     = new ObservableCollection <Transform>();

            TransformedViewSource        = new CollectionViewSource();
            TransformedViewSource.Source = TransformedList;
            AbsencesViewSource           = new CollectionViewSource();
            AbsencesViewSource.Source    = AbsencesList;
            CostCodesViewSource          = new CollectionViewSource();
            CostCodesViewSource.Source   = CostCodesList;
            ProjectsViewSource           = new CollectionViewSource();
            ProjectsViewSource.Source    = ProjectsList;
            ShiftExtraViewSource         = new CollectionViewSource();
            ShiftExtraViewSource.Source  = ShiftExtraList;
            TimekeepingViewSource        = new CollectionViewSource();
            TimekeepingViewSource.Source = TimeList;

            TransformCommand   = new TransformCommand(this);
            ExportCsvCommand   = new ExportCsvCommand(this);
            RefreshDataCommand = new RefreshDataCommand(this);

            GetTimeKeepingList();
            GetShiftExtraList();
            GetAbsencesList();
            GetCostCodesList();
            GetProjectsList();
            GetEmployeesList();
            GetTimeHistoryList();
            GetShiftHistoryList();
            GetAbsencesHistoryList();
            GetTransformedList();
        }
Exemple #8
0
        public static TEntity TransformBase <TKey, TEntity>(
            this IBaseModel <TKey> model,
            TEntity entity,
            TransformCommand command,
            ModelTransformationContext context,
            IServiceResolver resolver)
            where TEntity : BaseEntity <TKey>
        {
            var userContext   = resolver.Resolve <IUserContext>();
            var currentUserId = userContext
                                .CurrentUserId()
                                .Catch(ex => Guid.Empty)
                                .Resolve(); //should return null instead of throwing exceptions for missing UserContexts

            entity.Id = model.Id;

            entity.CreatedBy =
                command == TransformCommand.Add
                ? currentUserId.ThrowIf(default(Guid), new GaiaException(ErrorCodes.DomainLogicError))
                : model.CreatedBy;
            entity.CreatedOn =
                command == TransformCommand.Add
                ? DateTimeOffset.Now
                : model.CreatedOn;

            entity.ModifiedBy =
                command == TransformCommand.Update
                ? currentUserId.ThrowIf(default(Guid), new GaiaException(ErrorCodes.DomainLogicError))
                : model.CreatedBy;
            entity.ModifiedOn =
                command == TransformCommand.Update
                ? DateTimeOffset.Now
                : model.ModifiedOn;

            return(entity);
        }
 public MenuStripView(FileCommand fileCommand, EditCommand editCommand, FunctionsCommand functionsCommand, ConstantsCommand constantsCommand, ChartCommand chartCommand, TransformCommand transformCommand, ToolsCommand toolsCommand, HelpCommand helpCommand) : this()
 {
     SetCommands(fileCommand, editCommand, functionsCommand, constantsCommand, chartCommand, transformCommand,
                 toolsCommand, helpCommand);
 }
Exemple #10
0
 internal void RotateSelectedItems(double angle, Point center)
 {
     TransformCommand.Execute(new RotateTransform(angle, center.X, center.Y));
     RefreshResizeAdorner();
 }
Exemple #11
0
 internal void TransformSelectedItems(TransformGroup t)
 {
     TransformCommand.Execute(t);
     RefreshResizeAdorner();
 }
Exemple #12
0
 internal void ScaleSelectedItems(double xDelta, double yDelta, Point center)
 {
     TransformCommand.Execute(new ScaleTransform(xDelta, yDelta, center.X, center.Y));
     RefreshResizeAdorner();
 }
Exemple #13
0
 internal void MoveSelectedItems(Transform transform)
 {
     TransformCommand.Execute(transform);
     RefreshResizeAdorner();
 }
Exemple #14
0
 internal void MoveSelectedItems(double xDelta, double yDelta)
 {
     TransformCommand.Execute(new TranslateTransform(xDelta, yDelta));
 }