예제 #1
0
        public override bool OnNavigating(NavigationType navigationType)
        {
            if (navigationType != NavigationType.Forward || valiadated)
            {
                return(base.OnNavigating(navigationType));
            }

            progressInformationDialog = new ProgressInformationDialog
            {
                Title            = "Processing Driver Source Folder",
                Height           = 130,
                ProgressBarStyle = ProgressBarStyle.Continuous
            };

            progressWorker                       = new BackgroundWorker();
            progressWorker.DoWork               += new DoWorkEventHandler(ProgressWorker_DoWork);
            progressWorker.ProgressChanged      += new ProgressChangedEventHandler(ProgressWorker_ProgressChanged);
            progressWorker.RunWorkerCompleted   += new RunWorkerCompletedEventHandler(ProgressWorker_RunWorkerCompleted);
            progressWorker.WorkerReportsProgress = true;
            UseWaitCursor = true;
            progressWorker.RunWorkerAsync();

            progressInformationDialog.ShowDialog(this);
            if (!progressInformationDialog.Result)
            {
                return(false);
            }

            return(base.OnNavigating(navigationType));
        }
        public override bool OnNavigating(NavigationType navigationType)
        {
            if (navigationType != NavigationType.Forward || valiadated)
            {
                if (signedDrivers == null)
                {
                    progressInformationDialog = new ProgressInformationDialog
                    {
                        Title = "Retrieving driver data"
                    };
                    progressWorker                       = new BackgroundWorker();
                    progressWorker.DoWork               += new DoWorkEventHandler(ProgressWorker_DoWork);
                    progressWorker.ProgressChanged      += new ProgressChangedEventHandler(ProgressWorker_ProgressChanged);
                    progressWorker.RunWorkerCompleted   += new RunWorkerCompletedEventHandler(ProgressWorker_RunWorkerCompleted);
                    progressWorker.WorkerReportsProgress = true;
                    UseWaitCursor = true;
                    progressWorker.RunWorkerAsync();
                    progressInformationDialog.ShowDialog(this);
                    if (!progressInformationDialog.Result)
                    {
                        return(false);
                    }
                }

                return(base.OnNavigating(navigationType));
            }

            progressInformationDialog = new ProgressInformationDialog
            {
                Title = "Validating requirments"
            };
            progressWorker                       = new BackgroundWorker();
            progressWorker.DoWork               += new DoWorkEventHandler(ValidateWorker_DoWork);
            progressWorker.ProgressChanged      += new ProgressChangedEventHandler(ProgressWorker_ProgressChanged);
            progressWorker.RunWorkerCompleted   += new RunWorkerCompletedEventHandler(ProgressWorker_RunWorkerCompleted);
            progressWorker.WorkerReportsProgress = true;
            UseWaitCursor = true;
            progressWorker.RunWorkerAsync();
            progressInformationDialog.ShowDialog(this);
            if (!progressInformationDialog.Result)
            {
                return(false);
            }

            return(false);
        }
        public override bool OnNavigating(NavigationType navigationType)
        {
            if (navigationType != NavigationType.Forward || valiadated)
            {
                return(base.OnNavigating(navigationType));
            }

            string cabFile = Path.Combine(Path.GetTempPath(), "DriverPackCatalog.cab");

            if (File.Exists(cabFile))
            {
                long fileSize = new FileInfo(cabFile).Length;
                long webSize  = Utility.GetFileSize(registry.ReadString("DellCatalogURI"));

                if (fileSize == webSize)
                {
                    downloadedCatalog = true;
                }
            }

            if (downloadedCatalog == false)
            {
                progressInformationDialog = new ProgressInformationDialog
                {
                    Title = "Downloading Catalog",
                };

                progressWorker                       = new BackgroundWorker();
                progressWorker.DoWork               += new DoWorkEventHandler(ProgressWorker_DoWork);
                progressWorker.ProgressChanged      += new ProgressChangedEventHandler(ProgressWorker_ProgressChanged);
                progressWorker.RunWorkerCompleted   += new RunWorkerCompletedEventHandler(ProgressWorker_RunWorkerCompleted);
                progressWorker.WorkerReportsProgress = true;
                UseWaitCursor = true;
                progressWorker.RunWorkerAsync();

                progressInformationDialog.ShowDialog(this);
                if (!progressInformationDialog.Result)
                {
                    return(false);
                }
            }

            return(base.OnNavigating(navigationType));
        }
        private void ComboBoxOS_Click(object sender, EventArgs e)
        {
            if (!(sender as ComboBox).Enabled)
            {
                return;
            }

            if (downloadedCatalog == false)
            {
                (sender as ComboBox).Enabled = false;

                progressInformationDialog = new ProgressInformationDialog
                {
                    Title = "Downloading Catalog",
                };

                progressWorker                       = new BackgroundWorker();
                progressWorker.DoWork               += new DoWorkEventHandler(ProgressWorker_DoWork);
                progressWorker.ProgressChanged      += new ProgressChangedEventHandler(ProgressWorker_ProgressChanged);
                progressWorker.RunWorkerCompleted   += new RunWorkerCompletedEventHandler(ProgressWorker_RunWorkerCompleted);
                progressWorker.WorkerReportsProgress = true;
                UseWaitCursor = true;
                progressWorker.RunWorkerAsync();

                progressInformationDialog.ShowDialog(this);
                if (!progressInformationDialog.Result)
                {
                    return;
                }
            }

            if (processedCatalog == false)
            {
                processedCatalog = ProcessCatalog();

                OnActivated();
            }
        }
예제 #5
0
        public bool GetLegacyPackages(ProgressInformationDialog progressInformationDialog)
        {
            string[] modelEntries = Directory.GetDirectories(SourceLocation, "*", SearchOption.TopDirectoryOnly);

            int num = 0;

            foreach (string modelDirectory in modelEntries)
            {
                string modelName = new DirectoryInfo(modelDirectory).Name;
                int    percent   = num * 100 / modelEntries.Length;
                backgroundWorker.ReportProgress(ProgressStart + (percent / TotalVendors), string.Format("Processing Driver Source for Vendor: {0}\n\n Model: {1}", Name, modelName));

                string[] architectureEntries = Directory.GetDirectories(modelDirectory, "*", SearchOption.TopDirectoryOnly);
                foreach (string sourceDirectory in architectureEntries)
                {
                    string architectureName  = new DirectoryInfo(sourceDirectory).Name;
                    string driverPackageName = string.Join("-", Name, modelName, architectureName);
                    string packageName       = string.Join("-", Name, modelName, architectureName);
                    string targetDirectory   = Path.Combine(PackageLocation, Name, packageName);

                    LegacyPackage package = new LegacyPackage(connectionManager, driverPackageName, sourceDirectory, targetDirectory)
                    {
                        Vendor = Name
                    };

                    LegacyPackages.Add(package);
                }
                ++num;

                if (progressInformationDialog.ReceivedRequestToClose)
                {
                    return(false);
                }
            }

            return(LegacyPackages.Count > 0 ? true : false);
        }