Esempio n. 1
0
        /// <summary>
        /// Returns the current monitor; if the monitor has not been selected yet, it returns the primary monitor
        /// </summary>
        /// <returns></returns>
        private MonitorInfo GetSelectedMonitor()
        {
            var monitor     = this.Monitor;
            var allMonitors = MonitorInfo.GetAllMonitors();

            if (monitor == null || !allMonitors.Contains(monitor))
            {
                monitor = allMonitors.First(f => f.IsPrimary);
            }
            return(monitor);
        }
Esempio n. 2
0
 public void GetMonitorInfoManifestHandled(bool manifestCheck)
 {
     if (manifestCheck)
     {
         Assert.Throws <NotSupportedException>(() => MonitorInfo.GetAllMonitors(manifestCheck));
     }
     else
     {
         Assert.DoesNotThrow(() => MonitorInfo.GetAllMonitors(manifestCheck), "Unexpected exception thrown");
     }
 }
Esempio n. 3
0
 public MainWindow()
 {
     InitializeComponent();
     this.cbEdge.ItemsSource = new[]
     {
         AppBarDockMode.Left,
         AppBarDockMode.Right,
         AppBarDockMode.Top,
         AppBarDockMode.Bottom
     };
     this.cbMonitor.ItemsSource = MonitorInfo.GetAllMonitors();
 }
Esempio n. 4
0
        private async Task OnShowAllMonitorInfoExecuteAsync()
        {
            try
            {
                var monitorInfos = MonitorInfo.GetAllMonitors();

                var monitorInfoMessage = string.Join <string>("\n\n", monitorInfos.Select(x =>
                                                                                          $"{x.DeviceNameFull}\n{x.FriendlyName}\nResolution: {x.ScreenWidth}x{x.ScreenHeight}\n" +
                                                                                          $"Working Area: {x.WorkingArea}\nDpi Scale: {x.DpiScale?.ToString() ?? "Undefined"}\n" +
                                                                                          $"\nEDID: {x.ManufactureCode} {x.ProductCodeId}"
                                                                                          ));

                await _messageService.ShowAsync(monitorInfoMessage);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }
Esempio n. 5
0
 private void ScanScreens()
 {
     System.Windows.Controls.ComboBoxItem autoItem = new System.Windows.Controls.ComboBoxItem()
     {
         Content = "Primary"
     };
     foreach (MonitorInfo mi in MonitorInfo.GetAllMonitors())
     {
         screenSelector.Items.Add(new System.Windows.Controls.ComboBoxItem()
         {
             Content = mi.FriendlyName, Tag = mi.Screen
         });
         if (mi.Screen.Primary)
         {
             autoItem.Tag = mi.Screen;
         }
     }
     screenSelector.Items.Insert(0, autoItem);
     screenSelector.SelectedIndex = 0;
     //TODO: Inject to all screens
     //screenSelector.Items.Add(new System.Windows.Controls.ComboBoxItem() { Content = "All" });
 }