private void ModWorkbenchForm_Load(object sender, EventArgs e) { TopMost = true; _propertiesGrid.ClearSelection(); NativeWorkbench.Properties = _propertiesGrid; NativeWorkbench.Output = _outputTxt; _propertiesControl = new PropertiesControl(this, _propertiesGrid, _nativeGroupDDL, _nativeNameDDL, _addToPropBtn, _addOnTickBtn, _addImmediateBtn, _onTickTxt, _immediateSourceTxt, _outputTxt, _enablePropUpdate, _enableBoolColors); _propertiesGrid.Click += _propertiesGrid_Click; _onTickTxt.LostFocus += _onLostFocus; _immediateSourceTxt.LostFocus += _onLostFocus; _propertiesGrid.LostFocus += _onLostFocus; for (var i = 0; i < _propertiesGrid.Columns.Count; i++) { _propertiesGrid.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } onLoadWork(); }
private void RemoveAllGadgets() { while (Gadgets.Count > 0) { RemoveGadget(Gadgets[Gadgets.Count - 1]); } if (dataDictionaryControl != null) { canvasMain.Children.Remove(dataDictionaryControl); dataDictionaryControl = null; } if (propertiesControl != null) { canvasMain.Children.Remove(propertiesControl); propertiesControl = null; } Gadgets.Clear(); EnableDisableOptions(); }
void mnuProperties_Click(object sender, RoutedEventArgs e) { if (DashboardHelper != null) { if (propertiesControl != null) { canvasMain.Children.Remove(propertiesControl); } propertiesControl = new PropertiesControl(DashboardHelper, this); propertiesControl.Loaded += new RoutedEventHandler(propertiesControl_Loaded); propertiesControl.GadgetClosing += new GadgetClosingHandler(gadget_GadgetClosing); DragCanvas.SetZIndex(propertiesControl, 10000); canvasMain.Children.Add(propertiesControl); DragCanvas.SetCanBeDragged(propertiesControl, true); } }
public DirectoryBaseNode(string dn, List <string> oc, VMDirServerDTO serverDTO, PropertiesControl propCtl) : base(serverDTO, propCtl) { this.Dn = dn; this.ObjectClass = oc; Cn = VMDirServerDTO.DN2CN(dn); ImageIndex = SelectedImageIndex = MiscUtilsService.GetImgIndx(ObjectClass); this.Tag = "directory"; }
public void RegisterPropertyEditors() { MainForm mainForm = FindForm() as MainForm; if (mainForm == null || mainForm.ProjectModel == null) return; m_editorsRegistry.UnregisterAllControls(); m_editorsRegistry.RegisterControl<PropertyEditors.Number_PropertyEditor>("number"); m_editorsRegistry.RegisterControl<PropertyEditors.String_PropertyEditor>("string"); m_editorsRegistry.RegisterControl<PropertyEditors.Boolean_PropertyEditor>("boolean"); //m_controlsRegistry.RegisterControl<PropertyEditors.Asset_PropertyEditor>("asset"); //m_controlsRegistry.RegisterControl<PropertyEditors.Entity_PropertyEditor>("entity"); m_editorsRegistry.RegisterControl<PropertyEditors.PlayCanvas_Rgb_PropertyEditor>("rgb"); m_editorsRegistry.RegisterControl<PropertyEditors.PlayCanvas_Rgba_PropertyEditor>("rgba"); m_editorsRegistry.RegisterControl<PropertyEditors.PlayCanvas_Vector_PropertyEditor>("vector"); m_editorsRegistry.RegisterControl<PropertyEditors.PlayCanvas_Enumeration_PropertyEditor>("enumeration"); m_editorsRegistry.RegisterControl<PropertyEditors.PlayCanvas_Curve_PropertyEditor>("curve"); m_editorsRegistry.RegisterControl<PropertyEditors.PlayCanvas_ColorCurve_PropertyEditor>("colorcurve"); string assetsPath = Path.Combine(mainForm.ProjectModel.WorkingDirectory, "assets"); DirectoryInfo info = new DirectoryInfo(assetsPath); if (info.Exists) { FileInfo[] files = info.GetFiles("*.editor.json", SearchOption.AllDirectories); if (files != null && files.Length > 0) { foreach (var file in files) { try { string name = file.Name.Remove(file.Name.Length - ".editor.json".Length); string content = File.ReadAllText(file.FullName); if (!String.IsNullOrEmpty(content)) { PropertiesControl.TypeDescriptor typeDesc = JsonConvert.DeserializeObject<PropertiesControl.TypeDescriptor>(content); if (typeDesc == null || !m_editorsRegistry.RegisterControl(name, typeDesc)) throw new Exception("Cannot register custom editor: " + name); } else throw new Exception("Cannot load custom editor: " + file.FullName); } catch (Exception ex) { MetroMessageBox.Show(mainForm, ex.Message, "Registering custom editor error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } files = info.GetFiles("*.editor.html", SearchOption.AllDirectories); if (files != null && files.Length > 0) { foreach (var file in files) { try { string name = file.Name.Remove(file.Name.Length - ".editor.html".Length); if (!m_editorsRegistry.RegisterControl(name, file.FullName)) throw new Exception("Cannot register custom editor: " + name); } catch (Exception ex) { MetroMessageBox.Show(mainForm, ex.Message, "Registering custom editor error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } PropertiesModel model = new PropertiesModel(); var numberInfo = new PropertyEditors.Number_PropertyEditor.NumberInfo() { Min = 0.5f, Max = 1.5f }; model.Properties.Add(PropertiesModel.Property.Create<float, PropertyEditors.Number_PropertyEditor.NumberInfo>("number", "number", 1.0f, numberInfo)); model.Properties.Add(PropertiesModel.Property.Create<string>("string", "string", "text")); model.Properties.Add(PropertiesModel.Property.Create<bool>("boolean", "boolean", true)); //model.Properties.Add(PropertiesModel.Property.Create<PlayCanvas.Assets>("asset", "asset", null)); //model.Properties.Add(PropertiesModel.Property.Create<PlayCanvas.Entity>("entity", "entity", null)); model.Properties.Add(PropertiesModel.Property.Create<PlayCanvas.Color>("rgb", "rgb", new PlayCanvas.Color(1.0f, 0.5f, 0.0f))); model.Properties.Add(PropertiesModel.Property.Create<PlayCanvas.Color>("rgba", "rgba", new PlayCanvas.Color(0.0f, 0.5f, 1.0f, 0.5f))); model.Properties.Add(PropertiesModel.Property.Create<PlayCanvas.Vector>("vector", "vector", new PlayCanvas.Vector(0.0f, 1.0f, 0.0f))); var enumsInfo = new PropertyEditors.PlayCanvas_Enumeration_PropertyEditor.EnumerationInfo(); enumsInfo["Cat"] = 0; enumsInfo["Dog"] = 1; model.Properties.Add(PropertiesModel.Property.Create<int, PropertyEditors.PlayCanvas_Enumeration_PropertyEditor.EnumerationInfo>("enumeration", "enumeration", 0, enumsInfo)); var curveData = new float[] { 0.0f, 1.0f, 1.0f, 0.0f }; model.Properties.Add(PropertiesModel.Property.Create<PlayCanvas.Curve>("curve", "curve", new PlayCanvas.Curve(curveData))); var curveSetInfo = new PropertyEditors.PlayCanvas_Curve_PropertyEditor.CurveInfo() { Curves = new string[] { "x", "y", "z" } }; var curveSetData = new float[][] { new float[]{ 0.0f, 1.0f, 1.0f, 0.0f }, new float[]{ 0.0f, 0.5f, 1.0f, 0.5f } }; model.Properties.Add(PropertiesModel.Property.Create<PlayCanvas.CurveSet, PropertyEditors.PlayCanvas_Curve_PropertyEditor.CurveInfo>("curveSet", "curve", new PlayCanvas.CurveSet(curveSetData), curveSetInfo)); var colorCurveSetInfo = new PropertyEditors.PlayCanvas_ColorCurve_PropertyEditor.ColorCurveInfo() { Type = PropertyEditors.PlayCanvas_ColorCurve_PropertyEditor.ColorCurveType.RGB }; model.Properties.Add(PropertiesModel.Property.Create<PlayCanvas.CurveSet, PropertyEditors.PlayCanvas_ColorCurve_PropertyEditor.ColorCurveInfo>("colorCurve", "colorcurve", new PlayCanvas.CurveSet(), colorCurveSetInfo)); model.Properties.Add(PropertiesModel.Property.Create<CustomType>("CustomType", "CustomType")); model.Properties.Add(PropertiesModel.Property.Create<CustomType>("Date", "Date")); model.Properties.Add(new PropertiesModel.Property("Array", "[string]")); model.Properties.Add(new PropertiesModel.Property("Object", "{CustomType}")); PropertiesControl properties = new PropertiesControl(model, m_editorsRegistry); properties.Dock = DockStyle.Fill; m_inspectPanel.Content.Controls.Clear(); m_inspectPanel.Content.Controls.Add(properties); }