Пример #1
0
        private void SetupListViewColumns()
        {
            this.driverSizeColumn.AspectToStringConverter = size => DriverStoreEntry.GetBytesReadable((long)size);

            this.driverOemInfColumn.GroupKeyGetter           = rowObject => ((DriverStoreEntry)rowObject).OemId / 10;
            this.driverOemInfColumn.GroupKeyToTitleConverter = groupKey =>
            {
                int?valueBase = (groupKey as int?) * 10;

                return(valueBase == null
                    ? null
                    : $"oem {valueBase} - {valueBase + 9}");
            };

            this.driverVersionColumn.GroupKeyGetter = rowObject =>
            {
                DriverStoreEntry driver = (DriverStoreEntry)rowObject;
                return(new Version(driver.DriverVersion.Major, driver.DriverVersion.Minor));
            };

            this.driverDateColumn.GroupKeyGetter = rowObject =>
            {
                DriverStoreEntry driver = (DriverStoreEntry)rowObject;
                return(new DateTime(driver.DriverDate.Year, driver.DriverDate.Month, 1));
            };

            this.driverDateColumn.GroupKeyToTitleConverter = groupKey => ((DateTime)groupKey).ToString("yyyy-MM");

            this.driverSizeColumn.GroupKeyGetter =
                rowObject => DriverStoreEntry.GetSizeRange(((DriverStoreEntry)rowObject).DriverSize);

            this.driverSizeColumn.GroupKeyToTitleConverter =
                groupKey => DriverStoreEntry.GetSizeRangeName((long)groupKey);
        }
Пример #2
0
        public DSEForm()
        {
            if (!IsOSSupported())
            {
                MessageBox.Show(Language.Message_Requires_Later_OS, Language.Product_Name, MessageBoxButtons.OK, MessageBoxIcon.Information);
                Application.Exit();
            }

            var lang = Properties.Settings.Default.Language;

            if (lang != null && CultureInfo.InvariantCulture != lang)
            {
                Thread.CurrentThread.CurrentCulture   = lang;
                Thread.CurrentThread.CurrentUICulture = lang;
            }

            this.InitializeComponent();

            this.Icon = ExtractAssociatedIcon(Application.ExecutablePath);
            this.BuildLanguageMenu();

            this.lstDriverStoreEntries.PrimarySortColumn   = this.driverClassColumn;
            this.lstDriverStoreEntries.PrimarySortOrder    = SortOrder.Ascending;
            this.lstDriverStoreEntries.SecondarySortColumn = this.driverDateColumn;
            this.lstDriverStoreEntries.SecondarySortOrder  = SortOrder.Descending;
            this.lstDriverStoreEntries.CheckBoxes          = isRunAsAdministrator;
            this.driverSizeColumn.AspectToStringConverter  = size => DriverStoreEntry.GetBytesReadable((long)size);

            this.driverVersionColumn.GroupKeyGetter = (object rowObject) =>
            {
                DriverStoreEntry driver = (DriverStoreEntry)rowObject;
                return(new Version(driver.DriverVersion.Major, driver.DriverVersion.Minor));
            };

            this.driverDateColumn.GroupKeyGetter = (object rowObject) =>
            {
                DriverStoreEntry driver = (DriverStoreEntry)rowObject;
                return(new DateTime(driver.DriverDate.Year, driver.DriverDate.Month, 1));
            };

            this.driverDateColumn.GroupKeyToTitleConverter = (object groupKey) => ((DateTime)groupKey).ToString("yyyy-MM");

            this.driverSizeColumn.GroupKeyGetter = (object rowObject) =>
            {
                DriverStoreEntry driver = (DriverStoreEntry)rowObject;
                return(DriverStoreEntry.GetSizeRange(driver.DriverSize));
            };

            this.driverSizeColumn.GroupKeyToTitleConverter = (object groupKey) => DriverStoreEntry.GetSizeRangeName((long)groupKey);

            Trace.TraceInformation("---------------------------------------------------------------");
            Trace.TraceInformation($"{Application.ProductName} started");

            this.driverStore = new PNPUtil();
        }
Пример #3
0
        public DSEForm()
        {
            if (!IsOSSupported())
            {
                MessageBox.Show("This utility cannot be run in pre-Vista OS", "Rapr", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Application.Exit();
            }

            InitializeComponent();

            this.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);

            lstDriverStoreEntries.PrimarySortColumn   = this.driverClassColumn;
            lstDriverStoreEntries.PrimarySortOrder    = SortOrder.Ascending;
            lstDriverStoreEntries.SecondarySortColumn = this.driverDateColumn;
            lstDriverStoreEntries.SecondarySortOrder  = SortOrder.Descending;
            lstDriverStoreEntries.CheckBoxes          = isRunAsAdministrator;
            driverSizeColumn.AspectToStringConverter  = size => DriverStoreEntry.GetBytesReadable((long)size);

            this.driverVersionColumn.GroupKeyGetter = delegate(object rowObject)
            {
                DriverStoreEntry driver = (DriverStoreEntry)rowObject;
                return(new Version(driver.DriverVersion.Major, driver.DriverVersion.Minor));
            };

            this.driverDateColumn.GroupKeyGetter = delegate(object rowObject)
            {
                DriverStoreEntry driver = (DriverStoreEntry)rowObject;
                return(new DateTime(driver.DriverDate.Year, driver.DriverDate.Month, 1));
            };

            this.driverDateColumn.GroupKeyToTitleConverter = delegate(object groupKey)
            {
                return(((DateTime)groupKey).ToString("yyyy-MM"));
            };

            this.driverSizeColumn.GroupKeyGetter = delegate(object rowObject)
            {
                DriverStoreEntry driver = (DriverStoreEntry)rowObject;
                return(DriverStoreEntry.GetSizeRange(driver.DriverSize));
            };

            this.driverSizeColumn.GroupKeyToTitleConverter = delegate(object groupKey)
            {
                return(DriverStoreEntry.GetSizeRangeName((long)groupKey));
            };

            Trace.TraceInformation("---------------------------------------------------------------");
            Trace.TraceInformation($"{Application.ProductName} started");

            driverStore = new PNPUtil();
        }
Пример #4
0
        public DSEForm()
        {
            InitializeComponent();

            lstDriverStoreEntries.PrimarySortColumn   = this.driverClassColumn;
            lstDriverStoreEntries.PrimarySortOrder    = SortOrder.Ascending;
            lstDriverStoreEntries.SecondarySortColumn = this.driverDateColumn;
            lstDriverStoreEntries.SecondarySortOrder  = SortOrder.Descending;
            lstDriverStoreEntries.CheckBoxes          = isRunAsAdministrator;
            driverSizeColumn.AspectToStringConverter  = size => DriverStoreEntry.GetBytesReadable((long)size);

            this.driverVersionColumn.GroupKeyGetter = delegate(object rowObject)
            {
                DriverStoreEntry driver = (DriverStoreEntry)rowObject;
                return(new Version(driver.DriverVersion.Major, driver.DriverVersion.Minor));
            };

            this.driverDateColumn.GroupKeyGetter = delegate(object rowObject)
            {
                DriverStoreEntry driver = (DriverStoreEntry)rowObject;
                return(new DateTime(driver.DriverDate.Year, driver.DriverDate.Month, 1));
            };

            this.driverDateColumn.GroupKeyToTitleConverter = delegate(object groupKey)
            {
                return(((DateTime)groupKey).ToString("yyyy-MM"));
            };

            this.driverSizeColumn.GroupKeyGetter = delegate(object rowObject)
            {
                DriverStoreEntry driver = (DriverStoreEntry)rowObject;
                return(DriverStoreEntry.GetSizeRange(driver.DriverSize));
            };

            this.driverSizeColumn.GroupKeyToTitleConverter = delegate(object groupKey)
            {
                return(DriverStoreEntry.GetSizeRangeName((long)groupKey));
            };

            AppContext.MainForm = this;
            AppContext.EnableLogging();
            driverStore = AppContext.GetDriverStoreHandler();
            if (!AppContext.IsOSSupported())
            {
                MessageBox.Show("This utility cannot be run in pre-Vista OS", "Rapr", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Application.Exit();
            }
        }
Пример #5
0
        private void SetupListViewColumns()
        {
            this.driverExtensionIdColumn.AspectToStringConverter = id => (Guid)id == Guid.Empty ? String.Empty : id.ToString();
            this.driverSizeColumn.AspectToStringConverter        = size => DriverStoreEntry.GetBytesReadable((long)size);

            this.driverOemInfColumn.GroupKeyGetter           = rowObject => ((DriverStoreEntry)rowObject).OemId / 10;
            this.driverOemInfColumn.GroupKeyToTitleConverter = groupKey =>
            {
                int?valueBase = (groupKey as int?) * 10;

                return(valueBase == null
                    ? null
                    : $"oem {valueBase} - {valueBase + 9}");
            };

            this.driverVersionColumn.GroupKeyGetter = rowObject =>
            {
                DriverStoreEntry driver = (DriverStoreEntry)rowObject;

                return(driver.DriverVersion == null
                    ? null
                    : new Version(driver.DriverVersion.Major, driver.DriverVersion.Minor));
            };

            this.driverDateColumn.GroupKeyGetter = rowObject =>
            {
                DriverStoreEntry driver = (DriverStoreEntry)rowObject;
                return(new DateTime(driver.DriverDate.Year, driver.DriverDate.Month, 1));
            };

            this.driverDateColumn.GroupKeyToTitleConverter = groupKey => ((DateTime)groupKey).ToString("yyyy-MM");

            this.driverSizeColumn.GroupKeyGetter =
                rowObject => DriverStoreEntry.GetSizeRange(((DriverStoreEntry)rowObject).DriverSize);

            this.driverSizeColumn.GroupKeyToTitleConverter =
                groupKey => DriverStoreEntry.GetSizeRangeName((long)groupKey);

            this.bootCriticalColumn.AspectToStringConverter = condition => (bool)(condition ?? false) ? Language.Column_Text_True : Language.Column_Text_False;
        }