Example #1
0
        private static void ConfigurePointsSelector(TextBox textBox, Button button, BindingSource bindingSource)
        {
            textBox.Enter += (s, e) => Acad.SelectObjectIds(bindingSource.GetSource <MeasurementTechOperation>().PointObjectIds);

            button.Click += (s, e) =>
            {
                var operation = bindingSource.GetSource <MeasurementTechOperation>();
                operation.Clear();
                Interaction.SetActiveDocFocus();
                Point3d point;
                while (!(point = Interaction.GetPoint("\nВыберите точку измерения")).IsNull())
                {
                    operation.CreatePoint(point);
                    textBox.Text = operation.PointsX.Count.ToString();
                }
            };

            bindingSource.DataSourceChanged += (s, e) => textBox.Text = bindingSource.GetSource <MeasurementTechOperation>().PointsX.Count.ToString();
        }
Example #2
0
        public void SourceShouldThrowExceptionWhenReturnSourceIfObserverHasException()
        {
            var mock = new ObserverMock
            {
                GetActualSource = b => { throw new TestException(); }
            };
            BindingSource target = CreateBindingSource(mock);

            ShouldThrow <TestException>(() => target.GetSource(true));
        }
Example #3
0
        public void SourceShouldReturnSourceFromObserver()
        {
            var src  = new object();
            var mock = new ObserverMock
            {
                GetActualSource = b => src
            };
            BindingSource target = CreateBindingSource(mock);

            target.GetSource(true).ShouldEqual(src);
        }
Example #4
0
 public T GetParams <T>() => BindingSource.GetSource <T>();