/// <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); }
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); }
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); } }
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); }
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); }
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); }
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(); }
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(); }
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(); }
public void SetUp() { fakeHeater = new FakeHeater(); fakeTempSensor = new FakeTempSensor(); fakeWindow = new FakeWindow(); }
public FakeStylusPlugIn(FakeWindow fakeWin) { FakeWin = fakeWin; }