當前位置: 首頁>>代碼示例>>C#>>正文


C# List.Equals方法代碼示例

本文整理匯總了C#中System.Windows.Documents.List.Equals方法的典型用法代碼示例。如果您正苦於以下問題:C# List.Equals方法的具體用法?C# List.Equals怎麽用?C# List.Equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Documents.List的用法示例。


在下文中一共展示了List.Equals方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddAlbumSets

        private void AddAlbumSets(List<AlbumUserControl> albumSets,WrapPanel wrapPanel)
        {
            //Getting fileNames in the directory which storage the paths of pictures
            string[] fileNames = GetFileNames(albumSets);
            //There is no files in the directory
            if(fileNames.Count()==0)
            {
                return;
            }

            //Creating AlbumSet
            foreach(string s in fileNames)
            {
                AlbumUserControl albumSet = CreateAlbumSet(wrapPanel, s);
                #region
                if (albumSets.Equals(familyAlbumSets))
                {
                    albumSet.BelongsTo = "familyAlbumSets";
                }

                else if (albumSets.Equals(travelAlbumSets))
                {
                    albumSet.BelongsTo = "travelAlbumSets";
                }

                else if (albumSets.Equals(sceneAlbumSets))
                {
                    albumSet.BelongsTo = "sceneAlbumSets";
                }

                else if (albumSets.Equals(campusAlbumSets))
                {
                    albumSet.BelongsTo = "campusAlbumSets";
                }

                else if (albumSets.Equals(personalAlbumSets))
                {
                    albumSet.BelongsTo = "personalAlbumSets";
                }

                ReadPicturePaths(albumSet);
                #endregion

                AlbumSet aSet = new AlbumSet();
                aSet.ImagePath = albumSet.PicturePathList[0];
                aSet.AlbumSetName = albumSet.Name;

                //Creating a new AlbumSet,
                //for the purpose to add the first picture as the AlbumSet's background
                AlbumUserControl userControl = new AlbumUserControl();
                userControl.Name = aSet.AlbumSetName;
                userControl.Content = aSet;
                userControl.ContentTemplate = (DataTemplate)FindResource("AlbumSetDataTemplate");
                userControl.IsSelected = true;
                userControl.PicturePathList = albumSet.PicturePathList;
                userControl.BelongsTo = albumSet.BelongsTo;
                userControl.MouseDown += albumUserControl_MouseDown;
                userControl.MouseDoubleClick += albumUserControl_MouseDoubleClick;

                albumSet = userControl;//Referencing to the new AlbumSet

                List<Image> pictureList=new List<Image>();
                foreach(string ss in albumSet.PicturePathList)
                {
                    Image i=new Image();
                    i.Source=new BitmapImage(new Uri(ss,UriKind.Absolute));
                    i.Stretch = Stretch.UniformToFill;
                    pictureList.Add(i);
               }
                albumSet.PictureList = pictureList;

                albumSets.Add(albumSet);

                UpdateAlbumSets(albumSets, wrapPanel);
            }
        }
開發者ID:RainbowYou,項目名稱:AlbumStorm,代碼行數:76,代碼來源:MainWindow.xaml.cs

示例2: GetFileNames

        private string[] GetFileNames(List<AlbumUserControl> albumsets)
        {
            string[] fileNames;
            List<string> files = new List<string>();
            if(albumsets.Equals(familyAlbumSets))
            {
                fileNames = Directory.GetFiles(@"familyAlbumSets");
                foreach(string s in fileNames)
                {
                    files.Add(System.IO.Path.GetFileNameWithoutExtension(s));
                }
            }

            else if(albumsets.Equals(travelAlbumSets))
            {
                fileNames = Directory.GetFiles(@"travelAlbumSets");
                foreach (string s in fileNames)
                {
                    files.Add(System.IO.Path.GetFileNameWithoutExtension(s));
                }
            }

            else if(albumsets.Equals(sceneAlbumSets))
            {
                fileNames = Directory.GetFiles(@"sceneAlbumSets");
                foreach (string s in fileNames)
                {
                    files.Add(System.IO.Path.GetFileNameWithoutExtension(s));
                }
            }

            else if(albumsets.Equals(campusAlbumSets))
            {
                fileNames = Directory.GetFiles(@"campusAlbumSets");
                foreach (string s in fileNames)
                {
                    files.Add(System.IO.Path.GetFileNameWithoutExtension(s));
                }
            }

            else if(albumsets.Equals(personalAlbumSets))
            {
                fileNames = Directory.GetFiles(@"personalAlbumSets");
                foreach (string s in fileNames)
                {
                    files.Add(System.IO.Path.GetFileNameWithoutExtension(s));
                }
            }
            return files.ToArray();
        }
開發者ID:RainbowYou,項目名稱:AlbumStorm,代碼行數:50,代碼來源:MainWindow.xaml.cs


注:本文中的System.Windows.Documents.List.Equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。