Exemplo n.º 1
0
        private void btnPickOther_Click(object sender, EventArgs e)
        {
            LinkedDatabase[] items = new LinkedDatabase[] { new LinkedDatabase("Populating list...") };
            if (this._allLinkedDatabases != null)
            {
                items = this._allLinkedDatabases;
            }
            ThreadStart start = null;

            using (ListPicker picker = new ListPicker(items, true))
            {
                if (this._allLinkedDatabases == null)
                {
                    if (start == null)
                    {
                        start = delegate {
                            Action method  = null;
                            Action action2 = null;
                            try
                            {
                                this._allLinkedDatabases = this._linkedDbFetcher().ToArray <LinkedDatabase>();
                                if (((this._allLinkedDatabases != null) && this._allLinkedDatabases.Any <LinkedDatabase>()) && !picker.IsDisposed)
                                {
                                    if (method == null)
                                    {
                                        method = () => picker.AllItems = this._allLinkedDatabases;
                                    }
                                    picker.Invoke(method);
                                }
                            }
                            catch (Exception exception)
                            {
                                if (!picker.IsDisposed)
                                {
                                    if (!picker.IsDisposed)
                                    {
                                        if (action2 == null)
                                        {
                                            action2 = () => picker.AllItems = null;
                                        }
                                        picker.Invoke(action2);
                                    }
                                    MessageBox.Show("Error: " + exception.Message, "LINQPad");
                                }
                            }
                        };
                    }
                    new Thread(start).Start();
                }
                if ((picker.ShowDialog() == DialogResult.OK) && (picker.SelectedItems != null))
                {
                    foreach (LinkedDatabase database in picker.SelectedItems)
                    {
                        this.grdOther.Rows.Add(new object[] { database.Server, database.Database });
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void btnPickOther_Click(object sender, EventArgs e)
 {
     LinkedDatabase[] items = new LinkedDatabase[] { new LinkedDatabase("Populating list...") };
     if (this._allLinkedDatabases != null)
     {
         items = this._allLinkedDatabases;
     }
     ThreadStart start = null;
     using (ListPicker picker = new ListPicker(items, true))
     {
         if (this._allLinkedDatabases == null)
         {
             if (start == null)
             {
                 start = delegate {
                     Action method = null;
                     Action action2 = null;
                     try
                     {
                         this._allLinkedDatabases = this._linkedDbFetcher().ToArray<LinkedDatabase>();
                         if (((this._allLinkedDatabases != null) && this._allLinkedDatabases.Any<LinkedDatabase>()) && !picker.IsDisposed)
                         {
                             if (method == null)
                             {
                                 method = () => picker.AllItems = this._allLinkedDatabases;
                             }
                             picker.Invoke(method);
                         }
                     }
                     catch (Exception exception)
                     {
                         if (!picker.IsDisposed)
                         {
                             if (!picker.IsDisposed)
                             {
                                 if (action2 == null)
                                 {
                                     action2 = () => picker.AllItems = null;
                                 }
                                 picker.Invoke(action2);
                             }
                             MessageBox.Show("Error: " + exception.Message, "LINQPad");
                         }
                     }
                 };
             }
             new Thread(start).Start();
         }
         if ((picker.ShowDialog() == DialogResult.OK) && (picker.SelectedItems != null))
         {
             foreach (LinkedDatabase database in picker.SelectedItems)
             {
                 this.grdOther.Rows.Add(new object[] { database.Server, database.Database });
             }
         }
     }
 }
Exemplo n.º 3
0
 public static object PickFromList(string windowTitle, object[] items)
 {
     using (ListPicker picker = new ListPicker(items))
     {
         picker.Text = windowTitle;
         if (picker.ShowDialog() != DialogResult.OK)
         {
             return null;
         }
         return picker.SelectedItem;
     }
 }
Exemplo n.º 4
0
 internal void ChooseOpenQuery()
 {
     QueryControlToStringWrapper[] items = (from qc in this.GetQueryControls().OrderBy<QueryControl, string>(qc => qc.Query.Name, StringComparer.CurrentCultureIgnoreCase) select new QueryControlToStringWrapper(qc)).ToArray<QueryControlToStringWrapper>();
     if (items.Length != 0)
     {
         using (ListPicker picker = new ListPicker(items))
         {
             picker.Text = "Activate Query";
             if (picker.ShowDialog() == DialogResult.OK)
             {
                 this.CurrentQueryControl = ((QueryControlToStringWrapper) picker.SelectedItem).QueryControl;
             }
         }
     }
 }