public MainForm(bool isVisible) { InitializeComponent(); this.Width = Properties.Settings.Default.MainFormExBounds.Width; this.Height = Properties.Settings.Default.MainFormExBounds.Height; this.Top = Properties.Settings.Default.MainFormExBounds.Y; this.Left = Properties.Settings.Default.MainFormExBounds.X; this.WindowState = Properties.Settings.Default.WindowState; this.Loaded += delegate { if (!UiUtils.IsOnScreen(this)) { UiUtils.CenterWindow(this); } }; this.isVisible = isVisible; inputData = new MainViewModel(); this.DataContext = inputData; this.PreviewKeyDown += MainFormEx_PreviewKeyDown; this.PreviewKeyUp += MainFormEx_PreviewKeyUp; }
void PreviewView_Loaded(object sender, RoutedEventArgs e) { this.Left = Properties.Settings.Default.PreviewBounds.Left; this.Top = Properties.Settings.Default.PreviewBounds.Top; this.Width = Properties.Settings.Default.PreviewBounds.Width; this.Height = Properties.Settings.Default.PreviewBounds.Height; if (!UiUtils.IsOnScreen(this)) { UiUtils.CenterWindow(this); } }
void window_Loaded(object sender, RoutedEventArgs e) { StickyWindow = new StickyWindow(this); StickyWindow.StickToScreen = true; StickyWindow.StickToOther = true; StickyWindow.StickOnResize = true; StickyWindow.StickOnMove = true; StickyWindow.MoveStuckTogether = false; if (!UiUtils.IsOnScreen(this)) { UiUtils.CenterWindow(this); } }
public MainFormEx(bool isVisible) { InitializeComponent(); this.Width = Properties.Settings.Default.Width; this.Height = Properties.Settings.Default.Height; this.Top = Properties.Settings.Default.Top; this.Left = Properties.Settings.Default.Left; if (!UiUtils.IsOnScreen(this)) { UiUtils.CenterWindow(this); } this.isVisible = isVisible; inputData = new MainViewModel(); this.DataContext = inputData; }