Пример #1
0
        public CityListViewModel(IStore store) : base(store)
        {
            Cities = new SmartCollection <City>();

            ConnectToStore(state => state.Cities, cities =>
            {
                Cities.Reset(cities);
            });
        }
        public UserListViewModel(IStore store) : base(store)
        {
            Users = new SmartCollection <User>();

            ConnectToStore(state => state.Users, users =>
            {
                Users.Reset(users);
            });
        }
Пример #3
0
        public void ResetReplacesContent()
        {
            // Arrange
            var collection = new SmartCollection <int>
            {
                1, 2, 3
            };

            // Act
            collection.Reset(new[] { 4, 5, 6 });

            // Assert
            CollectionAssert.AreEqual(new[] { 4, 5, 6 }, collection.ToArray());
        }
Пример #4
0
        public contractwindow()
        {
            InitializeComponent();

            ck63         = new List <coordsformat>();
            ck63Entities = new SmartCollection <coordsformat>();
            ck63Entities.Reset(ck63);
            ck63View = (ListCollectionView)CollectionViewSource.GetDefaultView(ck63Entities);
            ck63listView.ItemsSource = ck63View;

            wgs84         = new List <coordsformat>();
            wgs84Entities = new SmartCollection <coordsformat>();
            wgs84Entities.Reset(wgs84);
            wgs84View = (ListCollectionView)CollectionViewSource.GetDefaultView(wgs84Entities);
            wgs84listView.ItemsSource = wgs84View;

            typecontrcomboBox.ItemsSource   = cccombo.typecomboBoxitems;
            typecontrcomboBox.SelectedIndex = 0;
            statuscomboBox.ItemsSource      = cccombo.statuscomboBoxitems;
            formownercomboBox.ItemsSource   = cccombo.formownercomboBoxitems;
            formunitcomboBox.ItemsSource    = cccombo.formunitcomboBoxitems;
            formusecomboBox.ItemsSource     = cccombo.formusecomboBoxitems;
        }
Пример #5
0
        private void UpdateGrid()
        {
            if (PivotGrid == null)
            {
                return;
            }
            char[] chars = new char[9];
            int    pX    = PivotIndex % 3;
            int    pY    = PivotIndex / 3;

            for (int x = 0; x < 3; x++)
            {
                for (int y = 0; y < 3; y++)
                {
                    int currentIndex = y * 3 + x;
                    if (currentIndex == PivotIndex)
                    {
                        chars[currentIndex] = PIVOT;
                        continue;
                    }

                    //Top Middle
                    if (x == pX && y == pY - 1)
                    {
                        if (GridHeight >= CurrentHeight)
                        {
                            chars[currentIndex] = TOP;
                        }
                        else
                        {
                            chars[currentIndex] = BOTTOM;
                        }
                        continue;
                    }

                    //Bottom Middle
                    if (x == pX && y == pY + 1)
                    {
                        if (GridHeight >= CurrentHeight)
                        {
                            chars[currentIndex] = BOTTOM;
                        }
                        else
                        {
                            chars[currentIndex] = TOP;
                        }
                        continue;
                    }

                    //Middle Left
                    if (x == pX - 1 && y == pY)
                    {
                        if (GridWidth >= CurrentWidth)
                        {
                            chars[currentIndex] = LEFT;
                        }
                        else
                        {
                            chars[currentIndex] = RIGHT;
                        }
                        continue;
                    }

                    //Middle Right
                    if (x == pX + 1 && y == pY)
                    {
                        if (GridWidth >= CurrentWidth)
                        {
                            chars[currentIndex] = RIGHT;
                        }
                        else
                        {
                            chars[currentIndex] = LEFT;
                        }
                        continue;
                    }

                    //Top Left
                    if (x == pX - 1 && y == pY - 1)
                    {
                        if (GridWidth >= CurrentWidth)
                        {
                            if (GridHeight >= CurrentHeight)
                            {
                                chars[currentIndex] = TOP_LEFT;
                            }
                            else
                            {
                                chars[currentIndex] = BOTTOM_LEFT;
                            }
                        }
                        else
                        {
                            if (GridHeight >= CurrentHeight)
                            {
                                chars[currentIndex] = TOP_RIGHT;
                            }
                            else
                            {
                                chars[currentIndex] = BOTTOM_RIGHT;
                            }
                        }
                        continue;
                    }

                    //Top Right
                    if (x == pX + 1 && y == pY - 1)
                    {
                        if (GridWidth >= CurrentWidth)
                        {
                            if (GridHeight >= CurrentHeight)
                            {
                                chars[currentIndex] = TOP_RIGHT;
                            }
                            else
                            {
                                chars[currentIndex] = BOTTOM_RIGHT;
                            }
                        }
                        else
                        {
                            if (GridHeight >= CurrentHeight)
                            {
                                chars[currentIndex] = TOP_LEFT;
                            }
                            else
                            {
                                chars[currentIndex] = BOTTOM_LEFT;
                            }
                        }
                        continue;
                    }

                    //Bottom Left
                    if (x == pX - 1 && y == pY + 1)
                    {
                        if (GridWidth >= CurrentWidth)
                        {
                            if (GridHeight >= CurrentHeight)
                            {
                                chars[currentIndex] = BOTTOM_LEFT;
                            }
                            else
                            {
                                chars[currentIndex] = TOP_LEFT;
                            }
                        }
                        else
                        {
                            if (GridHeight >= CurrentHeight)
                            {
                                chars[currentIndex] = BOTTOM_RIGHT;
                            }
                            else
                            {
                                chars[currentIndex] = TOP_RIGHT;
                            }
                        }
                        continue;
                    }

                    //Bottom Right
                    if (x == pX + 1 && y == pY + 1)
                    {
                        if (GridWidth >= CurrentWidth)
                        {
                            if (GridHeight >= CurrentHeight)
                            {
                                chars[currentIndex] = BOTTOM_RIGHT;
                            }
                            else
                            {
                                chars[currentIndex] = TOP_RIGHT;
                            }
                        }
                        else
                        {
                            if (GridHeight >= CurrentHeight)
                            {
                                chars[currentIndex] = BOTTOM_LEFT;
                            }
                            else
                            {
                                chars[currentIndex] = TOP_LEFT;
                            }
                        }
                        continue;
                    }

                    chars[currentIndex] = EMPTY;
                }
            }
            PivotGrid.Reset(chars);
        }