Добавление выпадающего спсика
This commit is contained in:
parent
c5d3000878
commit
23a136e0b4
@ -56,6 +56,7 @@ namespace DesktopTools.BaseControls
|
||||
public AbstractBaseControl(string propertyName, bool mustFilling, bool readOnly)
|
||||
{
|
||||
InitializeComponent();
|
||||
Name = $"Control{propertyName}";
|
||||
_propertyName = propertyName;
|
||||
_mustFilling = mustFilling;
|
||||
panelControl.Enabled = !readOnly;
|
||||
|
@ -10,6 +10,7 @@ using ModuleTools.Enums;
|
||||
using ModuleTools.Extensions;
|
||||
using ModuleTools.ViewModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows.Forms;
|
||||
@ -179,7 +180,8 @@ namespace DesktopTools.Controls
|
||||
}
|
||||
}
|
||||
};
|
||||
toolStripButtonClose.Click += (object sender, EventArgs e) => {
|
||||
toolStripButtonClose.Click += (object sender, EventArgs e) =>
|
||||
{
|
||||
if (_haveChages && DialogHelper.MessageQuestion("Имеется несохраненные данные, вы действительно хотите закрыть элемент?", "Закрытие элемента") == DialogResult.Yes)
|
||||
{
|
||||
if (!Save())
|
||||
@ -202,7 +204,9 @@ namespace DesktopTools.Controls
|
||||
ToolStripMenuItem item = new() { Text = elem.Value.Title, Name = elem.Key };
|
||||
item.Click += elem.Value.Event;
|
||||
toolStripSplitButtonActions.DropDownItems.Add(item);
|
||||
contextMenuStripElement.Items.Add(item);
|
||||
ToolStripMenuItem itemContext = new() { Text = elem.Value.Title, Name = elem.Key };
|
||||
itemContext.Click += elem.Value.Event;
|
||||
contextMenuStripElement.Items.Add(itemContext);
|
||||
}
|
||||
}
|
||||
// либо скрытие пункта, если не предусмотренно подпунктов
|
||||
@ -387,5 +391,23 @@ namespace DesktopTools.Controls
|
||||
}
|
||||
|
||||
private ControlViewEntityElementConfiguration GetConfig() => _genericControlViewEntityElement?.GetConfigControl();
|
||||
|
||||
protected bool FillModel(S model)
|
||||
{
|
||||
if (CheckValues.GetInvocationList().Select(x => (bool)x.DynamicInvoke()).ToList().Any(x => !x))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
GetValues(model);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
DialogHelper.MessageException(ex.Message, "Ошибка при получении значений");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +217,9 @@ namespace DesktopTools.Controls
|
||||
ToolStripMenuItem item = new() { Text = elem.Value.Title, Name = elem.Key };
|
||||
item.Click += elem.Value.Event;
|
||||
toolStripSplitButtonActions.DropDownItems.Add(item);
|
||||
contextMenuStripDataGrid.Items.Add(item);
|
||||
ToolStripMenuItem itemContext = new() { Text = elem.Value.Title, Name = elem.Key };
|
||||
itemContext.Click += elem.Value.Event;
|
||||
contextMenuStripDataGrid.Items.Add(itemContext);
|
||||
}
|
||||
}
|
||||
// либо скрытие пункта, если не предусмотренно подпунктов
|
||||
|
@ -26,7 +26,6 @@ namespace DesktopTools.Controls
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainControlViewEntityElement));
|
||||
this.toolStripActions = new System.Windows.Forms.ToolStrip();
|
||||
this.toolStripButtonSave = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripButtonReload = new System.Windows.Forms.ToolStripButton();
|
||||
@ -91,7 +90,6 @@ namespace DesktopTools.Controls
|
||||
// toolStripSplitButtonActions
|
||||
//
|
||||
this.toolStripSplitButtonActions.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
|
||||
this.toolStripSplitButtonActions.Image = ((System.Drawing.Image)(resources.GetObject("toolStripSplitButtonActions.Image")));
|
||||
this.toolStripSplitButtonActions.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripSplitButtonActions.Name = "toolStripSplitButtonActions";
|
||||
this.toolStripSplitButtonActions.Size = new System.Drawing.Size(74, 22);
|
||||
@ -130,6 +128,7 @@ namespace DesktopTools.Controls
|
||||
// contextMenuStripElement
|
||||
//
|
||||
this.contextMenuStripElement.Name = "contextMenuStripElement";
|
||||
this.contextMenuStripElement.Size = new System.Drawing.Size(61, 4);
|
||||
//
|
||||
// MainControlViewEntityElement
|
||||
//
|
||||
|
@ -57,14 +57,4 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing.Common" name="System.Drawing.Common, Version=5.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" />
|
||||
<data name="toolStripSplitButtonActions.Image" type="System.Drawing.Bitmap, System.Drawing.Common" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACRSURBVDhPY/j27dt/SjDYACcnJ7IwigEf3n8kCZNswPNb
|
||||
J/+f6DYF0yA+yQac6Db5f6hWCmwIiE+mC0wIu2DS2Vf/F1x6DefjwlgNyNr34r/0wkdgTMgQDAOQNRNj
|
||||
CIoBOg0rMTTDMLIhIHbriZeYBmDTiIxBGkEYxge5liQDsGGQqykyAISpZwAlmIEywMAAAAc1/Jwvt6sN
|
||||
AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user