Exemple #1
0
        private void tbSearch_Search(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            if (string.IsNullOrEmpty(tbSearch.Text))
            {
                tbSearch.Foreground = new SolidColorBrush(Colors.LightGray);
                tbSearch.Tag        = "Search";
                tbSearch.Text       = "Search...";


                ListCollectionView lcv = new ListCollectionView(lAllSoftware.Distinct().OrderBy(t => t.ShortName).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName).ToList());

                //ListCollectionView lcv = new ListCollectionView(oAPI.SWResults("", "").Distinct().OrderBy(t => t.ShortName).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName).ToList());
                PropertyGroupDescription PGD = new PropertyGroupDescription("", new ShortNameToCategory());

                //PGD.GroupNames.Add(RZRestAPI.GetCategories(lAllSoftware));
                foreach (var o in RZRestAPIv2.GetCategories(lAllSoftware))
                {
                    PGD.GroupNames.Add(o);
                }


                lcv.GroupDescriptions.Add(PGD);

                lvSW.ItemsSource = lcv;
            }
            else
            {
                tbSearch.Foreground = new SolidColorBrush(Colors.Black);
                tbSearch.Tag        = null;

                try
                {
                    var vResult = lAllSoftware.FindAll(t => t.ShortName.IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList();
                    vResult.AddRange(lAllSoftware.FindAll(t => t.ProductName.IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList());
                    vResult.AddRange(lAllSoftware.FindAll(t => t.Manufacturer.IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList());
                    if (vResult.Count <= 15)
                    {
                        vResult.AddRange(lAllSoftware.FindAll(t => (t.Description ?? "").IndexOf(tbSearch.Text, 0, StringComparison.InvariantCultureIgnoreCase) >= 0).ToList());
                    }

                    lvSW.ItemsSource = vResult.Distinct().OrderBy(t => t.ShortName).ThenByDescending(t => t.ProductVersion).ThenByDescending(t => t.ProductName);
                }
                catch { }
            }
            Mouse.OverrideCursor = null;
        }
Exemple #2
0
        private void btInstallSoftware_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                if (oSCAN.SoftwareRepository.Count == 0)
                {
                    try
                    {
                        oSCAN.GetSWRepository().Wait(2000);
                    }
                    catch { }
                }

                List <GetSoftware>       oDBCat = new List <GetSoftware>();
                PropertyGroupDescription PGD    = new PropertyGroupDescription("", new ShortNameToCategory());

                foreach (GetSoftware oSW in oSCAN.SoftwareRepository)
                {
                    try
                    {
                        if (oSW.Categories.Count > 1)
                        {
                            foreach (string sCAT in oSW.Categories)
                            {
                                try
                                {
                                    //Check if SW is already installed
                                    if (lSoftware.FirstOrDefault(t => t.ProductName == oSW.ProductName && t.ProductVersion == oSW.ProductVersion) != null)
                                    {
                                        GetSoftware oNew = new GetSoftware()
                                        {
                                            Categories = new List <string> {
                                                sCAT
                                            }, Description = oSW.Description, Downloads = oSW.Downloads, SWId = oSW.SWId, Manufacturer = oSW.Manufacturer, ProductName = oSW.ProductName, ProductURL = oSW.ProductURL, ProductVersion = oSW.ProductVersion, ShortName = oSW.ShortName, IconHash = oSW.IconHash, isInstalled = true
                                        };
                                        oDBCat.Add(oNew);
                                    }
                                    else
                                    {
                                        GetSoftware oNew = new GetSoftware()
                                        {
                                            Categories = new List <string> {
                                                sCAT
                                            }, Description = oSW.Description, Downloads = oSW.Downloads, SWId = oSW.SWId, Manufacturer = oSW.Manufacturer, ProductName = oSW.ProductName, ProductURL = oSW.ProductURL, ProductVersion = oSW.ProductVersion, ShortName = oSW.ShortName, IconHash = oSW.IconHash, isInstalled = false
                                        };
                                        oDBCat.Add(oNew);
                                    }
                                }
                                catch { }
                            }
                        }
                        else
                        {
                            //Check if SW is already installed
                            if (lSoftware.FirstOrDefault(t => t.ProductName == oSW.ProductName && t.ProductVersion == oSW.ProductVersion) != null)
                            {
                                oDBCat.Add(new GetSoftware()
                                {
                                    Categories = oSW.Categories, Description = oSW.Description, Downloads = oSW.Downloads, SWId = oSW.SWId, Manufacturer = oSW.Manufacturer, ProductName = oSW.ProductName, ProductURL = oSW.ProductURL, ProductVersion = oSW.ProductVersion, ShortName = oSW.ShortName, IconHash = oSW.IconHash, isInstalled = true
                                });
                            }
                            else
                            {
                                oDBCat.Add(new GetSoftware()
                                {
                                    Categories = oSW.Categories, Description = oSW.Description, Downloads = oSW.Downloads, SWId = oSW.SWId, Manufacturer = oSW.Manufacturer, ProductName = oSW.ProductName, ProductURL = oSW.ProductURL, ProductVersion = oSW.ProductVersion, ShortName = oSW.ShortName, IconHash = oSW.IconHash, isInstalled = false
                                });
                            }
                        }
                    }
                    catch { }
                }

                ListCollectionView lcv = new ListCollectionView(oDBCat.ToList());

                foreach (var o in RZRestAPIv2.GetCategories(oSCAN.SoftwareRepository))
                {
                    PGD.GroupNames.Add(o);
                }

                lcv.GroupDescriptions.Add(PGD);

                oInstPanel.lvSW.ItemsSource = lcv;
                oInstPanel.lSoftware        = lSoftware;
                oInstPanel.lAllSoftware     = oSCAN.SoftwareRepository;

                //Mark all installed...
                oInstPanel.lAllSoftware.ForEach(x => { if (lSoftware.FirstOrDefault(t => (t.ProductName == x.ProductName && t.ProductVersion == x.ProductVersion)) != null)
                                                       {
                                                           x.isInstalled = true;
                                                       }
                                                });


                /*if (!string.IsNullOrEmpty(tbURL.Text))
                 *  oInstPanel.sInternalURL = tbURL.Text;*/
            }
            finally
            {
                Mouse.OverrideCursor = null;
            }

            tabWizard.SelectedItem = tabInstallSW;
        }
Exemple #3
0
        //public event ChangedEventHandler onEdit;

        public InstallSwPanel()
        {
            InitializeComponent();
            tSearch.Elapsed  += TSearch_Elapsed;
            tSearch.Enabled   = false;
            tSearch.AutoReset = false;

            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                RZScan oSCAN = new RZScan(false, false);

                Task.Run(() => oSCAN.GetSWRepository()).Wait();

                lAllSoftware = oSCAN.SoftwareRepository;

                List <GetSoftware>       oDBCat = new List <GetSoftware>();
                PropertyGroupDescription PGD    = new PropertyGroupDescription("", new ShortnameToCategory());

                foreach (GetSoftware oSW in oSCAN.SoftwareRepository)
                {
                    try
                    {
                        if (oSW.Categories.Count > 1)
                        {
                            foreach (string sCAT in oSW.Categories)
                            {
                                try
                                {
                                    //Check if SW is already installed
                                    if (lSoftware.FirstOrDefault(t => t.ProductName == oSW.ProductName & t.ProductVersion == oSW.ProductVersion) != null)
                                    {
                                        GetSoftware oNew = new GetSoftware()
                                        {
                                            Categories = new List <string> {
                                                sCAT
                                            }, Description = oSW.Description, Downloads = oSW.Downloads, IconHash = oSW.IconHash, SWId = oSW.SWId, Manufacturer = oSW.Manufacturer, ProductName = oSW.ProductName, ProductURL = oSW.ProductURL, ProductVersion = oSW.ProductVersion, ShortName = oSW.ShortName, isInstalled = true
                                        };
                                        oDBCat.Add(oNew);
                                    }
                                    else
                                    {
                                        GetSoftware oNew = new GetSoftware()
                                        {
                                            Categories = new List <string> {
                                                sCAT
                                            }, Description = oSW.Description, Downloads = oSW.Downloads, IconHash = oSW.IconHash, SWId = oSW.SWId, Manufacturer = oSW.Manufacturer, ProductName = oSW.ProductName, ProductURL = oSW.ProductURL, ProductVersion = oSW.ProductVersion, ShortName = oSW.ShortName, isInstalled = false
                                        };
                                        oDBCat.Add(oNew);
                                    }
                                }
                                catch { }
                            }
                        }
                        else
                        {
                            //Check if SW is already installed
                            if (lSoftware.FirstOrDefault(t => t.ProductName == oSW.ProductName & t.ProductVersion == oSW.ProductVersion) != null)
                            {
                                oDBCat.Add(new GetSoftware()
                                {
                                    Categories = oSW.Categories, Description = oSW.Description, Downloads = oSW.Downloads, IconHash = oSW.IconHash, SWId = oSW.SWId, Manufacturer = oSW.Manufacturer, ProductName = oSW.ProductName, ProductURL = oSW.ProductURL, ProductVersion = oSW.ProductVersion, ShortName = oSW.ShortName, isInstalled = true
                                });
                            }
                            else
                            {
                                oDBCat.Add(new GetSoftware()
                                {
                                    Categories = oSW.Categories, Description = oSW.Description, Downloads = oSW.Downloads, IconHash = oSW.IconHash, SWId = oSW.SWId, Manufacturer = oSW.Manufacturer, ProductName = oSW.ProductName, ProductURL = oSW.ProductURL, ProductVersion = oSW.ProductVersion, ShortName = oSW.ShortName, isInstalled = false
                                });
                            }
                        }
                    }
                    catch { }
                }

                ListCollectionView lcv = new ListCollectionView(oDBCat.ToList());

                foreach (var o in RZRestAPIv2.GetCategories(oSCAN.SoftwareRepository))
                {
                    PGD.GroupNames.Add(o);
                }

                lcv.GroupDescriptions.Add(PGD);

                lvSW.ItemsSource = lcv;
            }
            catch { }
            Mouse.OverrideCursor = null;
        }