Esempio n. 1
0
 private async void SetRequirements()
 {
     if (requires == null || requires.Length <= 0)
     {
         return;
     }
     for (var i = 0; i < requires.Length; i++)
     {
         try
         {
             await Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate
             {
                 var uc = new UserControlSupport()
                 {
                     Width            = requires[i].Width,
                     Height           = requires[i].Height,
                     SupportName      = requires[i].Name,
                     Margin           = new Thickness(0, 0, 8, 8),
                     BackgroundButton = (SolidColorBrush)brushConverter.ConvertFrom(requires[i].Color),
                     Url    = requires[i].Address,
                     border = { ToolTip = requires[i].ToolTip },
                 };
                 uc.SetImage(new Uri(requires[i].Image));
                 if (!wrapPanel.Children.OfType <UserControlSupport>().Any(u => u.Url == uc.Url))
                 {
                     wrapPanel.Children.Add(uc);
                 }
             });
         }
         catch { }
     }
 }
Esempio n. 2
0
 private async void SetSupporters()
 {
     if (supporters == null || supporters.Length <= 0)
     {
         return;
     }
     for (var i = 0; i < supporters.Length; i++)
     {
         try
         {
             await Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate
             {
                 var uc = new UserControlSupport()
                 {
                     Width            = 200,
                     Height           = 200,
                     SupportName      = supporters[i].Name,
                     Margin           = new Thickness(0, 0, 8, 8),
                     BackgroundButton = (SolidColorBrush)brushConverter.ConvertFrom(supporters[i].Color),
                     Url = supporters[i].Address
                 };
                 uc.SetImage(new Uri(supporters[i].Logo));
                 if (!wrapPanel.Children.OfType <UserControlSupport>().Any(u => u.Url == uc.Url))
                 {
                     wrapPanel.Children.Add(uc);
                 }
             });
         }
         catch { }
     }
 }