Beispiel #1
0
 public void PropertiesFormTest()
 {
     using (PropertiesForm form = new PropertiesForm())
     {
         //form.ShowDialog();
     }
 }
        public void ShowPropertyGrid(object control, PropertiesNode focusedNode)
        {
            var propertiesControl = control as IPropertiesProvider;

            if (propertiesControl != null)
            {
                var form = new PropertiesForm();

                var validationRules = propertiesControl.GetValidationRules();
                form.SetValidationRules(validationRules);
                var propertyEditors = propertiesControl.GetPropertyEditors();
                form.SetPropertyEditors(propertyEditors);
                var simpleProperties = propertiesControl.GetSimpleProperties();


                form.SetSimpleProperties(simpleProperties);
                var collectionProperties = propertiesControl.GetCollections();
                form.SetCollectionProperties(collectionProperties);

                if (form.ShowDialog() == DialogResult.OK)
                {
                    propertiesControl.ApplySimpleProperties();
                    propertiesControl.ApplyCollections();

                    RenameNode(focusedNode, simpleProperties["Name"].Value.ToString());
                }
                else
                {
                    form.RevertChanges();
                }
            }
        }
Beispiel #3
0
        public OffsetKeyframeProperties(Widget parentWidget, OffsetSequenceEditor sequenceEditor, GuiFrameworkUICallback uiCallback)
            : base(parentWidget, "Medical.GUI.OffsetSequence.OffsetKeyframeProperties.layout")
        {
            this.sequenceEditor = sequenceEditor;

            propertiesForm = new PropertiesForm(mainWidget, uiCallback);
        }
Beispiel #4
0
        private void repositoryItemButtonEditSource_ButtonClick(object sender, ButtonPressedEventArgs e)
        {
            var scriptSource = Scripts.ElementAt(GridViewScripts.FocusedRowHandle).ScriptSource as IPropertiesProvider;

            if (scriptSource != null)
            {
                var form = new PropertiesForm();

                var validationRules = scriptSource.GetValidationRules();
                form.SetValidationRules(validationRules);
                var propertyEditors = scriptSource.GetPropertyEditors();
                form.SetPropertyEditors(propertyEditors);
                var simpleProperties = scriptSource.GetSimpleProperties();
                form.SetSimpleProperties(simpleProperties);
                var collectionProperties = scriptSource.GetCollections();
                form.SetCollectionProperties(collectionProperties);

                if (form.ShowDialog() == DialogResult.OK)
                {
                    scriptSource.ApplySimpleProperties();
                    scriptSource.ApplyCollections();
                    GridViewScripts.HideEditor();
                    GridViewScripts.RefreshData();
                }
                else
                {
                    form.RevertChanges();
                }
            }
        }
        public DebugVisualizer(StandaloneController standaloneController)
            : base("Developer.GUI.DebugVisualizer.DebugVisualizer.layout")
        {
            this.medicalController               = standaloneController.MedicalController;
            this.pluginManager                   = medicalController.PluginManager;
            standaloneController.SceneLoaded    += standaloneController_SceneLoaded;
            standaloneController.SceneUnloading += standaloneController_SceneUnloading;

            uiCallback = new GuiFrameworkUICallback();

            tree         = new Tree((ScrollView)window.findWidget("TreeScroller"));
            editTreeView = new EditInterfaceTreeView(tree, uiCallback);

            propertiesForm = new ScrollablePropertiesForm((ScrollView)window.findWidget("TableScroller"), uiCallback);

            objectEditor = new ObjectEditor(editTreeView, propertiesForm, uiCallback);

            this.Resized += DebugVisualizer_Resized;

            currentScene = standaloneController.MedicalController.CurrentScene;

            splitter = new Splitter(window.findWidget("Splitter"));
            splitter.Widget1Resized += a => tree.layout();
            splitter.Widget2Resized += a => propertiesForm.layout();
        }
Beispiel #6
0
 public TypeGroupControl(PropertiesForm parent, Dictionary <string, string> attributes, ControlManifestDetails cmd)
 {
     InitializeComponent();
     collection      = attributes;
     manifestDetails = cmd;
     InitializeControls();
     ParentControl = parent;
 }
 private void toolStripButtonProperties_Click(object sender, EventArgs e)
 {
     if (_executionAccount != null)
     {
         PropertiesForm form = new PropertiesForm("Account Information Properties", _executionAccount.Info);
         form.ShowDialog();
     }
 }
 public TypeControl(PropertiesForm parent, Dictionary <string, string> attributes, ControlManifestDetails cmd, object t = null)
 {
     ParentControl   = parent;
     collection      = attributes;
     manifestDetails = cmd;
     tag             = (Dictionary <string, string>)t;
     InitializeComponent();
     InitializeControls();
 }
Beispiel #9
0
        public GenericPropertiesFormComponent(MyGUIViewHost viewHost, GenericPropertiesFormView genericEditorView)
            : base(genericEditorView.HorizontalAlignment ? "Medical.GUI.Editor.GenericEditor.GenericEditorComponent.layout" : "Medical.GUI.Editor.GenericEditor.GenericEditorVerticalComponent.layout", viewHost)
        {
            Widget window = this.widget;

            this.name             = genericEditorView.Name;
            this.editorController = genericEditorView.EditorController;

            tree         = new Tree((ScrollView)window.findWidget("TreeScroller"));
            editTreeView = new EditInterfaceTreeView(tree, genericEditorView.EditUICallback);

            //This class does not use the add / remove buttons from the layout, so hide them
            Widget addRemovePanel = widget.findWidget("AddRemovePanel");

            addRemovePanel.Visible = false;

            tableScroller    = (ScrollView)widget.findWidget("TableScroller");
            table            = new ResizingTable(tableScroller);
            addRemoveButtons = new AddRemoveButtons((Button)widget.findWidget("Add"), (Button)widget.findWidget("Remove"), widget.findWidget("AddRemovePanel"));
            addRemoveButtons.VisibilityChanged += addRemoveButtons_VisibilityChanged;
            addRemoveButtons_VisibilityChanged(addRemoveButtons, addRemoveButtons.Visible);
            propTable = new PropertiesTable(table, genericEditorView.EditUICallback, addRemoveButtons);

            propertiesForm = new ScrollablePropertiesForm(tableScroller, genericEditorView.EditUICallback);

            contextualProperties = new ContextualPropertiesEditor(propertiesForm, propTable);

            objectEditor = new ObjectEditor(editTreeView, contextualProperties, genericEditorView.EditUICallback);

            EditInterfaceHandler editInterfaceHandler = viewHost.Context.getModel <EditInterfaceHandler>(EditInterfaceHandler.DefaultName);

            if (editInterfaceHandler != null)
            {
                editInterfaceHandler.setEditInterfaceConsumer(this);
            }

            widget.RootKeyChangeFocus += new MyGUIEvent(widget_RootKeyChangeFocus);

            CurrentEditInterface = genericEditorView.EditInterface;

            gap = tableScroller.Bottom - addRemoveButtons.Top;

            splitter = new Splitter(widget.findWidget("Splitter"));
            splitter.Widget1Resized += split => tree.layout();
            splitter.Widget2Resized += split =>
            {
                if (contextualProperties.CurrentEditor == propertiesForm)
                {
                    propertiesForm.layout();
                }
                else
                {
                    table.layout();
                }
            };
        }
Beispiel #10
0
        private void toolStripButtonProperties_Click(object sender, EventArgs e)
        {
            PropertiesForm form = new PropertiesForm("Expert Type Properties", this._expertInformation);

            form.ShowDialog();
            if (ExpertUpdateEvent != null)
            {
                ExpertUpdateEvent(this);
            }
        }
 private void toolStripButtonAdapterProperties_Click(object sender, EventArgs e)
 {
     foreach (ListViewItem item in listViewIntegrations.SelectedItems)
     {
         IIntegrationAdapter adapter = (IIntegrationAdapter)item.Tag;
         PropertiesForm      form    = new PropertiesForm("Adapter Properties", adapter);
         form.ShowOkCancel = false;
         form.ShowDialog();
     }
 }
Beispiel #12
0
        private void btnProperties_Click(object sender, EventArgs e)
        {
            this.Hide();
            PropertiesForm properties = new PropertiesForm();

            properties.Location      = this.Location;
            properties.StartPosition = this.StartPosition;
            properties.FormClosing  += delegate { this.Show(); };
            properties.ShowDialog();
        }
Beispiel #13
0
        protected void ADDNewPropertyRecord(object sender, DirectEventArgs e)
        {
            //Reset all values of the relative object

            PropertiesForm.Reset();

            this.EditPropertyWindow.Title = Resources.Common.AddNewRecord;


            this.EditPropertyWindow.Show();
        }
Beispiel #14
0
 void propertiesForm_ProcessCmdKeyEvent(PropertiesForm sender, ref Message ptr, Keys keys, ref bool handled)
 {
     if ((long)ptr.Msg == 256L)
     {
         Keys keys2     = keys & Keys.KeyCode;
         Keys modifiers = keys & ~keys2;
         if ((PropertiesForm.SelectedGridItem == null || PropertiesForm.SelectedGridItem.PropertyDescriptor == null || PropertiesForm.SelectedGridItem.PropertyDescriptor.IsReadOnly) && this.ToolsProcessKeyDownHotKeys(keys2, modifiers, true))
         {
             handled = true;
         }
     }
 }
        private void ViewPropertiesStripMenuItemClick(object sender, EventArgs e)
        {
            if (!(treeNavigation.SelectedNode?.Tag is ICoreItem itemToValue))
            {
                return;
            }
            //Load the form
            //
            var frm = new PropertiesForm(itemToValue);

            frm.ShowDialog();
        }
Beispiel #16
0
        private void toolStripButtonCreate_Click(object sender, EventArgs e)
        {
            try
            {
                int  index       = toolStripComboBoxAdapterType.SelectedIndex;
                Type adapterType = _adapterTypes[index];

                // First try the specialized constructor, if available.
                ConstructorInfo constructor = adapterType.GetConstructor(new Type[] { typeof(AdapterManagementComponent) });

                if (constructor == null)
                {// Try the default parameterless constructor.
                    constructor = adapterType.GetConstructor(new Type[] { });
                }

                if (constructor == null)
                {
                    SystemMonitor.Error("Constructor not found.");
                    return;
                }

                IIntegrationAdapter adapter;
                if (constructor.GetParameters() == null || constructor.GetParameters().Length == 0)
                {// Default constructor.
                    adapter = (IIntegrationAdapter)constructor.Invoke(null);
                }
                else
                {// Specialized constructor.
                    adapter = (IIntegrationAdapter)constructor.Invoke(new object[] { Operator });
                }

                if (adapter == null)
                {
                    MessageBox.Show("Failed to create adapter.");
                    return;
                }

                PropertiesForm form = new PropertiesForm("Adapter Properties", adapter);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    Operator.Adapters.Add(adapter);
                }
            }
            catch (Exception ex)
            {
                SystemMonitor.Error(GeneralHelper.GetExceptionMessage(ex));
                //if (ex.InnerException != null && string.IsNullOrEmpty(ex.InnerException.Message) == false)
                //{
                //    SystemMonitor.Error(ex.InnerException.Message);
                //}
            }
        }
Beispiel #17
0
 private void ButtonFileId_ExecuteEvent(object sender, ExecuteEventArgs e)
 {
     try
     {
         PropertiesForm dialog = new PropertiesForm();
         dialog.SelectedObject  = null;
         dialog.SelectedObjects = DataManager.Instance.FileIdValues.ToArray();
         dialog.Header          = "FileId";
         if (dialog.ShowDialog(_form) == DialogResult.OK)
         {
         }
     }
     catch
     {
         throw;
     }
 }
Beispiel #18
0
 private void ButtonPowerZones_ExecuteEvent(object sender, ExecuteEventArgs e)
 {
     try
     {
         PropertiesForm dialog = new PropertiesForm();
         dialog.SelectedObjects = null;
         dialog.SelectedObject  = DataManager.Instance.PowerManager.GetPowerZones();
         dialog.Header          = "Power Zones";
         if (dialog.ShowDialog(_form) == DialogResult.OK)
         {
         }
     }
     catch
     {
         throw;
     }
 }
Beispiel #19
0
 private void ButtonMyExtras_ExecuteEvent(object sender, ExecuteEventArgs e)
 {
     try
     {
         PropertiesForm dialog = new PropertiesForm();
         dialog.SelectedObjects   = null;
         dialog.SelectedObject    = DataManager.Instance.SessionExtras;
         dialog.Grid.PropertySort = PropertySort.Categorized;
         dialog.Header            = "Session Extras";
         if (dialog.ShowDialog(_form) == DialogResult.OK)
         {
         }
     }
     catch
     {
         throw;
     }
 }
Beispiel #20
0
        private void buttonShowOrder_Click(object sender, EventArgs e)
        {
            List <Order> orders = GetSelectedOrders();

            if (orders.Count > 1)
            {
                MessageBox.Show("Select one order to modify.");
                return;
            }

            if (orders.Count == 0 || orders[0].IsOpenOrPending == false)
            {
                return;
            }

            PropertiesForm form = new PropertiesForm("Order", orders[0]);

            form.Show();
        }
Beispiel #21
0
        public DebugVisualizer(PluginManager pluginManager, SceneController sceneController)
            : base("Anomaly.GUI.DebugVisualizer.DebugVisualizer.layout")
        {
            this.pluginManager   = pluginManager;
            this.sceneController = sceneController;

            uiCallback = new GuiFrameworkUICallback();

            tree         = new Tree((ScrollView)window.findWidget("TreeScroller"));
            editTreeView = new EditInterfaceTreeView(tree, uiCallback);

            propertiesForm = new ScrollablePropertiesForm((ScrollView)window.findWidget("TableScroller"), uiCallback);

            objectEditor = new ObjectEditor(editTreeView, propertiesForm, uiCallback);

            this.Resized += DebugVisualizer_Resized;

            currentScene = sceneController.CurrentScene;

            splitter = new Splitter(window.findWidget("Splitter"));
            splitter.Widget1Resized += a => tree.layout();
            splitter.Widget2Resized += a => propertiesForm.layout();
        }
        public static void initialize(StandaloneController standaloneController)
        {
            if (load)
            {
                load = false;

                ResourceManager.Instance.load("Medical.Resources.CommonEditorIcons.xml");
                ResourceManager.Instance.load("Medical.Resources.TimelineImages.xml");
                ResourceManager.Instance.load("Medical.Resources.HandImages.xml");
                ResourceManager.Instance.load("Medical.Resources.RmlWysiwygIcons.xml");

                standaloneController.ViewHostFactory.addFactory(new RmlWysiwygComponentFactory());
                standaloneController.ViewHostFactory.addFactory(new DragAndDropFactory());
                standaloneController.ViewHostFactory.addFactory(new GenericEditorComponentFactory());
                standaloneController.ViewHostFactory.addFactory(new PropTimelineFactory(standaloneController.Clipboard));
                standaloneController.ViewHostFactory.addFactory(new TimelineComponentFactory(standaloneController.Clipboard));
                standaloneController.ViewHostFactory.addFactory(new MovementSequenceEditorFactory(standaloneController.MovementSequenceController, standaloneController.Clipboard));

                PropertiesForm.addFormCreationMethod(typeof(ChangeHandPosition), (property, parentWidget) =>
                {
                    return(new PoseableHandProperties(property, parentWidget));
                });
            }
        }
        private void toolStripButtonProperties_Click(object sender, EventArgs e)
        {
            PropertiesForm form = new PropertiesForm("Expert Properties", _expert);

            form.ShowDialog();
        }
Beispiel #24
0
 private void UpdatePropertiesView(params object[] objects)
 {
     PropertiesForm.SelectObjects(objects);
     PropertiesForm.RefreshProperties();
 }
Beispiel #25
0
        void propertiesForm_ContextMenuOpening(ContextMenuStrip contextMenuStrip)
        {
            if (PropertiesForm.SelectedGridItem != null && PropertiesForm.SelectedGridItem.Label == "Tags")
            {
                List <Entity> entitiesSelected = EntityWorld.Instance.SelectedEntities;

                var q = entitiesSelected.Select(_entity =>
                {
                    var _tags = _entity.Tags.Select(_tag => new Entity.TagInfo(_tag.Name, _tag.Value));
                    return(new UndoObjectsPropertyChangeAction.Item(_entity, typeof(Entity).GetProperty("Tags"), _tags));
                });

                contextMenuStrip.Items.Add(new ToolStripSeparator());
                //*
                string            textAddTag = ToolsLocalization.Translate("Various", "Add Tag");
                ToolStripMenuItem tsmiAddTag = new ToolStripMenuItem(textAddTag, Properties.Resources.new_16, delegate(object s, EventArgs e2)
                {
                    EntityAddTagDialog entityAddTagDialog = new EntityAddTagDialog();
                    if (entityAddTagDialog.ShowDialog() == DialogResult.OK)
                    {
                        UndoSystem.Instance.CommitAction(new UndoObjectsPropertyChangeAction(q.ToArray()));
                        foreach (Entity current in entitiesSelected)
                        {
                            current.SetTag(entityAddTagDialog.TagName, entityAddTagDialog.TagValue);
                        }

                        PropertiesForm.RefreshProperties();
                        MapWorld.Instance.Modified = true;
                    }
                });
                tsmiAddTag.Enabled = true;
                contextMenuStrip.Items.Add(tsmiAddTag);

                List <string> tagsSet = entitiesSelected.SelectMany(_entity => _entity.Tags.Select(_tag => _tag.Name)).Distinct().ToList();

                string            textRemoveTag = ToolsLocalization.Translate("Various", "Remove Tag");
                ToolStripMenuItem tsmiRemoveTag = new ToolStripMenuItem(textRemoveTag, Properties.Resources.delete_16);
                tsmiRemoveTag.Enabled = (tagsSet.Count != 0);
                contextMenuStrip.Items.Add(tsmiRemoveTag);

                foreach (string tag in tagsSet)
                {
                    ToolStripMenuItem tsmiDeleteTag = new ToolStripMenuItem(tag, Properties.Resources.item_16, delegate(object s, EventArgs e2)
                    {
                        string name = (string)((ToolStripMenuItem)s).Tag;
                        UndoSystem.Instance.CommitAction(new UndoObjectsPropertyChangeAction(q.ToArray()));
                        foreach (Entity current in entitiesSelected)
                        {
                            current.RemoveTag(name);
                        }

                        PropertiesForm.RefreshProperties();
                        MapWorld.Instance.Modified = true;
                    });
                    tsmiDeleteTag.Tag = tag;
                    contextMenuStrip.Items.Add(tsmiRemoveTag);

                    tsmiRemoveTag.DropDownItems.Add(tsmiDeleteTag);
                }
            }
        }
        void createItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item = (ToolStripMenuItem)sender;
            Type componentType     = (Type)item.Tag;

            PlatformComponent component = null;

            bool showPropertiesForm = ComponentManagementAttribute.GetTypeAttribute(componentType).RequestPreStartSetup;

            if (ComponentManagementAttribute.GetTypeAttribute(componentType).IsMandatory)
            {// Mandatory components we do not create, only show / hide.
                component = _platform.GetFirstComponentByType(componentType);
                component.UISerializationInfo.AddValue("componentVisible", true);

                platform_ActiveComponentAddedEvent(component, false);
                return;
            }

            if (componentType.IsSubclassOf(typeof(Expert)))
            {
                component          = new LocalExpertHost(UserFriendlyNameAttribute.GetTypeAttributeName(componentType), componentType);
                showPropertiesForm = showPropertiesForm || ComponentManagementAttribute.GetTypeAttribute(typeof(LocalExpertHost)).RequestPreStartSetup;
            }
            else if (componentType.IsSubclassOf(typeof(WizardControl)))
            {// Wizards are run in Hosting forms.
                ConstructorInfo info = componentType.GetConstructor(new Type[] { typeof(Platform) });

                if (info != null)
                {
                    WizardControl wizardControl = (WizardControl)info.Invoke(new object[] { _platform });
                    HostingForm   hostingForm   = new HostingForm(UserFriendlyNameAttribute.GetTypeAttributeName(componentType), wizardControl);
                    hostingForm.Icon = Resources.magic_wand1;
                    hostingForm.Show();
                    return;
                }
            }
            else if (componentType.IsSubclassOf(typeof(CommonBaseControl)))
            {// Tester/editor etc. controls have no components, they are standalone UI components.
                ConstructorInfo info = componentType.GetConstructor(new Type[] { });
                // If failed to find orderInfo, just fall trough to failed to create component (which remains null).
                if (info != null)
                {// Since this is a UI only component, just create and return.
                    CommonBaseControl testerControl = (CommonBaseControl)info.Invoke(new object[] { });
                    /*tabControl.SelectedTab = */ AddComponentControl(testerControl, true);

                    return;
                }
            }
            else
            {
                ConstructorInfo info = componentType.GetConstructor(new Type[] { });
                if (info != null)
                {
                    component = (PlatformComponent)info.Invoke(new object[] { });
                }
            }

            // ...
            if (component == null)
            {
                MessageBox.Show("Failed to create component.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Set settings for component.
            if (component.SetInitialState(_platform.Settings) == false)
            {
                MessageBox.Show("Component failed to initialize from initial state.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            if (showPropertiesForm)
            {
                // Show properties for the user to configure.
                PropertiesForm form = new PropertiesForm("Properties", component);
                if (form.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }

            // Register to platform.
            _platform.RegisterComponent(component);
        }