private void ShowDisplayDiagnostics()
        {
            var details = DisplayDetails.GetMonitorDetails();

            #region Diagnostics
            Debug.WriteLine("****************** GetWorkingArea: {0}", Screen.GetWorkingArea(new System.Drawing.Point(0, 0)));
            Debug.WriteLine("****************** GetBounds: {0}", Screen.GetBounds(new System.Drawing.Point(0, 0)));
            Debug.WriteLine("****************** Primary Screen: {0}", Screen.PrimaryScreen.DeviceName, 0);
            Debug.WriteLine("****************** EntireDesktop Res: {0}", ScreenHelpers.GetEntireDesktopArea(), 0);
            foreach (var displayDetails in details)
            {
                Debug.WriteLine("DETAILS:");
                Debug.WriteLine("\t\tAvailability: {0}", displayDetails.Availability);
                Debug.WriteLine("\t\tModel: {0}", displayDetails.Model, 0);
                Debug.WriteLine("\t\tMonitorID: {0}", displayDetails.MonitorID, 0);
                Debug.WriteLine("\t\tPixelHeight: {0}", displayDetails.PixelHeight, 0);
                Debug.WriteLine("\t\tPixelWidth: {0}", displayDetails.PixelWidth);
                Debug.WriteLine("\t\tPnPID: {0}", displayDetails.PnPID, 0);
                Debug.WriteLine("\t\tSerialNumber: {0}", displayDetails.SerialNumber, 0);
            }
            Debug.WriteLine("********* SCREENS *********");
            var screens = Screen.AllScreens;
            foreach (var screen in screens)
            {
                Debug.WriteLine("SCREEN:");
                Debug.WriteLine("\t\tBitsPerPixel: {0}", screen.BitsPerPixel, 0);
                Debug.WriteLine("\t\tBounds: {0}", screen.Bounds, 0);
                Debug.WriteLine("\t\tDeviceName: {0}", screen.DeviceName, 0);
                Debug.WriteLine("\t\tPrimary: {0}", screen.Primary, 0);
                Debug.WriteLine("\t\tWorkingArea: {0}", screen.WorkingArea, 0);
            }
            #endregion
        }
        public static DisplayDetails GetMonitorInformation(string dbcc_name)
        {
            DisplayDetails details = DisplayDetails.GetMonitorDetails().Where(x => dbcc_name.ToLower().Contains(x.PnPID.ToLower())).FirstOrDefault();



            return(details);
        }
Ejemplo n.º 3
0
        public void GetScreens()
        {
            _screenCollection.Clear();
            foreach (Screen screen in Screen.AllScreens)
            {
                const int dwf         = 0;
                var       info        = new DISPLAY_DEVICE();
                string    monitorname = null;
                string    deviceId    = null;
                info.cb = Marshal.SizeOf(info);
                if (EnumDisplayDevices(screen.DeviceName, 0, info, dwf))
                {
                    monitorname = info.DeviceString;
                    deviceId    = info.DeviceID;
                }
                if (monitorname == null)
                {
                    monitorname = "";
                }
                if (deviceId == null)
                {
                    deviceId = "";
                }

                foreach (AdapterInformation adapter in Manager.Adapters)
                {
                    bool detectedId = false;
                    if (screen.DeviceName.Equals(adapter.Information.DeviceName.Trim()))
                    {
                        foreach (var display in DisplayDetails.GetMonitorDetails())
                        {
                            // double check to add display with name from extracted EDID
                            if (("MONITOR" + "\\" + display.MonitorID + "\\" + display.DriverID).Equals(info.DeviceID))
                            {
                                _screenCollection.Add(
                                    new Tuple <string, string, string>((
                                                                           string.Format("{0} ({1}x{2}) on {3}", display.Model, adapter.CurrentDisplayMode.Width,
                                                                                         adapter.CurrentDisplayMode.Height, adapter.Information.Description)), deviceId, adapter.Information.DeviceName.Trim()));
                                detectedId = true;
                                break;
                            }
                        }
                        if (!detectedId)
                        {
                            _screenCollection.Add(
                                new Tuple <string, string, string>((
                                                                       string.Format("{0} ({1}x{2}) on {3}", monitorname, adapter.CurrentDisplayMode.Width,
                                                                                     adapter.CurrentDisplayMode.Height, adapter.Information.Description)), deviceId, adapter.Information.DeviceName.Trim()));
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// reads maze name from user input
        /// </summary>
        /// <returns>maze name</returns>
        public string GetMazeName()
        {
            DisplayDetails dd = new DisplayDetails();

            dd.ShowDialog();
            string mazeName = dd.MazeName;

            CurrMaze.Text         = "        " + mazeName;
            curr_maze.Visibility  = System.Windows.Visibility.Visible;
            CurrMaze.Visibility   = Visibility.Visible;
            curr_floor.Visibility = Visibility.Visible;
            CurrFloor.Visibility  = Visibility.Visible;

            return(mazeName);
        }
Ejemplo n.º 5
0
        private DisplayDetails AddItemDetail(string sn, string Fullname, string Company, string Email, string PhoneNumber, string HostName, DateTime DateCheckedIn, DateTime DateCheckedOut,
                                             string Status, string InvitationCode, string Signature, string ThumbPrint, BitmapImage PhotoCopy)
        {
            var AddItem = new DisplayDetails();

            AddItem.sn                = sn;
            AddItem.GuestFullName     = Fullname;
            AddItem.GuestCompany      = Company;
            AddItem.GuestEmail        = Email;
            AddItem.GuestPhoneNumber  = PhoneNumber;
            AddItem.GuestHostName     = HostName;
            AddItem.GuestCheckInTime  = DateCheckedIn;
            AddItem.GuestCheckOutTime = DateCheckedOut;
            AddItem.GuestStatus       = Status;
            AddItem.GuestCheckInCode  = InvitationCode;
            AddItem.GuestSignature    = Signature;
            AddItem.GuestThumbPrint   = ThumbPrint;
            AddItem.Picture           = PhotoCopy;
            return(AddItem);
        }
        public override void LoadSettings()
        {
            int       indexAdapter   = 0;
            DataTable dtblDataSource = new DataTable();

            dtblDataSource.Columns.Add("DisplayMember");
            dtblDataSource.Columns.Add("ValueMember");
            dtblDataSource.Columns.Add("AdditionalInfo");
            dtblDataSource.Columns.Add("MonitorDisplayName");
            cbScreen.DataSource.SafeDispose();
            cbScreen.Items.Clear();
            cbScreen.DataSource    = dtblDataSource;
            cbScreen.DisplayMember = "DisplayMember";
            cbScreen.ValueMember   = "ValueMember";

            foreach (Screen screen in Screen.AllScreens)
            {
                const int dwf         = 0;
                var       info        = new DISPLAY_DEVICE();
                string    monitorname = null;
                string    deviceId    = null;
                info.cb = Marshal.SizeOf(info);
                if (EnumDisplayDevices(screen.DeviceName, 0, ref info, dwf))
                {
                    monitorname = info.DeviceString;
                    deviceId    = info.DeviceID;
                }
                if (monitorname == null)
                {
                    monitorname = "";
                }
                if (deviceId == null)
                {
                    deviceId = "";
                }

                foreach (AdapterInformation adapter in Manager.Adapters)
                {
                    bool detectedId = false;
                    if (screen.DeviceName.Equals(adapter.Information.DeviceName.Trim()))
                    {
                        foreach (var display in DisplayDetails.GetMonitorDetails())
                        {
                            // double check to add display with name from extracted EDID
                            if (("MONITOR" + "\\" + display.MonitorID + "\\" + display.DriverID).Equals(info.DeviceID))
                            {
                                if (!string.IsNullOrEmpty(display.Model))
                                {
                                    dtblDataSource.Rows.Add(string.Format("{0} ({1}x{2}) on {3} - Screen Primary : {4}", display.Model,
                                                                          adapter.CurrentDisplayMode.Width, adapter.CurrentDisplayMode.Height, adapter.Information.Description, screen.Primary ? "Yes" : "No"),
                                                            indexAdapter, info.DeviceID, adapter.Information.DeviceName.Trim());
                                    indexAdapter++;
                                    detectedId = true;
                                    break;
                                }
                                dtblDataSource.Rows.Add(string.Format("{0} ({1}x{2}) on {3} - Screen Primary : {4}", monitorname,
                                                                      adapter.CurrentDisplayMode.Width, adapter.CurrentDisplayMode.Height, adapter.Information.Description, screen.Primary ? "Yes" : "No"),
                                                        indexAdapter, info.DeviceID, adapter.Information.DeviceName.Trim());
                                indexAdapter++;
                                detectedId = true;
                                break;
                            }
                        }
                        if (!detectedId)
                        {
                            dtblDataSource.Rows.Add(string.Format("{0} ({1}x{2}) on {3} - Screen Primary : {4}", monitorname,
                                                                  adapter.CurrentDisplayMode.Width, adapter.CurrentDisplayMode.Height, adapter.Information.Description, screen.Primary ? "Yes" : "No"),
                                                    indexAdapter, deviceId, adapter.Information.DeviceName.Trim());
                            indexAdapter++;
                            break;
                        }
                    }
                }
            }

            using (Settings xmlreader = new MPSettings())
            {
                // Load general settings
                for (int index = 0; index < _sectionEntries.Length; index++)
                {
                    string[] currentSection = _sectionEntries[index];
                    settingsCheckedListBox.SetItemChecked(index, xmlreader.GetValueAsBool(currentSection[0], currentSection[1], bool.Parse(currentSection[2])));
                }

                _screennumber     = xmlreader.GetValueAsInt("screenselector", "screennumber", 0);
                _screenDeviceId   = xmlreader.GetValueAsString("screenselector", "screendeviceid", "");
                _usePrimaryScreen = xmlreader.GetValueAsBool("general", "useprimaryscreen", false);

                while (cbScreen.Items.Count <= _screennumber)
                {
                    dtblDataSource.Rows.Add("screen nr :" + cbScreen.Items.Count + " (currently unavailable)");
                }

                for (int index = 0; index < cbScreen.Items.Count; index++)
                {
                    //Get additional info for selected item
                    var dataRowView = cbScreen.Items[index] as DataRowView;
                    if (dataRowView != null)
                    {
                        string screenDeviceId = dataRowView["AdditionalInfo"].ToString();
                        if (screenDeviceId.Equals(_screenDeviceId))
                        {
                            cbScreen.SelectedIndex = index;
                            _screennumber          = index;
                        }
                    }
                }

                // Check if screen are present and if not force to use primary screen
                if (cbScreen.SelectedIndex == -1)
                {
                    cbScreen.SelectedIndex = 0;
                }

                if (_usePrimaryScreen)
                {
                    cbScreen.Enabled = false;
                }

                nudDelay.Value = xmlreader.GetValueAsInt("general", "delay", 0);
                mpCheckBoxMpStartup.Checked = xmlreader.GetValueAsBool("general", "delay startup", false);
                mpCheckBoxMpResume.Checked  = xmlreader.GetValueAsBool("general", "delay resume", false);
            }

            // On single seat WaitForTvService is forced enabled !
            cbWaitForTvService.Checked = Network.IsSingleSeat();
        }