public void ToStringTest()
        {
            var testCheckableItemViewModel    = new CheckableItemViewModel("Name");
            var testCheckableItemViewModelOfT = new CheckableItemViewModel <string>("Name", "Value");

            Assert.AreEqual(testCheckableItemViewModel.ToString(), "Name");
            Assert.AreEqual(testCheckableItemViewModelOfT.ToString(), "Name: Value");
        }
Ejemplo n.º 2
0
        private static Collection <CheckableItemViewModel <SpatialQueryMode> > InitSpatialQueryModeEntities()
        {
            Collection <CheckableItemViewModel <SpatialQueryMode> > spatialQueryModeEntities = new Collection <CheckableItemViewModel <SpatialQueryMode> >();

            foreach (SpatialQueryMode spatialQueryMode in Enum.GetValues(typeof(SpatialQueryMode)))
            {
                CheckableItemViewModel <SpatialQueryMode> spatialQueryModeEntity = new CheckableItemViewModel <SpatialQueryMode>(spatialQueryMode, false, (mode) => Regex.Replace(mode.ToString(), reg, "$1 $2"));
                spatialQueryModeEntities.Add(spatialQueryModeEntity);
            }
            spatialQueryModeEntities.FirstOrDefault(tmpMode => tmpMode.Value == SpatialQueryMode.Touching).IsChecked = true;
            return(spatialQueryModeEntities);
        }
Ejemplo n.º 3
0
        protected override void EnterCore(DissolveWizardShareObject parameter)
        {
            base.EnterCore(parameter);
            if (Parent.MoveDirection == MoveDirection.Next)
            {
                dataContext         = new ChooseDataViewModel(parameter.SelectedFeatureLayer, parameter.DissolveSelectedFeaturesOnly);
                content             = new ChooseDataUserControl();
                content.DataContext = dataContext;
                Content             = content;

                dataContext.ExtraColumns.Clear();

                if (parameter.ExtraColumns.Count == 0)
                {
                    if (Parent.MoveDirection == MoveDirection.Next)
                    {
                        Parent.MoveNext();
                    }
                    else
                    {
                        Parent.MoveBack();
                    }
                }
                else
                {
                    FeatureSourceColumn addAllStringColumn = new FeatureSourceColumn(ChooseDataViewModel.AddAllString);
                    dataContext.ExtraColumns.Add(new CheckableItemViewModel <FeatureSourceColumn>(addAllStringColumn));

                    Collection <FeatureSourceColumn> featureSourceColumns = new Collection <FeatureSourceColumn>();
                    lock (parameter.SelectedFeatureLayer)
                    {
                        if (!parameter.SelectedFeatureLayer.IsOpen)
                        {
                            parameter.SelectedFeatureLayer.Open();
                        }
                        featureSourceColumns = parameter.SelectedFeatureLayer.QueryTools.GetColumns();
                    }

                    foreach (var extraColumn in parameter.ExtraColumns)
                    {
                        FeatureSourceColumn extraFeatureSourceColumn = featureSourceColumns.FirstOrDefault(tmpColumn => tmpColumn.ColumnName.Equals(extraColumn, StringComparison.Ordinal));
                        var column = new CheckableItemViewModel <FeatureSourceColumn>(extraFeatureSourceColumn);
                        column.AliasName = parameter.SelectedFeatureLayer.FeatureSource.GetColumnAlias(extraFeatureSourceColumn.ColumnName);
                        dataContext.ExtraColumns.Add(column);
                    }

                    dataContext.SelectedColumn   = dataContext.ExtraColumns[0];
                    dataContext.SelectedOperator = DissolveOperatorMode.First;
                }
            }
        }
Ejemplo n.º 4
0
        private void SnappingDistanceUnitChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            if (e.NewValue != null && e.NewValue is CheckableItemViewModel <SnappingDistanceUnit> )
            {
                CheckableItemViewModel <SnappingDistanceUnit> model = (CheckableItemViewModel <SnappingDistanceUnit>)e.NewValue;
                viewModel.SnappingDistanceUnit = model.Value;

                var gisEditorTrackOverlay = GisEditor.ActiveMap.TrackOverlay as GisEditorTrackInteractiveOverlay;
                if (gisEditorTrackOverlay != null)
                {
                    gisEditorTrackOverlay.SnappingDistanceUnit = model.Value;
                }
            }
        }
        public void CheckableItemViewModelTest()
        {
            var testCheckableItemViewModel = new CheckableItemViewModel <string>("Name", "Value");

            Assert.AreEqual(testCheckableItemViewModel.Name, "Name");
            testCheckableItemViewModel.Name = "NewName";
            Assert.AreNotEqual(testCheckableItemViewModel.Name, "Name");

            Assert.AreEqual(testCheckableItemViewModel.Value, "Value");
            testCheckableItemViewModel.Value = "NewValue";
            Assert.AreNotEqual(testCheckableItemViewModel.Value, "Value");

            Assert.IsTrue(testCheckableItemViewModel.IsChecked.HasValue);
            Assert.IsFalse(testCheckableItemViewModel.IsChecked.Value);
            testCheckableItemViewModel.IsChecked         = true;
            testCheckableItemViewModel.IsCheckedChanged += (_, e) => Assert.AreEqual(e.Value, testCheckableItemViewModel.IsChecked);
            testCheckableItemViewModel.IsChecked         = false;
            testCheckableItemViewModel.IsChecked         = true;
            testCheckableItemViewModel.IsChecked         = true; // for code coverage
            Assert.IsTrue(testCheckableItemViewModel.IsChecked.Value);
        }