当前位置: 首页>>代码示例>>C#>>正文


C# ObservableCollection.First方法代码示例

本文整理汇总了C#中ObservableCollection.First方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableCollection.First方法的具体用法?C# ObservableCollection.First怎么用?C# ObservableCollection.First使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObservableCollection的用法示例。


在下文中一共展示了ObservableCollection.First方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Refresh

        private void Refresh()
        {
            _patientList = new ObservableCollection<Patient>(App.amApp.Patients);
            _practitionerList = new ObservableCollection<Practitioner>(App.amApp.Practitioners);
            _appointmentList = new ObservableCollection<Appointment>(App.amApp.Appointments.Where(h=>h.Patient==Id));
            _queueList = new ObservableCollection<Queue>(App.amApp.Queues);
            appointmentcount.Content = "Appointments:" + _appointmentList.Where(k => k.Dated == selectdate.Text).Count().ToString();
            
            AppointmentlistView.ItemsSource = null;
            _appointment = new Appointment(null);

            ListQueue.Clear();
            ListAppoint.Clear();           

            foreach (Appointment T in _appointmentList.Where(i => i.Dated == selectdate.Text))
            {
                _appointment = new Appointment(null);
                _appointment.Id = T.Id;
                _appointment.Org = T.Org;
                _appointment.Details = "PATIENT : \t" + _patientList.First(x => x.Id.Equals(T.Patient)).Fname + " " + _patientList.First(x => x.Id.Equals(T.Patient)).Lname + Environment.NewLine + "PRACTITIONER : \t" + _practitionerList.First(x => x.Id.Equals(T.Practitioner)).Name + " " + Environment.NewLine + "HOURS: \t " + T.StartTime + "-END" + T.EndTime + Environment.NewLine + "REASON : \t" + T.Reason + Environment.NewLine + "Notify : \t" + T.Reminder; 
                _appointment.Practitioner = T.Practitioner;
                _appointment.Patient = T.Patient;
                _appointment.Dated = T.Dated;
                _appointment.StartTime = T.StartTime;
                _appointment.EndTime = T.EndTime;
                _appointment.Patientimage = _patientList.First(x => x.Id.Equals(T.Patient)).Image;
                _appointment.Reason = T.Reason;
                ListAppoint.Add(_appointment);
            }

            AppointmentlistView.ItemsSource = ListAppoint;


        }
开发者ID:WereDouglas,项目名称:amHealth,代码行数:34,代码来源:PatientAppointment.xaml.cs

示例2: ReplaceColorBlockItemsFromString_MultipleLines_ExistingBlockItems

        public void ReplaceColorBlockItemsFromString_MultipleLines_ExistingBlockItems()
        {
            // Arrange
            var testInputString = "SetTextColor 240 200 150 # Rarest Currency" + Environment.NewLine +
                                  "SetBackgroundColor 0 0 0 # Rarest Currency Background" + Environment.NewLine +
                                  "SetBorderColor 255 255 255 # Rarest Currency Border";

            var testInputBlockItems = new ObservableCollection<IItemFilterBlockItem>();
            var testInputTextColorBlockItem = new TextColorBlockItem(Colors.Red);
            var testInputBackgroundColorBlockItem = new BackgroundColorBlockItem(Colors.Blue);
            var testInpuBorderColorBlockItem = new BorderColorBlockItem(Colors.Yellow);
            testInputBlockItems.Add(testInputTextColorBlockItem);
            testInputBlockItems.Add(testInputBackgroundColorBlockItem);
            testInputBlockItems.Add(testInpuBorderColorBlockItem);

            // Act
            _testUtility.Translator.ReplaceColorBlockItemsFromString(testInputBlockItems, testInputString);

            // Assert
            var textColorBlockItem = testInputBlockItems.First(b => b is TextColorBlockItem) as TextColorBlockItem;
            Assert.IsNotNull(textColorBlockItem);
            Assert.AreNotSame(testInputTextColorBlockItem, textColorBlockItem);
            Assert.AreEqual(new Color {A = 255, R = 240, G = 200, B = 150}, textColorBlockItem.Color);

            var backgroundColorBlockItem = testInputBlockItems.First(b => b is BackgroundColorBlockItem) as BackgroundColorBlockItem;
            Assert.IsNotNull(backgroundColorBlockItem);
            Assert.AreNotSame(testInputBackgroundColorBlockItem, backgroundColorBlockItem);
            Assert.AreEqual(new Color { A = 255, R = 0, G = 0, B = 0 }, backgroundColorBlockItem.Color);

            var borderColorBlockItem = testInputBlockItems.First(b => b is BorderColorBlockItem) as BorderColorBlockItem;
            Assert.IsNotNull(borderColorBlockItem);
            Assert.AreNotSame(testInpuBorderColorBlockItem, borderColorBlockItem);
            Assert.AreEqual(new Color { A = 255, R = 255, G = 255, B = 255 }, borderColorBlockItem.Color);
        }
开发者ID:BourbonCrow,项目名称:Filtration,代码行数:34,代码来源:TestItemFilterBlockTranslator.cs

示例3: Refresh

        private void Refresh()
        {
            _patientList = new ObservableCollection<Patient>(App.amApp.Patients);
            _practitionerList = new ObservableCollection<Practitioner>(App.amApp.Practitioners);
            _appointmentList = new ObservableCollection<Appointment>(App.amApp.Appointments);
            _queueList = new ObservableCollection<Queue>(App.amApp.Queues);
            appointmentcount.Content = "Appointments:" + _appointmentList.Where(k => k.Dated == selectdate.Text).Count().ToString();
            queuecount.Content = "People in queue :" + _queueList.Where(k => Convert.ToDateTime(k.Day).Date == Convert.ToDateTime(selectdate.Text).Date).Count().ToString();
            QueuelistView.ItemsSource = null;
            AppointmentlistView.ItemsSource = null;
            _appointment = new Appointment(null);

            ListQueue.Clear();
            ListAppoint.Clear();


            foreach (Queue Q in _queueList.Where(m => Convert.ToDateTime(m.Day).Date == Convert.ToDateTime(selectdate.Text).Date && m.Seen=="F"))
            {
                _queue = new Queue(null);
                _queue.Id = Q.Id;
                _queue.Org = Q.Org;
                _queue.Details = "PATIENT : \t" + _patientList.First(x => x.Id.Equals(Q.Patient)).Fname + " " + _patientList.First(x => x.Id.Equals(Q.Patient)).Lname + Environment.NewLine + "PRACTITIONER : \t" + _practitionerList.First(x => x.Id.Equals(Q.Practitioner)).Name + " " + Environment.NewLine + "TIME :" + Q.Checked + Environment.NewLine + "REASON: \t" + Q.Reason + " " + Environment.NewLine + "State:" + Q.Seen + " Amount paid:" + Q.Amount; ;
                _queue.Practitioner = Q.Practitioner;               
                _queue.Patient = Q.Patient;
                _queue.Patientimage = _patientList.First(x => x.Id.Equals(Q.Patient)).Image;
                _queue.Payment = Q.Payment;
                _queue.Amount = Q.Amount;
                _queue.Checked = Convert.ToDateTime(Q.Checked).ToString("T");
                _queue.Reason = Q.Reason;

                ListQueue.Add(_queue);
            }
            //apointment list view 
            QueuelistView.ItemsSource = ListQueue;


            foreach (Appointment T in _appointmentList.Where(i => i.Dated == selectdate.Text))
            {
                _appointment = new Appointment(null);
                _appointment.Id = T.Id;
                _appointment.Org = T.Org;
                _appointment.Details = "PATIENT : \t" + _patientList.First(x => x.Id.Equals(T.Patient)).Fname + " " + _patientList.First(x => x.Id.Equals(T.Patient)).Lname + Environment.NewLine + "PRACTITIONER : \t" + _practitionerList.First(x => x.Id.Equals(T.Practitioner)).Name + " " + Environment.NewLine + "PERIOD: \t \t " + T.Meet + "-" + T.EndTime +" "+ Environment.NewLine + " REASON : \t" + T.Reason;
                _appointment.Practitioner = T.Practitioner;
                _appointment.Patient = T.Patient;
                _appointment.Dated = T.Dated;
                _appointment.StartTime = T.StartTime;
                _appointment.EndTime = T.EndTime;
                _appointment.Patientimage = _patientList.First(x => x.Id.Equals(T.Patient)).Image;
                _appointment.Reason = T.Reason;
                ListAppoint.Add(_appointment);
            }

            AppointmentlistView.ItemsSource = ListAppoint;


        }
开发者ID:WereDouglas,项目名称:amHealth,代码行数:56,代码来源:QueuePage.xaml.cs

示例4: MasterInventoryEditAddSupplierVM

 public MasterInventoryEditAddSupplierVM(ObservableCollection<SupplierVM> editSuppliers)
 {
     _editSuppliers = editSuppliers;
     SuppliersAvailableForAddition = new ObservableCollection<SupplierVM>();
     LoadSuppliersAvailableForAddition();
     _selectedSupplierForAddition = SuppliersAvailableForAddition.First();
 }
开发者ID:starlest,项目名称:PJSM.ERP,代码行数:7,代码来源:MasterInventoryEditAddSupplierVM.cs

示例5: TaskListViewModel

        public TaskListViewModel()
        {
            Tasks = new ObservableCollection<PandocTask>(TaskRepository.ToList());
            SelectedTask = Tasks.Any() ? Tasks.First() : null;

            Add = new RelayCommand(() =>
                {
                    var task = new PandocTask();
                    Tasks.Add(task);
                });

            Save = new RelayCommand(() =>
                {
                    var trans = TaskRepository.BeginBatch();
                    foreach (var task in Tasks)
                    {
                        if (TaskRepository.Exists(task.Key))
                            trans.Update(task);
                        else trans.Add(task);
                    }
                    trans.Commit();
                });

            Load = new RelayCommand(() =>
                {
                    Tasks.Clear();
                    foreach (var task in TaskRepository.GetAll())
                    {
                        Tasks.Add(task);
                    }
                });
        }
开发者ID:nagysa1313,项目名称:PandocGUI,代码行数:32,代码来源:TaskListViewModel.cs

示例6: ConfigViewModel

 public ConfigViewModel(AgentConfig agentConfig)
 {
     m_AgentConfig = agentConfig;
     m_Nodes = new ObservableCollection<NodeConfig>(agentConfig.Nodes);
     m_Nodes.Add(new NewNodeConfig());
     SelectedNode = m_Nodes.First();
 }
开发者ID:kerryjiang,项目名称:SuperSocket.ServerManager,代码行数:7,代码来源:ConfigViewModel.cs

示例7: MainWindowViewModel

        public MainWindowViewModel()
        {
            Tabs = new ObservableCollection<ViewModelBase>(new ViewModelBase[]
            {
                ServerListViewModel = new ServerListViewModel()
            });
            CurrentTab = Tabs.First();

            ServerList = new Core.ServerList();
            Launcher = new GameLauncher();

            SettingsViewModel = new SettingsViewModel();
            UpdatesViewModel = new UpdatesViewModel(Launcher);
            UpdatesViewModel.LocatorChanged += (sender, e) => { ServerList.GetAndUpdateAll(); };

            PluginsViewModel = new PluginsViewModel();
            Launcher.ModDetailsChanged += (sender, e) =>
            {
                var modDetails = (MetaModDetails) e.UserState;
                if (modDetails != null && e.Cancelled == false && e.Error == null)
                {
                    Execute.OnUiThread(() => PluginsViewModel.Refresh(modDetails.Plugins));
                }
            };

            ServerListViewModel.Launcher = Launcher;
            UpdatesViewModel.CheckForUpdates();
        }
开发者ID:rajkosto,项目名称:DayZeroLauncher,代码行数:28,代码来源:MainWindowViewModel.cs

示例8: MainViewModel

 public MainViewModel()
 {
     RowViewModels = new ObservableCollection<RowViewModel>();
     QueryCustomerDTO();
     SelectedRowViewModel = RowViewModels.First();
     SelectedRowViewModel.Initialize(this);
 }
开发者ID:anilvaltech,项目名称:TestGitWorkFlow,代码行数:7,代码来源:MainViewModel.cs

示例9: ResourceFileViewModel

        public ResourceFileViewModel(FilesService filesService)
        {
            this.filesService = filesService;
            files = new ObservableCollection<ResourceFile>(filesService.ResourceFiles());

            if (files.Count > 0) selectedFile = files.First();
        }
开发者ID:ramgp,项目名称:softedule,代码行数:7,代码来源:ResourceFileViewModel.cs

示例10: AdventurersViewModel

        public AdventurersViewModel()
        {
            Adventurers = new ObservableCollection<AdventurerModel>();

            Adventurers.Add(new AdventurerModel(new Adventurer()));
            SelectedAdventurer = Adventurers.First();
        }
开发者ID:colobei,项目名称:AdventurerManager,代码行数:7,代码来源:AdventurersViewModel.cs

示例11: DajKorisnikPrograma

        public KorisnikPrograma DajKorisnikPrograma()
        {
            try
            {
                LavDataClassesDataContext _baza = new LavDataClassesDataContext(konekcioniString);

                if (_baza.DatabaseExists())
                {
                    IQueryable<KorisnikPrograma> _upit = (from p in _baza.KorisnikProgramas
                                                          select p).OrderBy(w => w.KorisnikProgramaID).Take(1);

                    ObservableCollection<KorisnikPrograma> _lista = new ObservableCollection<KorisnikPrograma>(_upit.ToList());

                    if (_lista.Count().Equals(1))
                    {
                        return _lista.First();
                    }
                    else
                    {
                        return null;
                    }
                }
                else
                {
                    throw new Exception("Baza ne postoji.");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:vodolijabg,项目名称:LS,代码行数:32,代码来源:DBProksi.cs

示例12: LayoutEditorViewModel

        public LayoutEditorViewModel(LayoutAsset layoutAsset, Framework framework)
        {
            this.layoutAsset = layoutAsset;

            SceneManager = new SceneManager(framework.Device, framework.AssetManager);

            UpdateVisualTree();

            RenderViewModel = new RenderViewModel(framework, SceneManager);
            RenderViewModel.SizeChanged += ((o, e) =>
                {
                    layoutAsset.Layout.Size = new Size(RenderViewModel.Width, RenderViewModel.Height);
                });

            Elements = new ObservableCollection<UIElementEditor>() { UIElementEditor.Create(null, layoutAsset.Layout, framework.AssetManager) };
            Elements.First().TreeChanged += (o, e) => UpdateVisualTree();

            SaveCommand = new DelegateCommand(() =>
                {
                    layoutAsset.Layout.Save(layoutAsset.FullPath);
                    StatusBarService.StatusText = "Layout saved: " + layoutAsset.ShortName;
                });
            Document = new TextDocument();
            IsDesignMode = true;

            this.xmlUpdateTimer.Interval = TimeSpan.FromMilliseconds(500);
            this.xmlUpdateTimer.Tick += UpdateXmlDocument;
            UpdateXmlDocument(this, EventArgs.Empty);

            RenderViewModel.MouseMove += RenderViewModel_MouseMove;
            RenderViewModel.MouseDown += RenderViewModel_MouseDown;
            RenderViewModel.MouseUp += RenderViewModel_MouseUp;
        }
开发者ID:HaKDMoDz,项目名称:Irelia,代码行数:33,代码来源:LayoutEditorViewModel.cs

示例13: MainViewModel

        public MainViewModel()
        {
            LoadPeopleCommand = new RelayCommand(LoadPeople);
            SaveToFileCommand = new RelayCommand(SaveToFile, () => _isFinishedScraping);
            People = new ObservableCollection<PersonViewModel>();

            Messenger.Default.Register<PeopleRetrievedEvent>(this, (e) =>
                                                                       {

                                                                           foreach (var person in e.People)
                                                                           {
                                                                               People.Add(new PersonViewModel(person));
                                                                               _infoCounter += 1;
                                                                               LoadPersonInfo(person);
                                                                           }
                                                                       });
            Messenger.Default.Register<PersonInfoRetrievedEvent>(this, (e) =>
                                                                           {
                                                                               var personViewModel =
                                                                                   People.First(
                                                                                       p => p.Person.Id == e.Person.Id);
                                                                               personViewModel.Info = e.Info;
                                                                               if (_infoCounter == People.Count)
                                                                               {
                                                                                   _isFinishedScraping = true;
                                                                                   IsLoadingPeople = false;
                                                                               }
                                                                           });
        }
开发者ID:mrsteffenjo,项目名称:FagweekendNov2012,代码行数:29,代码来源:MainViewModel.cs

示例14: TreeOrganizedByDeviceTypeViewModel

 public TreeOrganizedByDeviceTypeViewModel(IList<Machine> machines)
 {
     _treeData = new ObservableCollection<DeviceTypeNode>();
     foreach (Machine machine in machines)
     {
         if (machine.Devices != null)
             foreach (Device device in machine.Devices)
             {
                 if (_treeData.Any(t => t.DeviceType == device.DeviceType))
                 {
                     var deviceTypeNode = _treeData.First(t => t.DeviceType == device.DeviceType);
                     deviceTypeNode.Devices.Add(string.Format("{0} - {1}", machine.MachineName, device.DeviceName), device); //NOTE: In real application, this is actually just LocationId, need to look up meaningful location name
                 }
                 else
                 {
                     _treeData.Add(new DeviceTypeNode
                         {
                             DeviceType = device.DeviceType,
                             Devices = new Dictionary<string, Device>()
                                 {
                                     { string.Format("{0} - {1}",machine.MachineName, device.DeviceName), device }
                                 }
                         });
                 }
             }
     }
 }
开发者ID:killnine,项目名称:MvvmTest,代码行数:27,代码来源:TreeOrganizedByDeviceTypeViewModel.cs

示例15: INotifyPropertyChangedTest

        public void INotifyPropertyChangedTest()
        {
            string text = "b";

            //DataGird 

            ObservableCollection<P> oc = new ObservableCollection<P>();
            oc.Add(new P() { Value = "a" });
            oc.First().SetValue(text);

            Assert.AreEqual(text, oc.First().Value);

            oc.First().Nofity();

            Assert.AreEqual(text, oc.First().Value);
        }
开发者ID:CHiiLD,项目名称:DY-InventoryApp,代码行数:16,代码来源:PropertyChangedTest.cs


注:本文中的ObservableCollection.First方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。