public async void PopulatePcList()
        {
            string netBiosName = Environment.MachineName;

            PcName.Text = netBiosName;
            await Task.Delay(5);

            PcList = Scan.DetailsOfPC();
            FolderPathPanel.Children.Clear();
            int count = 0;

            PcListTileContainer.Children.Clear();
            foreach (Scan.StructDataOfPC PC in PcList)
            {
                count++;
                Console.WriteLine(PC.ToString());
                CustomTile t = new CustomTile(PC, count);
                if (PC.TypeOfPC.ToUpper() == "PUBLIC")
                {
                    t.ContentTileButton.Click += (sender1, ex) => this.Display(t);
                }
                else
                {
                    t.ContentTileButton.Click += (sender1, ex) => this.GrantAccess(PC.NameOfPC);
                }
                PcListTileContainer.Children.Add(t);
                if (PC.NameOfPC == netBiosName)
                {
                    Display(new CustomTile(PC, 0));
                }
            }
            if (count > 99)
            {
                NumberOfConnections.Text = count.ToString();
            }
            else if (count > 9)
            {
                NumberOfConnections.Text = "0" + count.ToString();
            }
            else
            {
                NumberOfConnections.Text = "00" + count.ToString();
            }
            if (count == 0)
            {
                availableText.Text       = "unavailable";
                availableText.Foreground = new SolidColorBrush(Color.FromArgb(255, 232, 55, 78));//#FFE8554E
            }
            else if (count > 0)
            {
                availableText.Text       = "available";
                availableText.Foreground = new SolidColorBrush(Color.FromArgb(255, 106, 232, 78));//#FF6AE84E
            }
        }
        public async void Display(CustomTile sender)
        {
            await Task.Delay(5);

            PopulateFileList(sender.TileHeader.Text);
        }
Exemple #3
0
        public async void PopulatePc()
        {
            string netBiosName = Environment.MachineName;

            PcName.Text = netBiosName;
            await Task.Delay(5);

            Pc.Clear();
            Pc = ListingPC.ListNetwork.ScanNetwork();

            int count = 0;

            Scan.StructDataOfPC com = new Scan.StructDataOfPC();

            PcList.Clear();
            foreach (ListingPC.Testing.DataOfPC PC in Pc)
            {
                count++;
                Console.WriteLine(PC.ToString());
                com.NameOfPC = PC.Name;
                com.TypeOfPC = PC.Type;
                if (PC.Type == "Public")
                {
                    com.SizeOfSharedFolders = ListingPC.FolderSize.SizeOfSharedFiles(PC.Name);
                }
                else
                {
                    com.SizeOfSharedFolders = 0;
                }
                PcList.Add(com);
            }

            PcListTileContainer.Children.Clear();
            foreach (Scan.StructDataOfPC PC in PcList)
            {
                Console.WriteLine(PC.ToString());
                CustomTile t = new CustomTile(PC, count);
                if (PC.TypeOfPC.ToUpper() == "PUBLIC")
                {
                    t.ContentTileButton.Click += (sender1, ex) => this.Display(t);
                }
                PcListTileContainer.Children.Add(t);
                if (PC.NameOfPC == netBiosName)
                {
                    Display(new CustomTile(PC, 0));
                }
            }
            if (count > 99)
            {
                NumberOfConnections.Text = count.ToString();
            }
            else if (count > 9)
            {
                NumberOfConnections.Text = "0" + count.ToString();
            }
            else
            {
                NumberOfConnections.Text = "00" + count.ToString();
            }
            if (count == 0)
            {
                availableText.Text       = "unavailable";
                availableText.Foreground = new SolidColorBrush(Color.FromArgb(255, 232, 55, 78));//#FFE8554E
            }
            else if (count > 0)
            {
                availableText.Text       = "available";
                availableText.Foreground = new SolidColorBrush(Color.FromArgb(255, 106, 232, 78));//#FF6AE84E
            }
        }