コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: ping11700/LOLSkin
        /// <summary>
        /// 获取窗体句柄
        /// </summary>
        /// <returns></returns>
        private FakeClientWindow GetClientWindow()
        {
            List <FakeWindow> windows = Helper.GetWindows(Constances.TCLS_ROOT_CLIENT_Name, Constances.TCLS_ROOT_CLIENT_Title);

            //List<FakeWindow> windows = Helper.GetWindows(Constances.ROOT_CLIENT_CLASS, null);

            foreach (FakeWindow window in windows)
            {
                FakeWindow child = window.FindChildRecursively(window.Handle, null, null);

                if (child == null)
                {
                    continue;
                }

                FakeClientWindow fcw = new FakeClientWindow(window.Handle, window.Parent, window.ClassName, window.Name, child);

                fcw.RefreshStatus();

                if (fcw.IsMatch)
                {
                    return(fcw);
                }
            }

            return(null);
        }
コード例 #2
0
        public void WindowHasCorrectOwner(WindowInitiator sut)
        {
            var windowType  = typeof(FakeWindow);
            var ownerWindow = new FakeWindow {
                WindowState = WindowState.Minimized
            };

            ownerWindow.Show();

            var actual = sut.Initialize(windowType, null, ownerWindow);

            Assert.Same(ownerWindow, actual.Owner);
        }
コード例 #3
0
        internal static async void OpenFullscreenGallery(bool startup = false)
        {
            if (Pics.Count < 1 && !startup)
            {
                return;
            }

            Properties.Settings.Default.PicGallery = 2;
            LoadLayout();

            if (GetFakeWindow == null)
            {
                GetFakeWindow = new FakeWindow();
                GetFakeWindow.grid.Children.Add(new Views.UserControls.Gallery.PicGalleryTopButtons
                {
                    Margin = new Thickness(1, 12, 0, 0),
                });
            }

            // Switch gallery container to the correct window
            if (GetMainWindow.ParentContainer.Children.Contains(GetPicGallery))
            {
                GetMainWindow.ParentContainer.Children.Remove(GetPicGallery);
                GetFakeWindow.grid.Children.Add(GetPicGallery);
            }
            else if (!GetFakeWindow.grid.Children.Contains(GetPicGallery))
            {
                GetFakeWindow.grid.Children.Add(GetPicGallery);
            }

            GetFakeWindow.Show();
            GalleryNavigation.ScrollTo();
            GetMainWindow.Focus();

            if (!FreshStartup)
            {
                ScaleImage.TryFitImage();
            }

            // Fix not showing up opacity bug..
            VisualStateManager.GoToElementState(GetPicGallery, "Opacity", false);
            VisualStateManager.GoToElementState(GetPicGallery.Container, "Opacity", false);
            GetPicGallery.Opacity = GetPicGallery.Container.Opacity = 1;

            if (GetPicGallery.Container.Children.Count == 0)
            {
                await Load().ConfigureAwait(false);
            }
        }
コード例 #4
0
        public void ShowsTheWindowBeforeReturningIt()
        {
            // Arrange
            FakeWindow window = new FakeWindow();

            ContainerBuilder builder = new ContainerBuilder();

            builder.RegisterInstance(window);
            IContainer container = builder.Build();

            OWRankTracker.Services.Wpf.WindowService service = new OWRankTracker.Services.Wpf.WindowService(container);

            // Act
            FakeWindow actual = service.ShowWindow <FakeWindow>();

            // Assert
            Assert.IsTrue(actual.IsVisible);
        }
コード例 #5
0
        public void UsesTheInjectedContainer_ToGetANewInstanceOfTheWindowType()
        {
            // Arrange
            FakeWindow window = new FakeWindow();

            ContainerBuilder builder = new ContainerBuilder();

            builder.RegisterInstance(window);
            IContainer container = builder.Build();

            OWRankTracker.Services.Wpf.WindowService service = new OWRankTracker.Services.Wpf.WindowService(container);

            // Act
            FakeWindow actual = service.ShowWindow <FakeWindow>();

            // Assert
            Assert.AreSame(window, actual);
        }
コード例 #6
0
        public void ShowWindow_WithOwner_SetsTheArgumentAsTheOwnerOfTheResolvedWindow()
        {
            // Arrange
            FakeWindow window = new FakeWindow();
            FakeWindow parent = new FakeWindow();

            parent.Show(); // A parent window must be shown

            ContainerBuilder builder = new ContainerBuilder();

            builder.RegisterInstance(window);
            IContainer container = builder.Build();

            OWRankTracker.Services.Wpf.WindowService service = new OWRankTracker.Services.Wpf.WindowService(container);

            // Act
            FakeWindow actual = service.ShowWindow <FakeWindow>(parent);

            // Assert
            Assert.AreEqual(actual.Owner, parent);
        }
コード例 #7
0
        internal static void ChangeToPicGalleryTwo()
        {
            Properties.Settings.Default.PicGallery = 2;
            LoadLayout();

            if (GetFakeWindow != null)
            {
                if (!GetFakeWindow.grid.Children.Contains(GetPicGallery))
                {
                    GetMainWindow.ParentContainer.Children.Remove(GetPicGallery);
                    GetFakeWindow.grid.Children.Add(GetPicGallery);
                }
            }
            else
            {
                GetMainWindow.ParentContainer.Children.Remove(GetPicGallery);
                GetFakeWindow = new FakeWindow();
                GetFakeWindow.grid.Children.Add(GetPicGallery);
            }

            GetFakeWindow.Show();
            GalleryNavigation.ScrollTo();
            GetMainWindow.Focus();
        }
コード例 #8
0
        static void OpenPicGalleryTwo()
        {
            LoadLayout();

            if (fake != null)
            {
                if (!fake.grid.Children.Contains(picGallery))
                {
                    mainWindow.bg.Children.Remove(picGallery);
                    fake.grid.Children.Add(picGallery);
                }
            }
            else
            {
                mainWindow.bg.Children.Remove(picGallery);
                fake = new FakeWindow();
                fake.grid.Children.Add(picGallery);
            }

            fake.Show();
            IsOpen = true;
            ScrollTo();
            mainWindow.Focus();
        }
コード例 #9
0
        static void ChangeToPicGalleryTwo()
        {
            Properties.Settings.Default.PicGallery = 2;
            LoadLayout();

            if (fake != null)
            {
                if (!fake.grid.Children.Contains(picGallery))
                {
                    mainWindow.bg.Children.Remove(picGallery);
                    fake.grid.Children.Add(picGallery);
                }
            }
            else
            {
                mainWindow.bg.Children.Remove(picGallery);
                fake = new FakeWindow();
                fake.grid.Children.Add(picGallery);
            }

            fake.Show();
            ScrollTo();
            mainWindow.Focus();
        }
コード例 #10
0
ファイル: UnitTest1.cs プロジェクト: BestGroup14/ECS
 public void SetUp()
 {
     fakeHeater     = new FakeHeater();
     fakeTempSensor = new FakeTempSensor();
     fakeWindow     = new FakeWindow();
 }
コード例 #11
0
ファイル: FakeStylusPlugIn.cs プロジェクト: netcharm/PixivWPF
 public FakeStylusPlugIn(FakeWindow fakeWin)
 {
     FakeWin = fakeWin;
 }