Esempio n. 1
0
        private static void AddCustomFieldsToRow(IXenObject o, GridRow row)
        {
            foreach (CustomFieldDefinition customFieldDefinition in CustomFieldsManager.GetCustomFields())
            {
                GridStringItem customFieldItem = new GridStringItem(
                    new CustomFieldWrapper(o, customFieldDefinition),
                    HorizontalAlignment.Center, VerticalAlignment.Middle,
                    false, false, TextBrush, Program.DefaultFont,
                    new EventHandler(delegate
                {
                    PropertiesDialog dialog = new PropertiesDialog(o);
                    dialog.SelectPage(dialog.CustomFieldsEditPage);
                    dialog.ShowDialog();
                }));

                row.AddItem(CustomFieldsManager.CUSTOM_FIELD + customFieldDefinition.Name, customFieldItem);
            }
        }
Esempio n. 2
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);
            }
        }