Esempio n. 1
0
        private void linkLabelGotoStorageLinkProperties_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            IXenObject o = Helpers.GetPool(Connection);

            if (o == null)
            {
                var hosts = Connection.Cache.Hosts;
                if (hosts.Length > 0)
                {
                    o = hosts[0];
                }
            }

            if (o != null)
            {
                var dialog = new PropertiesDialog(o);
                dialog.Load += (s, ee) => dialog.SelectPage(dialog.StorageLinkPage);

                dialog.FormClosing += (s, ee) =>
                {
                    if (dialog.DialogResult == DialogResult.Yes && ee.Action != null)
                    {
                        ee.StartAction = false;
                        ee.Action.Completed += ss =>
                        {
                            if (ee.Action.Succeeded)
                            {
                                Program.Invoke(Program.MainWindow, () =>
                                {
                                    int comboBoxItemCount = comboBoxStorageSystem.Items.Count;
                                    PerformStorageSystemScan();
                                    comboBoxStorageSystem.DroppedDown = comboBoxStorageSystem.Items.Count > comboBoxItemCount;
                                });
                            }
                        };

                        new ActionProgressDialog(ee.Action, ProgressBarStyle.Marquee).ShowDialog(this);
                    }
                };

                dialog.Show(this);
            }
        }