Пример #1
0
        private void OnGameLoopStarting(ICanvasAnimatedControl sender, object args)
        {
            _gestureRecognizer = new GestureRecognizer();
            _gestureRecognizer.GestureSettings = GestureSettings.ManipulationTranslateX |
                                                 GestureSettings.ManipulationTranslateY |
                                                 GestureSettings.ManipulationScale;

            _gestureRecognizer.ManipulationStarted   += gestureRecognizer_ManipulationStarted;
            _gestureRecognizer.ManipulationUpdated   += gestureRecognizer_ManipulationUpdated;
            _gestureRecognizer.ManipulationCompleted += gestureRecognizer_ManipulationCompleted;

            //
            // When the GestureRecognizer goes into intertia mode (ie after the pointer is released)
            // we want it to generate ManipulationUpdated events in sync with the game loop's Update.
            // We do this by disabling AutoProcessIntertia and explicitly calling ProcessInertia()
            // from the Update.
            //
            _gestureRecognizer.InertiaTranslationDeceleration = -5.0f;
            _gestureRecognizer.AutoProcessInertia             = false;

            _inputDevice = Cvs.CreateCoreIndependentInputSource(
                CoreInputDeviceTypes.Mouse
                | CoreInputDeviceTypes.Touch
                | CoreInputDeviceTypes.Pen);

            _inputDevice.PointerPressed      += OnPointerPressed;
            _inputDevice.PointerReleased     += OnPointerReleased;
            _inputDevice.PointerWheelChanged += OnPointerWheelChanged;
            _inputDevice.PointerMoved        += OnPointerMoved;
        }
Пример #2
0
        private void KeyDown_UIThread(CoreWindow sender, KeyEventArgs args)
        {
            var key = args.VirtualKey;

            args.Handled = true;

            // Schedule to run on game loop
            var action = Cvs.RunOnGameLoopThreadAsync(() => _screenManager.KeyPress(new KeyPressEventArgs(key)));
        }
Пример #3
0
 protected void CreateCvs()
 {
     mockHistoryParser = new Mock <IHistoryParser>();
     mockFileSystem    = new Mock <IFileSystem>();
     executionEnv      = new ExecutionEnvironment();
     CreateProcessExecutorMock(Cvs.DefaultCvsExecutable);
     cvs  = new Cvs((IHistoryParser)mockHistoryParser.Object, (ProcessExecutor)mockProcessExecutor.Object, (IFileSystem)mockFileSystem.Object, executionEnv);
     from = new DateTime(2001, 1, 21, 20, 0, 0);
     to   = from.AddDays(1);
 }
Пример #4
0
 protected void CreateCvs()
 {
     mockHistoryParser = new DynamicMock(typeof(IHistoryParser));
     mockFileSystem    = new DynamicMock(typeof(IFileSystem));
     executionEnv      = new ExecutionEnvironment();
     CreateProcessExecutorMock(Cvs.DefaultCvsExecutable);
     cvs  = new Cvs((IHistoryParser)mockHistoryParser.MockInstance, (ProcessExecutor)mockProcessExecutor.MockInstance, (IFileSystem)mockFileSystem.MockInstance, executionEnv);
     from = new DateTime(2001, 1, 21, 20, 0, 0);
     to   = from.AddDays(1);
 }
Пример #5
0
        public void GetCommit_DeadFile()
        {
            var f1     = new FileInfo("file1.txt");
            var commit = new Commit("c1").WithRevision(f1, "1.1", isDead: true);

            var repo = MockRepository.GenerateStub <ICvsRepository>();
            var cvs  = new Cvs(repo, 1);

            var revisions = cvs.GetCommit(commit);

            Assert.IsTrue(revisions.Single().IsDead);
        }
Пример #6
0
        public void GetCommit_SingleFile()
        {
            var f1     = new FileInfo("file1.txt");
            var commit = new Commit("c1").WithRevision(f1, "1.1");

            var repo = MockRepository.GenerateStub <ICvsRepository>();

            repo.Stub(r => r.GetCvsRevision(null)).IgnoreArguments().Do((FileRevision f) => CreateMockContent(f));
            var cvs = new Cvs(repo, 1);

            var revisions = cvs.GetCommit(commit);

            Assert.IsTrue(Encoding.UTF8.GetString(revisions.Single().Data.Data) == "file1.txt r1.1");
        }
Пример #7
0
        public void GetCommit_MultipleFiles()
        {
            var files  = new FileInfo[6];
            var commit = new Commit("c1");

            for (int i = 0; i < files.Length; i++)
            {
                files[i] = new FileInfo(String.Format("file{0}.txt", i));
                commit.WithRevision(files[i], "1.1");
            }

            var repo = MockRepository.GenerateStub <ICvsRepository>();

            repo.Stub(r => r.GetCvsRevision(null)).IgnoreArguments().Do((FileRevision f) => CreateMockContent(f));
            var cvs = new Cvs(repo, (uint)(files.Length - 1));

            var revisions = cvs.GetCommit(commit).ToList();

            Assert.AreEqual(revisions.Count, files.Length);
            Assert.IsTrue(revisions.Select(r => r.Name).OrderBy(i => i).SequenceEqual(files.Select(f => f.Name)));
        }