public void StartMotion(double StartPosition, double FinalDestination, MotionKind motionKind, int numberOfRepetities)
        {
            _StartPosition    = StartPosition;
            _CurrentPosition  = StartPosition;
            _FinalDestination = FinalDestination;
            _NumberRepetities = numberOfRepetities;

            SwitchChannelState(KEITHLEY_2602A_Channels.ChannelA, KEITHLEY_2602A_Channel_Status.Channel_ON);
            SetValueToChannel(8.0, KEITHLEY_2601A_SourceMode.Voltage, KEITHLEY_2602A_Channels.ChannelA);

            switch (motionKind)
            {
            case MotionKind.Single:
            {
                _MotionSingleMeasurementTimer.Start();
            } break;

            case MotionKind.Repetitive:
            {
                _MotionRepetitiveMeasurementTimer.Start();
            } break;

            default:
                break;
            }
        }
예제 #2
0
        public void StartMeasurement(object sender, DoWorkEventArgs e, MotionKind motionKind, int numberRepetities = 1)
        {
            var worker = sender as BackgroundWorker;

            switch (_SourceMode)
            {
            case KEITHLEY_2601A_SourceMode.Voltage:
            {
                _MeasureDevice.SetSourceVoltage(_ValueThroughTheStructure);
            } break;

            case KEITHLEY_2601A_SourceMode.Current:
            {
                _MeasureDevice.SetSourceCurrent(_ValueThroughTheStructure);
            } break;

            default:
                break;
            }

            AllEventsHandler.Instance.OnTimeTraceMeasurementsStateChanged(this, new TimeTraceMeasurementStateChanged_EventArgs(true));

            _MeasureDevice.SwitchON();

            switch (motionKind)
            {
            case MotionKind.Single:
            {
                _Motor.StartMotion(_StartPosition, _Destination, MotionKind.Single);
            } break;

            case MotionKind.Repetitive:
            {
                _Motor.StartMotion(_StartPosition, _Destination, MotionKind.Repetitive, numberRepetities);
            } break;

            default:
                break;
            }

            while (true)
            {
                if (worker.CancellationPending == true)
                {
                    _Motor.StopMotion();
                    e.Cancel = true;
                    break;
                }
                if (_CancelMeasures == true)
                {
                    _Motor.StopMotion();
                    break;
                }
            }

            _MeasureDevice.SwitchOFF();
        }
예제 #3
0
파일: VimUtil.cs 프로젝트: ilustreous/VsVim
 internal static MotionResult CreateMotionResult(
     SnapshotSpan span,
     bool isForward          = true,
     MotionKind motionKind   = null,
     MotionResultFlags flags = MotionResultFlags.None)
 {
     motionKind = motionKind ?? MotionKind.CharacterWiseInclusive;
     return(new MotionResult(span, span, isForward, motionKind, flags));
 }
예제 #4
0
        public void MoveCaretToMotionResult_CaretAfterLastLine()
        {
            Create("dog", "cat", "bear");
            var data = VimUtil.CreateMotionResult(
                _textBuffer.GetLineRange(0).ExtentIncludingLineBreak,
                true,
                MotionKind.NewLineWise(CaretColumn.AfterLastLine));

            _operations.MoveCaretToMotionResult(data);
            Assert.AreEqual(_textBuffer.GetLine(1).Start, _textView.GetCaretPoint());
        }
예제 #5
0
        public void MoveCaretToMotionResult_ReverseLineWiseWithColumn()
        {
            Create(" dog", "cat", "bear");
            var data = VimUtil.CreateMotionResult(
                span: _textView.GetLineRange(0, 1).ExtentIncludingLineBreak,
                isForward: false,
                motionKind: MotionKind.NewLineWise(CaretColumn.NewInLastLine(1)));

            _operations.MoveCaretToMotionResult(data);
            Assert.AreEqual(1, _textView.GetCaretPoint().Position);
        }
예제 #6
0
        public void MoveCaretToMotionResult12()
        {
            Create("dog", "cat", "bear");
            var data = VimUtil.CreateMotionResult(
                _textBuffer.GetLineRange(0, 1).ExtentIncludingLineBreak,
                false,
                MotionKind.NewLineWise(CaretColumn.NewInLastLine(2)));

            _operations.MoveCaretToMotionResult(data);
            Assert.AreEqual(Tuple.Create(0, 2), SnapshotPointUtil.GetLineColumn(_textView.GetCaretPoint()));
        }
예제 #7
0
        public void MoveCaretToMotionResult10()
        {
            Create("foo", "bar", "");
            var data = VimUtil.CreateMotionResult(
                _textBuffer.GetLineRange(0, 1).Extent,
                true,
                MotionKind.NewLineWise(CaretColumn.NewInLastLine(0)));

            _operations.MoveCaretToMotionResult(data);
            Assert.AreEqual(Tuple.Create(1, 0), SnapshotPointUtil.GetLineColumn(_textView.GetCaretPoint()));
        }
예제 #8
0
        public void MoveCaretToMotionResult7()
        {
            Create("foo", "bar", "");
            var data = VimUtil.CreateMotionResult(
                new SnapshotSpan(_textBuffer.CurrentSnapshot, 0, _textBuffer.CurrentSnapshot.Length),
                true,
                MotionKind.NewLineWise(CaretColumn.None));

            _operations.MoveCaretToMotionResult(data);
            Assert.AreEqual(2, _textView.GetCaretPoint().GetContainingLine().LineNumber);
        }
예제 #9
0
        public void MaintainCaretColumn_Down()
        {
            Create("the dog chased the ball", "hello", "the cat climbed the tree");
            var motionResult = VimUtil.CreateMotionResult(
                _textView.GetLineRange(0, 1).ExtentIncludingLineBreak,
                motionKind: MotionKind.NewLineWise(CaretColumn.NewInLastLine(2)),
                flags: MotionResultFlags.MaintainCaretColumn);

            _operations.MoveCaretToMotionResult(motionResult);
            Assert.AreEqual(2, _operationsRaw.MaintainCaretColumn.Value);
        }
예제 #10
0
파일: VimUtil.cs 프로젝트: zhutoulwz/VsVim
 internal static MotionResult CreateMotionResult(
     SnapshotSpan span,
     bool isForward            = true,
     MotionKind motionKind     = null,
     MotionResultFlags flags   = MotionResultFlags.None,
     CaretColumn desiredColumn = null)
 {
     motionKind    = motionKind ?? MotionKind.CharacterWiseInclusive;
     desiredColumn = desiredColumn ?? CaretColumn.None;
     return(new MotionResult(span, span, isForward, motionKind, flags, desiredColumn));
 }
예제 #11
0
 public void AssertData(MotionResult data, SnapshotSpan? span, MotionKind motionKind = null)
 {
     if (span.HasValue)
     {
         Assert.Equal(span.Value, data.Span);
     }
     if (motionKind != null)
     {
         Assert.Equal(motionKind, data.MotionKind);
     }
 }
예제 #12
0
        internal static MotionResult CreateMotionResult(
            SnapshotSpan span,
            bool isForward              = true,
            MotionKind motionKind       = null,
            OperationKind operationKind = null,
            int?column = null)
        {
            motionKind    = motionKind ?? MotionKind.Inclusive;
            operationKind = operationKind ?? OperationKind.CharacterWise;
            var col = column.HasValue ? FSharpOption.Create(CaretColumn.NewInLastLine(column.Value)) : FSharpOption <CaretColumn> .None;

            return(new MotionResult(span, isForward, motionKind, operationKind, col));
        }
예제 #13
0
        public void MaintainCaretColumn_IgnoreIfFlagNotSpecified()
        {
            Create("the dog chased the ball", "hello", "the cat climbed the tree");
            var motionResult = VimUtil.CreateMotionResult(
                _textView.GetLineRange(0, 1).ExtentIncludingLineBreak,
                motionKind: MotionKind.NewLineWise(CaretColumn.NewInLastLine(2)),
                flags: MotionResultFlags.None);
            var data = VimUtil.CreateMotionResult(
                new SnapshotSpan(_textBuffer.CurrentSnapshot, 1, 2),
                true,
                MotionKind.CharacterWiseInclusive);

            _operations.MoveCaretToMotionResult(data);
            Assert.AreEqual(2, _textView.GetCaretPoint().Position);
        }
예제 #14
0
 public void AssertData(MotionResult data, SnapshotSpan? span, MotionKind motionKind = null, CaretColumn desiredColumn = null)
 {
     if (span.HasValue)
     {
         Assert.Equal(span.Value, data.Span);
     }
     if (motionKind != null)
     {
         Assert.Equal(motionKind, data.MotionKind);
     }
     if (desiredColumn != null)
     {
         Assert.Equal(desiredColumn, data.DesiredColumn);
     }
 }
예제 #15
0
 public void AssertData(
     MotionData data,
     SnapshotSpan? span,
     MotionKind motionKind = null,
     OperationKind operationKind = null)
 {
     if (span.HasValue)
     {
         Assert.AreEqual(span.Value, data.Span);
     }
     if (motionKind != null)
     {
         Assert.AreEqual(motionKind, data.MotionKind);
     }
     if (operationKind != null)
     {
         Assert.AreEqual(operationKind, data.OperationKind);
     }
 }
        public void StartMotion(double StartPosition, double FinalDestination, MotionKind motionKind, int numberOfRepetities = 1)
        {
            _StartPosition    = StartPosition;
            _CurrentPosition  = StartPosition;
            _FinalDestination = FinalDestination;
            _NumberRepetities = numberOfRepetities;

            switch (motionKind)
            {
            case MotionKind.Single:
            {
                _MotionSingleMeasurementTimer.Start();
            } break;

            case MotionKind.Repetitive:
            {
                _MotionRepetitiveMeasurementTimer.Start();
            } break;

            default:
                break;
            }
        }
예제 #17
0
파일: VimUtil.cs 프로젝트: rride/VsVim
 internal static MotionData CreateMotionData(
     SnapshotSpan span,
     bool isForward = true,
     bool isAnyWord = false,
     MotionKind motionKind = null,
     OperationKind operationKind = null,
     int? column = null)
 {
     motionKind = motionKind ?? MotionKind.Inclusive;
     operationKind = operationKind ?? OperationKind.CharacterWise;
     var col = column.HasValue ? FSharpOption.Create(column.Value) : FSharpOption<int>.None;
     return new MotionData(span, isForward, isAnyWord, motionKind, operationKind, col);
 }
        public void StartMeasurement(object sender, DoWorkEventArgs e, MotionKind motionKind, int numberRepetities = 1)
        {
            var worker = sender as BackgroundWorker;

            switch (_SourceMode)
            {
                case KEITHLEY_2601A_SourceMode.Voltage:
                    {
                        _MeasureDevice.SetSourceVoltage(_ValueThroughTheStructure);
                    } break;
                case KEITHLEY_2601A_SourceMode.Current:
                    {
                        _MeasureDevice.SetSourceCurrent(_ValueThroughTheStructure);
                    } break;
                default:
                    break;
            }

            AllEventsHandler.Instance.OnTimeTraceMeasurementsStateChanged(this, new TimeTraceMeasurementStateChanged_EventArgs(true));

            _MeasureDevice.SwitchON();

            switch (motionKind)
            {
                case MotionKind.Single:
                    {
                        _Motor.StartMotion(_StartPosition, _Destination, MotionKind.Single);
                    } break;
                case MotionKind.Repetitive:
                    {
                        _Motor.StartMotion(_StartPosition, _Destination, MotionKind.Repetitive, numberRepetities);
                    } break;
                default:
                    break;
            }

            while (true)
            {
                if (worker.CancellationPending == true)
                {
                    _Motor.StopMotion();
                    e.Cancel = true;
                    break;
                }
                if (_CancelMeasures == true)
                {
                    _Motor.StopMotion();
                    break;
                }
            }

            _MeasureDevice.SwitchOFF();
        }
예제 #19
0
파일: VimUtil.cs 프로젝트: rride/VsVim
 internal static MotionData CreateMotionData(
     SnapshotSpan span,
     bool isForward,
     MotionKind motionKind,
     OperationKind operationKind,
     int? column = null)
 {
     return CreateMotionData(
         span: span,
         isForward: isForward,
         isAnyWord: false,
         motionKind: motionKind,
         operationKind: operationKind,
         column: column);
 }
예제 #20
0
 internal void ProcessComplete(int startPosition, int count, string input, string match, MotionKind motionKind, OperationKind opKind)
 {
     var res = Process(startPosition, count, input);
     var tuple = res.AsComplete().Item;
     Assert.IsTrue(res.IsComplete);
     Assert.AreEqual(match, tuple.Span.GetText());
     Assert.AreEqual(motionKind, tuple.MotionKind);
     Assert.AreEqual(opKind, tuple.OperationKind);
 }
        public void StartMotion(double StartPosition, double FinalDestination, MotionKind motionKind, int numberOfRepetities)
        {
            _StartPosition = StartPosition;
            _CurrentPosition = StartPosition;
            _FinalDestination = FinalDestination;
            _NumberRepetities = numberOfRepetities;

            SwitchChannelState(KEITHLEY_2602A_Channels.ChannelA, KEITHLEY_2602A_Channel_Status.Channel_ON);
            SetValueToChannel(8.0, KEITHLEY_2601A_SourceMode.Voltage, KEITHLEY_2602A_Channels.ChannelA);

            switch (motionKind)
            {
                case MotionKind.Single:
                    {
                        _MotionSingleMeasurementTimer.Start();
                    } break;
                case MotionKind.Repetitive:
                    {
                        _MotionRepetitiveMeasurementTimer.Start();
                    } break;
                default:
                    break;
            }
        }
        public void StartMotion(double StartPosition, double FinalDestination, MotionKind motionKind, int numberOfRepetities = 1)
        {
            _StartPosition = StartPosition;
            _CurrentPosition = StartPosition;
            _FinalDestination = FinalDestination;
            _NumberRepetities = numberOfRepetities;

            switch (motionKind)
            {
                case MotionKind.Single:
                    {
                        _MotionSingleMeasurementTimer.Start();
                    } break;
                case MotionKind.Repetitive:
                    {
                        _MotionRepetitiveMeasurementTimer.Start();
                    } break;
                default:
                    break;
            }
        }