示例#1
0
        private List <SADIService> GetSelectedServices(Boolean withClear)
        {
            List <SADIService> services = new List <SADIService>();

            foreach (Control control in flowLayoutPanel1.Controls)
            {
                if (control is ServiceSelectionControl)
                {
                    ServiceSelectionControl ssc = control as ServiceSelectionControl;
                    if (ssc.isSelected())
                    {
                        services.Add(ssc.service);
                        if (withClear)
                        {
                            ssc.deselect();
                        }
                    }
                }
            }
            return(services);
        }
示例#2
0
 private void FindServicesWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     progress.Value = e.ProgressPercentage;
     if (e.UserState is SADIService && !Seen.Contains((e.UserState as SADIService).uri))
     {
         Seen.Add((e.UserState as SADIService).uri, Seen);
         ServiceSelectionControl control = new ServiceSelectionControl();
         control.setService(e.UserState as SADIService);
         ResizeLabels(control);
         flowLayoutPanel1.SuspendLayout();
         int ypos = flowLayoutPanel1.VerticalScroll.Value;
         flowLayoutPanel1.Controls.Add(control);
         int i = 0;
         while ((i < flowLayoutPanel1.Controls.Count) &&
                ((flowLayoutPanel1.Controls[i] as ServiceSelectionControl).service.name.CompareTo(control.service.name) < 0))
         {
             ++i;
         }
         flowLayoutPanel1.Controls.SetChildIndex(control, i);
         flowLayoutPanel1.ResumeLayout(false);
         flowLayoutPanel1.PerformLayout();
         flowLayoutPanel1.VerticalScroll.Value = ypos;
     }
     else if (e.UserState is string)
     {
         timer.Stop();
         status.Text = e.UserState as string;
         timer.Start();
     }
     else if (e.UserState is Exception)
     {
         timer.Stop();
         status.Text = (e.UserState as Exception).Message;
         timer.Start();
     }
 }
示例#3
0
        private void ResizeLabels(ServiceSelectionControl control)
        {
            Padding padding = this.flowLayoutPanel1.Padding;

            control.sizeLabels(this.flowLayoutPanel1.Size.Width - padding.Left - padding.Right);
        }