EndSelection() public méthode

選択処理を終了してコントロールを隠す。
public EndSelection ( ) : void
Résultat void
Exemple #1
0
        public void EndSelection_Test()
        {
            using (var twitter = new Twitter())
                using (var mediaSelector = new MediaSelector {
                    Visible = false, Enabled = false
                })
                {
                    twitter.Initialize("", "", "", 0L);
                    mediaSelector.Initialize(twitter, TwitterConfiguration.DefaultConfiguration(), "Twitter");
                    mediaSelector.BeginSelection(new[] { "Resources/re.gif" });

                    var displayImage = mediaSelector.ImageSelectedPicture.Image; // 表示中の画像

                    Assert.Raises <EventArgs>(
                        x => mediaSelector.EndSelecting += x,
                        x => mediaSelector.EndSelecting -= x,
                        () => mediaSelector.EndSelection()
                        );

                    Assert.False(mediaSelector.Visible);
                    Assert.False(mediaSelector.Enabled);

                    Assert.True(displayImage.IsDisposed);
                }
        }
        public void EndSelection_Test()
        {
            using (var twitter = new Twitter())
            using (var mediaSelector = new MediaSelector { Visible = false, Enabled = false })
            {
                twitter.Initialize("", "", "", 0L);
                mediaSelector.Initialize(twitter, TwitterConfiguration.DefaultConfiguration(), "Twitter");
                mediaSelector.BeginSelection(new[] { "Resources/re.gif" });

                var displayImage = mediaSelector.ImageSelectedPicture.Image; // 表示中の画像

                var eventCalled = false;
                mediaSelector.EndSelecting += (o, e) => eventCalled = true;

                mediaSelector.EndSelection();

                Assert.True(eventCalled);

                Assert.False(mediaSelector.Visible);
                Assert.False(mediaSelector.Enabled);

                Assert.True(displayImage.IsDisposed);
            }
        }