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


C# ObservableCollection.Max方法代码示例

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


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

示例1: FenetreGestionAdmin

        public FenetreGestionAdmin()
        {
            //Delegate pour exécuter du code personnalisé lors du changement de langue de l'UI.
            CultureManager.UICultureChanged += CultureManager_UICultureChanged;

            InitializeComponent();

            // Header de la fenetre
            App.Current.MainWindow.Title = Nutritia.UI.Ressources.Localisation.FenetreGestionAdmin.Titre;

            //Récupère tout les membres de la BD.
            listMembres = new ObservableCollection<Membre>(serviceMembre.RetrieveAll());

            //Récupère le temps de DerniereMaj (Mise à jour) des membres le plus récent et l'enregistre dans
            //currentTime et previousTime.
            currentTime = previousTime = listMembres.Max(m => m.DerniereMaj);

            //On enlève le membre actuellement connecté de la liste pour qu'il ne puisse pas intéragir sur son propre compte.
            listMembres.Remove(listMembres.FirstOrDefault(x => x.NomUtilisateur == App.MembreCourant.NomUtilisateur));

            //Configure la dataGrid de la searchBox et le predicate pour le filtre.
            filterDataGrid.DataGridCollection = CollectionViewSource.GetDefaultView(listMembres);
            filterDataGrid.DataGridCollection.Filter = new Predicate<object>(Filter);

            //De listMembres, obtient la liste des administrateurs seulement.
            listAdmins = new ObservableCollection<Membre>(listMembres.Where(m => m.EstAdministrateur).ToList());

            dgAdmin.ItemsSource = listAdmins;
            adminDepart = listAdmins.ToList();

            //Configuration du thread. Met en background pour forcer la terminaison lorsque le logiciel se ferme.
            dbPoolingThread = new Thread(PoolDB);
            dbPoolingThread.IsBackground = true;
            dbPoolingThread.Start();
        }
开发者ID:Nutritia,项目名称:nutritia,代码行数:35,代码来源:FenetreGestionAdmin.xaml.cs

示例2: RangeCollection

 public RangeCollection() 
 {
     _ranges = new ObservableCollection<IRange>();
     _ranges.CollectionChanged += (s, e) =>
     {
         switch (e.Action)
         {
             case NotifyCollectionChangedAction.Add:
                 foreach (IRange newRange in e.NewItems)
                 {
                     AddInternal(newRange);
                     newRange.RangeChanged += CollectionElementChanged;
                 }
                 break;
             case NotifyCollectionChangedAction.Remove:
                 var isRescanNeeded = false;
                 foreach (Range oldRange in e.OldItems)
                 {
                     oldRange.RangeChanged -= CollectionElementChanged;
                     isRescanNeeded = (oldRange.Max >= Maximum) || (oldRange.Min <= Minimum);
                 }
                 if (isRescanNeeded) Update(_ranges.Min(r => r.Min), _ranges.Max(r => r.Max));
                 break;
         }
     };
 }
开发者ID:AuditoryBiophysicsLab,项目名称:ESME-Workbench,代码行数:26,代码来源:RangeCollection.cs

示例3: DynamicListVM

        public DynamicListVM(Action<string, string> popup)
        {
            _popup = popup;

            Items = new ObservableCollection<DynamicListItem>
            {
                new DynamicListItem() {Id = 1, Name = "Initial"},
                new DynamicListItem() {Id = 2, Name = "Added"}
            };
            SimpleItems = new ObservableCollection<string> { "Initial", "Added" };

            AddItemCommand = new Command(() =>
            {
                var max = 0;
                if (Items.Count > 0)
                    max = Items.Max(i => i.Id);
                Items.Add(new DynamicListItem { Id = ++max, Name = EntryText });
                SimpleItems.Add(EntryText);
            });
            UpdateItemCommand = new Command(() =>
            {
                Items[0].Name = "Update: " + Items[0].Name;
                SimpleItems[0] = "Update: " + SimpleItems[0];
            });
            SelectedItemCommand = new Command<DynamicListItem>((item) => _popup("Item Selected", string.Format("You selected {0}", item.Name)));
            DeleteItemCommand = new Command<DynamicListItem>((item) => Items.Remove(item));
        }
开发者ID:JC-Chris,项目名称:XFExtensions,代码行数:27,代码来源:DynamicListVM.cs

示例4: AgentGroupConfigViewModel

 public AgentGroupConfigViewModel(IEnumerable<WayPoint> ioPoints, List<AgentsGroup> groups)
 {
     if (groups != null && groups.Count > 0)
     {
         _agentGroups = new ObservableCollection<AgentGroupViewModel>(from g in groups select new AgentGroupViewModel(g, AgentTypes.FirstOrDefault(t => t.Code == g.AgentTypeCode)));
         _idGenerator = new Generator(_agentGroups.Max(a => a.Group.Id));
     }
     else
     {
         _agentGroups = new ObservableCollection<AgentGroupViewModel>();
         _idGenerator = new Generator();
     }
     _ioPoints = ioPoints;
 }
开发者ID:nomoreserious,项目名称:FlowSimulation,代码行数:14,代码来源:AgentGroupConfigViewModel.cs

示例5: GestionAdmin

        public GestionAdmin()
        {
            CultureManager.UICultureChanged += CultureManager_UICultureChanged;

            InitializeComponent();

            // Header de la fenetre
            App.Current.MainWindow.Title = Nutritia.UI.Ressources.Localisation.FenetreGestionAdmin.Titre;

            //filterDataGrid.ItemsSource = s.ConvertAll(x => new { Value = x });
            listMembres = new ObservableCollection<Membre>(serviceMembre.RetrieveAll());
            filterDataGrid.DataGridCollection = CollectionViewSource.GetDefaultView(listMembres);
            filterDataGrid.DataGridCollection.Filter = new Predicate<object>(Filter);
            listAdmins = new ObservableCollection<Membre>(listMembres.Where(m => m.EstAdministrateur).ToList());
            //adminsSysteme = new ObservableCollection<Membre>(serviceMembre.RetrieveAdmins());
            dgAdmin.ItemsSource = listAdmins;
            adminDepart = listAdmins.ToList();

            currentTime = previousTime = listMembres.Max(m => m.DerniereMaj);

            dbPoolingThread = new Thread(PoolDB);
            dbPoolingThread.IsBackground = true;
            dbPoolingThread.Start();
        }
开发者ID:Corantin,项目名称:nutritia,代码行数:24,代码来源:FenetreGestionAdmin.xaml.cs

示例6: listUpdate

        private void listUpdate() {
            mWindow.newList.ItemsSource = newList.Select(Process => Process.id);
            mWindow.readyList.ItemsSource = readyList.Select(Process => Process.id);
            mWindow.waitingList.ItemsSource = waitingList.Select(Process => Process.id);
            mWindow.waitingDiskList.ItemsSource = waitingDiskList.Select(Process => Process.id);
            mWindow.terminatedList.ItemsSource = terminatedList.Select(Process => Process.id);

            fullList = new ObservableCollection<Process>();
            fullList = new ObservableCollection<Process>(fullList.Concat(newList));
            fullList = new ObservableCollection<Process>(fullList.Concat(readyList));
            fullList = new ObservableCollection<Process>(fullList.Concat(waitingList));
            fullList = new ObservableCollection<Process>(fullList.Concat(terminatedList));
            fullList = new ObservableCollection<Process>(fullList.Concat(waitingDiskList));

            tapList = new ObservableCollection<Process>();
            tapList = new ObservableCollection<Process>(tapList.Concat(readyList));
            tapList = new ObservableCollection<Process>(tapList.Concat(waitingList));

            pageList = new ObservableCollection<Page>();
            pageList = new ObservableCollection<Page>(pageList.Concat(Pages));

            if (running != null) {
                fullList.Add(running);
                tapList.Add(running);
            }
            if (waiting != null) {
                fullList.Add(waiting);
                tapList.Add(waiting);
            }

            if (usingDisk != null) {
                fullList.Add(usingDisk);
                tapList.Add(usingDisk);
            }

            try {
                fullList = new ObservableCollection<Process>(fullList.OrderBy(Process => Process.realID));
                tapList = new ObservableCollection<Process>(tapList.OrderBy(Process => Process.realID));
            }
            catch {
                MessageBox.Show("Wow you managed to fuck it up");
            }

            mWindow.tap.Columns.Clear();

            ObservableCollection<DataGridTextColumn> _defTap = new ObservableCollection<DataGridTextColumn>();

            DataGridTextColumn id = new DataGridTextColumn() {
                Header = "ID",
                Binding = new Binding("id")
            };

            DataGridTextColumn size = new DataGridTextColumn() {
                Header = "Size",
                Binding = new Binding("size")
            };

            DataGridTextColumn frames = new DataGridTextColumn() {
                Header = "Frames",
                Binding = new Binding("frames")
            };

            DataGridTextColumn status = new DataGridTextColumn() {
                Header = "Status",
                Binding = new Binding("status")
            };

            _defTap.Add(id);
            _defTap.Add(size);
            _defTap.Add(frames);
            _defTap.Add(status);

            foreach (DataGridTextColumn item in _defTap) {
                mWindow.tap.Columns.Add(item);
            }

            int maxFrames;
            try {
                maxFrames = tapList.Max(Process => Process.framesLocation.Length);
            }
            catch {
                maxFrames = 0;
            }

            for (int i = 1; i <= maxFrames; i++) {
                DataGridTextColumn column = new DataGridTextColumn();
                column.Header = "Frame " + i;
                string _temp = "framesLocation[" + i + "]";
                column.Binding = new Binding(_temp);
                mWindow.tap.Columns.Add(column);
            }
        }
开发者ID:raultcj,项目名称:PenOS,代码行数:92,代码来源:Simulation.cs

示例7: LoadReport

        private void LoadReport()
        {
            var query = from s in ServiceZipList
                        where StoresWithCheckList.Where(st => st.Check).Any(st => st.Store.StoreNumber == s.StoreNumber) &&
                              ReturnNumberMonth(s.ServiceMonth) >= ReturnNumberMonth(StartMonth) &&
                              ReturnNumberMonth(s.ServiceMonth) <= ReturnNumberMonth(EndMonth) &&
                              s.ServiceYear >= StartYear &&
                              s.ServiceYear <= EndYear
                        select s;
            ReportStoresCount = StoresWithCheckList.Where(st => st.Check).Count();
            WorkICL = query.Where(q => q.Company == "АйСиЭл").Where(q => q.ZipName == "Ремонт").Sum(q => q.ZipQuantity.Value == 0 ? q.ZipPrice : q.ZipQuantity.Value * q.ZipPrice);
            EquipmentICL = query.Where(q => q.Company == "АйСиЭл").Where(q => q.ZipName != "Транспортные услуги" && q.ZipName != "Ремонт").Sum(q => q.ZipQuantity.Value == 0 ? q.ZipPrice : q.ZipQuantity.Value * q.ZipPrice);
            TrICL = query.Where(q => q.Company == "АйСиЭл").Where(q => q.ZipName == "Транспортные услуги").Sum(q => q.ZipQuantity.Value == 0 ? q.ZipPrice : q.ZipQuantity.Value * q.ZipPrice);
            TotalICL = WorkICL + EquipmentICL + TrICL;
            AvICL = TotalICL / StoresWithCheckList.Where(st => st.Check).Count();
            WorkKKS = query.Where(q => q.Company == "ККС").Where(q => q.ZipName == "Ремонт").Sum(q => q.ZipQuantity.Value == 0 ? q.ZipPrice : q.ZipQuantity.Value * q.ZipPrice);
            EquipmentKKS = query.Where(q => q.Company == "ККС").Where(q => q.ZipName != "Транспортные услуги" && q.ZipName != "Ремонт").Sum(q => q.ZipQuantity.Value == 0 ? q.ZipPrice : q.ZipQuantity.Value * q.ZipPrice);
            TrKKS = query.Where(q => q.Company == "ККС").Where(q => q.ZipName == "Транспортные услуги").Sum(q => q.ZipQuantity.Value == 0 ? q.ZipPrice : q.ZipQuantity.Value * q.ZipPrice);
            TotalKKS = WorkKKS + EquipmentKKS + TrKKS;
            AvKKS = TotalKKS / StoresWithCheckList.Where(st => st.Check).Count();
            var list = (from s in query
                        where s.Company == "ККС"
                        group s by new { s.ServiceMonth, s.ServiceYear }
                        into ym
                        select new MonthExp { MonthYear = new DateTime(ym.Key.ServiceYear.Value, ReturnNumberMonth(ym.Key.ServiceMonth), 1), Expense = (ym.Where(s => s.ZipQuantity.Value == 0).Sum(s => s.ZipPrice) + ym.Where(s => s.ZipQuantity.Value != 0).Sum(s => s.ZipPrice * s.ZipQuantity.Value)) }).ToList();
            KKSExpList = new ObservableCollection<MonthExp>(list);
            list = (from s in query
                    where s.Company == "АйСиЭл"
                    group s by new { s.ServiceMonth, s.ServiceYear }
                    into ym
                    select new MonthExp { MonthYear = new DateTime(ym.Key.ServiceYear.Value, ReturnNumberMonth(ym.Key.ServiceMonth), 1), Expense = (ym.Where(s => s.ZipQuantity.Value == 0).Sum(s => s.ZipPrice) + ym.Where(s => s.ZipQuantity.Value != 0).Sum(s => s.ZipPrice * s.ZipQuantity.Value)) }).ToList();
            ICLExpList = new ObservableCollection<MonthExp>(list);
            var minKKS = KKSExpList.Count > 0 ? KKSExpList.Min(k => k.Expense) - 3000 : 0;
            var maxKKS = KKSExpList.Count > 0 ? KKSExpList.Max(k => k.Expense) + 10000 : 100000;
            var minICL = ICLExpList.Count > 0 ? ICLExpList.Min(i => i.Expense) - 3000 : 0;
            var maxICL = ICLExpList.Count > 0 ? ICLExpList.Max(i => i.Expense) + 10000 : 100000;
            MinimumAmount = minKKS > minICL ? minICL : minKKS;
            MaximumAmount = maxKKS > maxICL ? maxKKS : maxICL;

        }
开发者ID:Fredoq,项目名称:AccountsWork,代码行数:40,代码来源:StoresServiceReportViewModel.cs

示例8: syncs

        private void syncs(string url)
        {

            App.Current.Dispatcher.Invoke((Action)delegate()
            {
                InputBlock.Text = InputBlock.Text + Environment.NewLine + "Connecting to the download url" + "  " + DateTime.Now.ToString();
                Scroller.ScrollToBottom();
                InputBlock.ScrollToEnd();
            });

            double lastID = 0;
            _messageList = new ObservableCollection<Message>(App.am.Messages);

            try
            {

                lastID = _messageList.Max(h => Convert.ToDouble(h.Id));

            }
            catch
            {

                MessageBox.Show("you have no last ID please insert/reset the last ID !");
                App.Current.Dispatcher.Invoke((Action)delegate()
                {
                    InputBlock.Text = Environment.NewLine + "you have no last ID please insert/reset the last ID !";
                    Scroller.ScrollToBottom();
                    InputBlock.ScrollToEnd();
                });

            }

            if (lastID != 0)
            {

                url = url + lastID.ToString();
                using (var client = new WebClient())
                {

                    try
                    {
                        var json = client.DownloadString(url);
                        //Console.WriteLine(url);
                        WebRequest request = WebRequest.Create(url);
                        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                        Stream dataStream = response.GetResponseStream();

                        StreamReader reader = new StreamReader(dataStream);

                        string responseFromServer = reader.ReadToEnd();

                        Console.WriteLine(responseFromServer);
                        App.Current.Dispatcher.Invoke((Action)delegate()
                        {
                            InputBlock.Text = InputBlock.Text + Environment.NewLine + responseFromServer + "  " + DateTime.Now.ToString();
                        });

                        // Console.WriteLine(response.ToString());
                        List<Message> models = JsonConvert.DeserializeObject<List<Message>>(responseFromServer);

                        for (int d = 0; d < models.Count; d++)
                        {
                            //Console.WriteLine( models[d].Numbers);


                            _message = App.am.Messages.Add();
                            _message.Numbers = models[d].Numbers;
                            _message.Id = models[d].Id;
                            _message.Messages = models[d].Messages;
                            _message.Dor = DateTime.Now.ToString();
                            _message.Sent = "F";

                            _message.Save();

                        }
                        App.Current.Dispatcher.Invoke((Action)delegate()
                        {
                            Refresh();
                        });
                    }
                    catch
                    {
                        Console.WriteLine("server is taking long to respond");
                        App.Current.Dispatcher.Invoke((Action)delegate()
                        {
                            InputBlock.Text = InputBlock.Text + Environment.NewLine + "server is taking long to respond!";
                            Scroller.ScrollToBottom();
                            InputBlock.ScrollToEnd();
                        });

                    }
                }

            }


        }
开发者ID:WereDouglas,项目名称:amGateway,代码行数:97,代码来源:MessagePage.xaml.cs

示例9: ServiceConfigViewModel

 public ServiceConfigViewModel(ScenarioModel scenario)
 {
     if (scenario != null)
     {
         if (scenario.Map != null)
         {
             try
             {
                 Width = scenario.Map[0].Width;
                 Height = scenario.Map[0].Height;
                 if (scenario.Map[0].Substrate != null)
                 {
                     Background = new ImageBrush(Helpers.Imaging.ImageManager.BitmapToBitmapImage(scenario.Map[0].Substrate));
                 }
             }
             catch (NullReferenceException)
             {
                 Width = 800;
                 Height = 600;
                 Background = Brushes.LightCoral;
             }
         }
         if (scenario.Services != null)
         {
             _servicesOnMap = new ObservableCollection<ServiceModel>(scenario.Services);
             if (_servicesOnMap.Count > 0)
             {
                 _generator.Init(_servicesOnMap.Max(s => s.Id));
             }
         }
     }
 }
开发者ID:nomoreserious,项目名称:FlowSimulation,代码行数:32,代码来源:ServiceConfigViewModel.cs

示例10: BtnLoadJobs_Click

        private void BtnLoadJobs_Click(object sender, RoutedEventArgs e)
        {
            var openFileDialog = new OpenFileDialog
            {
                Multiselect = false,
                Title = "Select Job File"
            };

            if (openFileDialog.ShowDialog() == true)
            {
                try
                {
                    Jobs = new ObservableCollection<Job>(_jobBuilder.GetJobsFromFile(openFileDialog.FileName));
                    jobTable.ItemsSource = Jobs;

                    if (Jobs.Any(j => j.Type == JobType.Aperiodic))
                    {
                        RunTimeOfScheduling = (Jobs.Max(j => j.Deadline) + 1);
                    }
                    else
                    {
                        RunTimeOfScheduling = FindLeastCommonPeriod();
                    }

                    TxtRunTime.Text = RunTimeOfScheduling.ToString();

                    var u = MathHelpers.U(Jobs);
                    var m = MathHelpers.M(Jobs.Count);
                    var rm = u <= m;

                    TxtSchedulabilityValue.Text = string.Format("{0:0.000} <= {1:0.000}", u, m);
                    TxtSchedulability.Text = rm ? "(Schedulable)" : "(Not Schedulable)";
                    TxtSchedulability.Foreground = rm ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red);

                    CbSchedules.IsEnabled = true;
                    CreateScheduler();

                    Message(string.Format("Loaded {0} jobs successfully.", Jobs.Count()), true);
                }
                catch (Exception ex)
                {
                    Message("Couldn't load jobs from source. Please validate source file.", false);
                }
            }
        }
开发者ID:eardic,项目名称:EmbeddedSystemsRTScheduling,代码行数:45,代码来源:MainWindow.xaml.cs


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