public NativeTextBox(WindowHost form, INativeTextBoxControl control) { var bounds = control.Bounds.ToDrawing(); Visible = true; Location = Point.Empty; Size = new Size(200, 30); BorderStyle = BorderStyle.None; Multiline = false; BackColor = Color.White; ForeColor = Color.Black; MaxLength = control.MaxLength; form.Controls.Add(this); AcceptsReturn = true; Disposed += (o, e) => { form.Redraw(); }; Show(); Focus(); crossControl = control; Text = control.Text; }
public InProcDesignerView() { InitializeComponent(); DataContextChanged += OnDataContextChanged; WindowHostControl.Child = _host = new WindowHost(true); HandleVisibility(); HandleWindow(); }
public static void TearDown(TestContext testContext) { // Close the application and delete the session if (WindowHost != null) { WindowHost.Dispose(); WindowHost = null; } }
private IEnumerable <Sequence> ShowWindow(WindowHost host) { host.Opacity = 0; host.Show(); yield return(Sequence.WaitForNextFrame()); host.Opacity = 1; }
public InProcDesignerView(HostedAppModel appModel) { _appModel = appModel; InitializeComponent(); DataContext = _appModel; _appModel.PropertyChanged += ModelPropertyChanged; WindowHostControl.Child = _host = new WindowHost(true); HandleVisibility(); HandleWindow(); }
private void btnWindowHostLocal_Click(object sender, RibbonControlEventArgs e) { Int64 startTicks = Log.EVENT_HANDLER("Enter", Common.LOG_CATEGORY); WindowHost.DisplayUserControlInHost(ref windowHostLocal, "WindowHost (local) Test", Common.DEFAULT_WINDOW_WIDTH_SMALL, Common.DEFAULT_WINDOW_HEIGHT_SMALL, ShowWindowMode.Modeless_Show); Log.EVENT_HANDLER("Exit", Common.LOG_CATEGORY, startTicks); }
private void btnWindowHostLocal_Click(object sender, RibbonControlEventArgs e) { long startTicks = Log.EVENT_HANDLER("Enter", Common.PROJECT_NAME); WindowHost.DisplayUserControlInHost(ref windowHostLocal, "WindowHost (local) Test", Common.DEFAULT_WINDOW_WIDTH, Common.DEFAULT_WINDOW_HEIGHT, ShowWindowMode.Modeless_Show); Log.EVENT_HANDLER("Exit", Common.PROJECT_NAME, startTicks); }
private void InitializeUI() { FrameworkElement root = new WindowHost(); Window.Current.Content = root; // Handle flow direction ILocalizationService localizationService = Services.GetRequiredService <ILocalizationService>(); root.FlowDirection = localizationService.IsRightToLeftLanguage ? FlowDirection.RightToLeft : FlowDirection.LeftToRight; }
private void btnLaunchCylonn2_Click(object sender, RibbonControlEventArgs e) { long startTicks = Log.EVENT_HANDLER("Enter", Common.PROJECT_NAME); WindowHost.DisplayUserControlInHost(ref cylonHost, "I am a Cylon loaded by type", Common.DEFAULT_WINDOW_WIDTH_SMALL, Common.DEFAULT_WINDOW_HEIGHT_SMALL, ShowWindowMode.Modeless_Show, new CylonEyeBall()); Log.EVENT_HANDLER("Exit", Common.PROJECT_NAME, startTicks); }
private void btnLaunchCylon_Click(object sender, RibbonControlEventArgs e) { Int64 startTicks = Log.EVENT_HANDLER("Enter", Common.LOG_CATEGORY); WindowHost.DisplayUserControlInHost(ref cylonHost, "I am a Cylon loaded by name", Common.DEFAULT_WINDOW_WIDTH_SMALL, Common.DEFAULT_WINDOW_HEIGHT_SMALL, ShowWindowMode.Modeless_Show, "VNC.WPF.Presentation.Views.CylonEyeBall, VNC.WPF.Presentation"); Log.EVENT_HANDLER("Exit", Common.LOG_CATEGORY, startTicks); }
private object InitStage0(object frame) { IntPtr hwnd = EngineService.Instance.InitilalizeEngine(); windowhost = new WindowHost(hwnd); ModelSceneService.Instance.Initialize(); windowhost.WmResize += new ResizeEventHandler(windowHost_WmResize); windowhost.WmMouse += new MouseMessageHandler(windowHost_WmMouse); ((DispatcherFrame)frame).Continue = false; return(null); }
protected override void Dispose(bool disposing) { if (!_disposed) { if (_host != null) { _host.Dispose(); _host = null; } _disposed = true; } base.Dispose(disposing); }
private void Host_Disposed(object sender, EventArgs _) { if (sender is WindowHost wh) { wh.Disposed -= Host_Disposed; dispatcher.EnqueueAction(() => { windows.Remove(wh); if (MainWindowHost == wh) { MainWindowHost = null; MainWindow = null; } GC.Collect(2); }); } }
public DockContent(INiWindowPane windowPane, NiDockStyle dockStyle, NiToolWindowOrientation orientation) { if (windowPane == null) { throw new ArgumentNullException("windowPane"); } WindowPane = windowPane; DockStyle = dockStyle; Orientation = orientation; ShowIcon = false; switch (dockStyle) { case NiDockStyle.Document: DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Document; break; case NiDockStyle.Float: DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Document | WeifenLuo.WinFormsUI.Docking.DockAreas.Float; break; case NiDockStyle.AlwaysFloat: DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Float; break; default: DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.DockBottom | WeifenLuo.WinFormsUI.Docking.DockAreas.DockLeft | WeifenLuo.WinFormsUI.Docking.DockAreas.DockRight | WeifenLuo.WinFormsUI.Docking.DockAreas.DockTop; break; } _host = new WindowHost(this) { Dock = System.Windows.Forms.DockStyle.Fill }; Controls.Add(_host); }
public DockContent(INiWindowPane windowPane, NiDockStyle dockStyle, NiToolWindowOrientation orientation) { if (windowPane == null) throw new ArgumentNullException("windowPane"); WindowPane = windowPane; DockStyle = dockStyle; Orientation = orientation; ShowIcon = false; switch (dockStyle) { case NiDockStyle.Document: DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Document; break; case NiDockStyle.Float: DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Document | WeifenLuo.WinFormsUI.Docking.DockAreas.Float; break; case NiDockStyle.AlwaysFloat: DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Float; break; default: DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.DockBottom | WeifenLuo.WinFormsUI.Docking.DockAreas.DockLeft | WeifenLuo.WinFormsUI.Docking.DockAreas.DockRight | WeifenLuo.WinFormsUI.Docking.DockAreas.DockTop; break; } _host = new WindowHost(this) { Dock = System.Windows.Forms.DockStyle.Fill }; Controls.Add(_host); }
protected override INativeWindow CreateNativeWindow(Window window, CreateWindowMode createMode) { var host = new WindowHost(window, objectFactory, scaleProvider); switch (createMode) { case CreateWindowMode.MainWindow: var oldMain = MainWindow; MainWindowHost = host; MainWindowHost.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; MainWindow = window; oldMain?.Close(); GC.Collect(2); break; case CreateWindowMode.Global: if (MainWindowHost == null) { MainWindowHost = host; MainWindow = window; host.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; } break; case CreateWindowMode.Modal: host.ShowInTaskbar = false; host.MinimizeBox = false; host.ShowIcon = false; MainWindowHost.AddModal(host); break; } host.Disposed += Host_Disposed; windows.Add(host); sequencer.Run(ShowWindow(host)); return(host); }
public static void SetUp(TestContext testContext, Func <WindowHost> windowFactory) { WindowHost = windowFactory(); }