コード例 #1
0
 public void Add(IEnumerable <ColorableClass> nodes)
 {
     Last.Clear();
     First.Clear();
     foreach (var graphNode in nodes)
     {
         Add(graphNode);
     }
 }
コード例 #2
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects)
                    OriginalList?.Clear();
                    OriginalList = null;

                    DataPage?.Clear();
                    DataPage = null;

                    FilteredList?.Clear();
                    FilteredList = null;

                    ModelValueList?.Clear();
                    ModelValueList = null;

                    SortDictionary?.Clear();
                    SortDictionary = null;

                    FilterDictionary?.Clear();
                    FilterDictionary = null;
                }

                // TODO: free unmanaged resources (unmanaged objects) and override finalizer
                // TODO: set large fields to null
                disposedValue = true;
            }
        }
コード例 #3
0
        async Task SearchCommandExecute()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try {
                FilteredList.Clear();
                var tempRecords = students.Where(s => s.ToString().ToUpper().Contains(SearchedText.ToUpper()));
                foreach (var item in tempRecords)
                {
                    FilteredList.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
コード例 #4
0
        /// <summary>
        /// This method applies the filter value.
        /// </summary>
        protected void OnFilterInput()
        {
            //start with a new list
            if (FilteredList == null)
            {
                FilteredList = new List <T>();
            }
            else
            {
                FilteredList?.Clear();
            }

            //used when there are more than one filter values
            List <T> removeList = new List <T>();

            bool firstFilter = false;

            //for each filter input
            foreach (KeyValuePair <string, string> entry in FilterDictionary)
            {
                if (!string.IsNullOrWhiteSpace(entry.Value))
                {
                    if (!firstFilter)   //get all the matches for the first filter value
                    {
                        foreach (T item in OriginalList)
                        {
                            string columnValue = typeof(T).GetProperty(entry.Key)?.GetValue(item).AsString().Trim();
                            if (columnValue.Contains(entry.Value, StringComparison.CurrentCultureIgnoreCase))
                            {
                                FilteredList.Add(item);
                            }
                        }
                        firstFilter = FilteredList.Count > 0;
                    }
                    else
                    {
                        foreach (T item in FilteredList)    //for subsequent filter value build a list of items that do not match
                        {
                            string columnValue = typeof(T).GetProperty(entry.Key)?.GetValue(item).AsString().Trim();
                            if (!columnValue.Contains(entry.Value, StringComparison.CurrentCultureIgnoreCase))
                            {
                                removeList.Add(item);
                            }
                        }
                    }
                }
            }

            //remove the items that do not match the filters
            FilteredList = FilteredList.Except(removeList).ToList();

            //set the FilterActive flag
            FilterActive = FilteredList.Count > 0;

            SetPageCount(FilteredList);

            GetPage("first");
        }
コード例 #5
0
ファイル: MainViewModel.cs プロジェクト: wi15b004/FH-Test
 private void DeleteData(StockEntryViewModel selection)
 {
     FilteredSaleitems.Remove(selection);
     Saleitems.Remove(selection);
     FilteredList.Clear();
     FilteredList.Add(showAll);
     foreach (var item in Saleitems)
     {
         FilteredList.Add(item.Name);
     }
 }
コード例 #6
0
ファイル: ViewModel.cs プロジェクト: krisz094/osuExport
        public void BrowseForSource()
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.InitialDirectory = Source;
            dialog.Title            = "Please select your osu! executable.";
            dialog.Filter           = "osu! launcher (osu!.exe)|osu!.exe";
            DialogResult result = dialog.ShowDialog();

            if (result.ToString() == "OK")
            {
                Source   = dialog.FileName.Replace("osu!.exe", "");
                FileList = OsuSong.ParseAll(Source);
                FilteredList.Clear();
                foreach (OsuSong file in FileList)
                {
                    FilteredList.Add(file);
                }
                StreamWriter sw = new StreamWriter("path.dat", false, Encoding.Unicode);
                sw.Write(Source + "?" + Destination);
                sw.Close();
            }
        }
コード例 #7
0
        private void DoFilterStdList()
        {
            if (this.PreFilteredList.Count > 0)
            {
                this.PreFilteredList.Clear();
            }
            if (this.Slist.Count > 0)
            {
                switch (this.FilterCategory)
                {
                case "none":
                    this.PreFilteredList = this.Slist;
                    break;

                case "male":
                    var stdlst = from std in this.Slist
                                 where std.Sex == "M"
                                 select std;
                    foreach (Student item in stdlst)
                    {
                        this.PreFilteredList.Add(item);
                    }
                    break;

                case "female":
                    var stdlst2 = from std in this.Slist
                                  where std.Sex == "F"
                                  select std;
                    foreach (Student item in stdlst2)
                    {
                        this.PreFilteredList.Add(item);
                    }
                    break;

                default:
                    break;
                }

                if ((SchoolClasses[ClsIndex] == "XI" || SchoolClasses[ClsIndex] == "XII") && HsSubIndex != -1)
                {
                    if (this.FilteredList.Count > 0)
                    {
                        this.FilteredList.Clear();
                    }
                    if (PreFilteredList.Count > 0)
                    {
                        var stdList3 = from std in PreFilteredList
                                       where std.HsSub1 == HsActiveSubs[HsSubIndex] || std.HsSub2 == HsActiveSubs[HsSubIndex] || std.HsSub3 == HsActiveSubs[HsSubIndex] || std.HsAdlSub == HsActiveSubs[HsSubIndex]
                                       select std;

                        FilteredList.Clear();
                        foreach (Student item in stdList3)
                        {
                            FilteredList.Add(item);
                        }
                    }
                }
                else
                {
                    if (this.FilteredList.Count > 0)
                    {
                        this.FilteredList.Clear();
                    }
                    if (PreFilteredList.Count > 0)
                    {
                        foreach (var item in PreFilteredList)
                        {
                            FilteredList.Add(item);
                        }
                    }
                }
            }
        }