Example #1
0
        public WindowImpl(string title)
        {
            Background = Brushes.HotPink;
            UseLayoutRounding = true;
            Title = title;            

            Grid = new Grid()
            {
                UseLayoutRounding = true,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment = VerticalAlignment.Stretch,
            };
            
            this.AddChild(Grid);

            KeyDownEvents = Observable.FromEvent<KeyEventArgs>(this, "KeyDown").Select(e => e.EventArgs);
            KeyUpEvents = Observable.FromEvent<KeyEventArgs>(this, "KeyUp").Select(e => e.EventArgs);
            MouseMoveEvents = Observable.FromEvent<MouseEventArgs>(this, "MouseMove").Select(e => e.EventArgs.GetPosition(Grid).ToXna());
            MouseDownEvents = Observable.FromEvent<MouseButtonEventArgs>(this, "MouseDown").Select(e => e.EventArgs.GetPosition(Grid).ToXna());
            MouseUpEvents = Observable.FromEvent<MouseButtonEventArgs>(this, "MouseUp").Select(e => e.EventArgs.GetPosition(Grid).ToXna());

            KeyDownEvents.Where(e => e.Key == Key.F).Subscribe(ie => this.Fullscreen = this.Fullscreen == null ? Screen.PrimaryScreen : null);
            
            MaybeFullscreen = null;
            Hwnd = new WindowInteropHelper(this).EnsureHandle();            
            Show();
        }
Example #2
0
 public Screen(System.Windows.Forms.Screen screen)
 {
     FScreen = screen;
     Dpi = this.GetDpi();
     Scaling = (float)Dpi / DEFAULT_DPI;
     Watch();
 }
Example #3
0
 protected override void OnStartup(StartupEventArgs e)
 {
     DoResize = true;
     MoveToScreen = System.Windows.Forms.Screen.PrimaryScreen;
     if (_hook == null)
         _hook = new ShellHook();
     base.OnStartup(e);
 }
Example #4
0
        static TuioContact()
        {
            //get monitor settings 
            // Try to position application to first non-primary monitor
            foreach (var screen in System.Windows.Forms.Screen.AllScreens)
            {
                if (!screen.Primary)
                {
                    secondaryScreen = screen;

                    Console.WriteLine("TUIO Contacts: Secondary screen found at " + secondaryScreen.WorkingArea.ToString());
                    break;
                }
            }
        }
        private OverlayWindow()
        {
            InitializeComponent();

            primaryScreen = DeviceUtil.GetScreen(Settings.Default.primaryMonitor);

            Settings.Default.PropertyChanged += SettingsChanged;
            SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;

            this.baseGrid.Visibility = Visibility.Hidden;
            this.layoutChooserOverlay.Visibility = Visibility.Hidden;

            //Compensate for DPI settings

            Loaded += (o, e) =>
            {
                //PresentationSource source = PresentationSource.FromVisual(this);
                //CompositionTarget ct = source.CompositionTarget;
                //Matrix transformMatrix = ct.TransformFromDevice;
                //this.baseCanvas.RenderTransform = new MatrixTransform(transformMatrix);

                this.updateWindowToScreen(primaryScreen);
            };
        }
 private void SystemEvents_DisplaySettingsChanged(object sender, EventArgs e)
 {
     this.primaryScreen = DeviceUtils.DeviceUtil.GetScreen(Settings.Default.primaryMonitor);
     Dispatcher.BeginInvoke(new Action(delegate()
     {
         this.updateWindowToScreen(primaryScreen);
     }));
 }
 private void SettingsChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "primaryMonitor")
     {
         primaryScreen = DeviceUtil.GetScreen(Settings.Default.primaryMonitor);
         Dispatcher.BeginInvoke(new Action(delegate()
         {
             this.updateWindowToScreen(primaryScreen);
         }));
     }
 }
Example #8
0
 private Screen(System.Windows.Forms.Screen screen)
 {
     this.screen = screen;
 }