Beispiel #1
0
        // CONSTRUCTORS
        public MainForm()
        {
            InitializeComponent();

            random        = new Random();
            people        = new People();
            filterControl = null;

            string[] names    = { "Bob", "John", "Sam", "David", "Adam" };
            string[] surnames = { "Ross", "Snow", "Davis", "Bowie", "Gontier" };

            for (int i = 0; i < 50000; ++i)
            {
                people.Add(new Person()
                {
                    Id      = i,
                    Name    = names[random.Next(names.Length)] + i,
                    Surname = surnames[random.Next(surnames.Length)] + i,
                    Age     = random.Next(1, 90)
                });
            }

            peopleView = new PeopleView(people);

            UpdateInterface();
        }
Beispiel #2
0
    /// <summary>
    /// 生成所有学生
    /// </summary>
    void GeneratePeople(People people)
    {
        PeopleView peopleView = GenerateEntity(ObjectPoolSingle.PeopleView) as ActionModulePeopleView;

        peopleView.transform.SetParent(trans_peopleGrid, false);
        peopleView.Init(people);
    }
        private void ExecuteApplyFilter()
        {
            DateTime _zeroDay = new DateTime(1, 1, 1);
            DateTime _now     = DateTime.Now;

            criteria.Clear();

            if (yearsChosen > 0)
            {
                criteria.Add(new Predicate <Person>(x => yearsChosen < (
                                                        (_zeroDay + (_now - x.BirthDate)).Year - 1)
                                                    ));
            }

            if (letterChosen != "Any")
            {
                criteria.Add(new Predicate <Person>(x => x.LastName.StartsWith(letterChosen)));
            }
            if (genderChosen != "Any")
            {
                criteria.Add(new Predicate <Person>(x => x.Gender.Equals(genderChosen.Substring(0, 1))));
            }

            PeopleView.Filter = dynamic_Filter;
            RaisePropertyChanged("PeopleView");
            // Bring the current person back into view in case it moved
            if (CurrentPerson != null)
            {
                Person current = CurrentPerson;
                PeopleView.MoveCurrentToFirst();
                PeopleView.MoveCurrentTo(current);
            }
        }
        public void Add(Contact contact)
        {
            // Ignore this call if a search is currently running.
            if (!string.IsNullOrEmpty(searchBox.Text))
            {
                return;
            }

            message.Visibility         = Visibility.Hidden;
            contactsListBox.Visibility = Visibility.Visible;
            PeopleView.SmartInsert(contactsListBox, contact);
        }
        //Constructor
        public PersonListViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, IPersonService personService)
        {
            _rm = regionManager;
            _ps = personService;

            People = personService.GetAllPartialPeople();
            PeopleView.Refresh();
            PeopleView.Filter = PersonNameSearchFilter;

            NewPersonRequest = new InteractionRequest <INewPersonNotification>();
            NewClientCommand = new DelegateCommand(CreateNewPerson);
            eventAggregator.GetEvent <PersonListSelectEvent>().Subscribe(NavigateToPersonEntry);
        }
 private void CreatePeopleView()
 {
     if (peopleView == null)
     {
         peopleView = new PeopleView();
         peopleView.OnBeginEditEvent    += peopleView_OnBeginEditEvent;
         peopleView.OnEndEditEvent      += peopleView_OnEndEditEvent;
         peopleView.OnOpenContactEvent  += peopleView_OnOpenContactEvent;
         peopleView.OnCloseContactEvent += peopleView_OnCloseContactEvent;
         peopleView.OnChangeViewEvent   += peopleView_OnChangeViewEvent;
         peopleView.OnDateModifiedEvent += peopleView_OnDateModifiedEvent;
         panelsGrid.Children.Add(peopleView);
         peopleView.UpdateLayout();
     }
 }
Beispiel #7
0
        public void PropertyChangedTest()
        {
            var school = new School()
            {
                Name = "MIT"
            };
            var view      = new PeopleView();
            var viewModel = new SchoolViewModel(view, school);

            Assert.AreEqual(view, viewModel.View);
            Assert.AreEqual(viewModel, view.DataContext);

            Assert.IsFalse(viewModel.IsSchoolNameChanged);
            school.Name = "Yale";
            Assert.IsTrue(viewModel.IsSchoolNameChanged);
        }
        public override void Load()
        {
            string[] favorites = Settings.PeopleFavorites;

            contactsListBox.Items.Clear();

            if (favorites == null || favorites.Length == 0)
            {
                message.Visibility = Visibility.Visible;
                return;
            }

            contactsListBox.Visibility = Visibility.Visible;
            message.Visibility         = Visibility.Hidden;

            foreach (string each in favorites)
            {
                Contact c = ContactDatabase.GetContact(each);
                if (c != null)
                {
                    PeopleView.SmartInsert(contactsListBox, c);
                }
            }

            //
            // BUG FIX: Since a contact is not placed in database until it is saved,
            // a contact marked as "Favorite" would be inaccessible.
            //
            if (!contactsListBox.HasItems)
            {
                contactsListBox.Visibility = Visibility.Hidden;
                message.Visibility         = Visibility.Visible;
                FrictionScrollViewerControl scrollViewer = (FrictionScrollViewerControl)contactsListBox.Template.FindName("_tv_scrollviewer_", contactsListBox);
                scrollViewer.LayoutVerticalScrollBar();
                scrollViewer.LayoutHorizontalScrollBar();
            }
        }
    //public PeopleView p2;

    public override void Init(params object[] args)
    {
        Plan plan = args[0] as Plan;

        //PeopleView peopleView = GenerateEntity(ObjectPoolSingle.PeopleView) as PeopleView;
        //peopleView.transform.SetParent(trans_peopleGrid, false);
        for (int i = 0; i < plan.peopleList.Count; i++)
        {
            PeopleView peopleView = PanelManager.Instance.OpenSingle <ActionModulePeopleView>(trans_grid, plan.peopleList[i]);
        }
        if (plan.peopleList.Count == 2)
        {
            //p1.Init(plan.peopleList[0]);
            // p2.gameObject.SetActive(true);
            // p2.Init(plan.peopleList[1]);
            obj_line.gameObject.SetActive(true);
        }
        else
        {
            // p1.Init(plan.peopleList[0]);
            // p2.gameObject.SetActive(false);
            obj_line.gameObject.SetActive(false);
        }
    }
Beispiel #10
0
 // NOTE: I needed to add this method and export it as an action in order to hook up the
 // Print... menu to the FirstResponder printDocument: method which has to be called bu the OS
 // and will trigger the call to PrintOperation(NSDictionary printSettings, out NSError outError)
 // However, once I added this method and made the connection, I no longer need this here,
 // so it was just needed to be able to set the target/ action pair for the Print... menu.
 //        [Action("printDocument:")]
 //        public override void PrintDocument(NSObject sender)
 //        {
 //            //base.PrintDocument(sender);
 //        }
 public override NSPrintOperation PrintOperation(NSDictionary printSettings, out NSError outError)
 {
     outError = new NSError();
     PeopleView view = new PeopleView(NSArray.FromObjects(Employees.ToArray()));
     NSPrintInfo printInfo = this.PrintInfo;
     NSPrintOperation printOp = NSPrintOperation.FromView(view, printInfo);
     return printOp;
 }
Beispiel #11
0
        public App()
        {
            InitializeComponent();

            MainPage = new PeopleView();
        }
Beispiel #12
0
 private object RefreshView()
 {
     PeopleView.Refresh();
     RaisePropertyChanged("PeopleView");
     return(null);
 }