当前位置: 首页>>代码示例>>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;未经允许,请勿转载。