Методы загрузки и выгрузки xml
This commit is contained in:
parent
ed483159e8
commit
2ce5f9b653
@ -35,5 +35,17 @@ namespace DesktopTools.Interfaces
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model"></param>
|
/// <param name="model"></param>
|
||||||
void Open(ControlOpenModel model);
|
void Open(ControlOpenModel model);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение настроек в xml-строку
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
string SaveToXml();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Загрузка настроек из xml-строки
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="xml"></param>
|
||||||
|
void LoadFromXml(string xml);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -18,5 +18,17 @@ namespace DesktopTools.Interfaces
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
IControl GetInstanceControl();
|
IControl GetInstanceControl();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение настроек в xml-строку
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
string SaveControlToXml();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Загрузка настроек из xml-строки
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="xml"></param>
|
||||||
|
void LoadControlFromXml(string xml);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -25,5 +25,17 @@ namespace DesktopTools.Interfaces
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
string GetTitleFromIdControl(Guid id);
|
string GetTitleFromIdControl(Guid id);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Сохранение настроек в xml-строку
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
string SaveControlToXml();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Загрузка настроек из xml-строки
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="xml"></param>
|
||||||
|
void LoadControlFromXml(string xml);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,6 +13,7 @@ using System;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace DesktopTools.Controls
|
namespace DesktopTools.Controls
|
||||||
{
|
{
|
||||||
@ -50,14 +51,29 @@ namespace DesktopTools.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private event Action<Guid> CloseElementEvent;
|
private event Action<Guid> CloseElementEvent;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// События установки одинаковой ширины для заголовков контролов
|
||||||
|
/// </summary>
|
||||||
private event Action<int> SetTitleWidth;
|
private event Action<int> SetTitleWidth;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Событие установки значения
|
||||||
|
/// </summary>
|
||||||
private event Action<object> SetValues;
|
private event Action<object> SetValues;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Событие сброса значения в исходное состояние
|
||||||
|
/// </summary>
|
||||||
private event Action DropValues;
|
private event Action DropValues;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Событие проверки заполненности контрола
|
||||||
|
/// </summary>
|
||||||
private event Func<bool> CheckValues;
|
private event Func<bool> CheckValues;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Событие получения значения из контрола
|
||||||
|
/// </summary>
|
||||||
private event Action<object> GetValues;
|
private event Action<object> GetValues;
|
||||||
|
|
||||||
private E Element
|
private E Element
|
||||||
@ -79,7 +95,7 @@ namespace DesktopTools.Controls
|
|||||||
}
|
}
|
||||||
if (page.Controls[0] is IControlChildEntity cntrl)
|
if (page.Controls[0] is IControlChildEntity cntrl)
|
||||||
{
|
{
|
||||||
cntrl.ParentObject = _element;
|
cntrl.ParentId = _element.Id;
|
||||||
cntrl.Open(new ControlOpenModel { OpenMode = ControlOpenMode.Child });
|
cntrl.Open(new ControlOpenModel { OpenMode = ControlOpenMode.Child });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,6 +145,20 @@ namespace DesktopTools.Controls
|
|||||||
Dock = DockStyle.Fill;
|
Dock = DockStyle.Fill;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IControl GetInstanceControl() => _genericControlViewEntityElement?.GetInstanceGenericControl();
|
||||||
|
|
||||||
|
public string SaveControlToXml() => new XElement("Control",
|
||||||
|
new XAttribute("Type", GetType().FullName),
|
||||||
|
new XAttribute("ControlId", ControlId),
|
||||||
|
new XAttribute("Title", Title)).ToString();
|
||||||
|
|
||||||
|
public void LoadControlFromXml(string xml)
|
||||||
|
{
|
||||||
|
var control = XElement.Parse(xml).Element("Control");
|
||||||
|
ControlId = new Guid(control.Attribute("ControlId").Value.ToString());
|
||||||
|
Title = control.Attribute("Title").Value.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
private void InitEvents()
|
private void InitEvents()
|
||||||
{
|
{
|
||||||
toolStripButtonSave.Click += (object sender, EventArgs e) => { Save(); };
|
toolStripButtonSave.Click += (object sender, EventArgs e) => { Save(); };
|
||||||
@ -295,7 +325,7 @@ namespace DesktopTools.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Save()
|
private bool Save()
|
||||||
{
|
{
|
||||||
if (CheckValues.GetInvocationList().Select(x => (bool)x.DynamicInvoke()).ToList().Any(x => !x))
|
if (CheckValues.GetInvocationList().Select(x => (bool)x.DynamicInvoke()).ToList().Any(x => !x))
|
||||||
{
|
{
|
||||||
@ -334,7 +364,5 @@ namespace DesktopTools.Controls
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IControl GetInstanceControl() => _genericControlViewEntityElement?.GetInstanceGenericControl();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using DesktopTools.Models;
|
|||||||
using ModuleTools.Attributes;
|
using ModuleTools.Attributes;
|
||||||
using ModuleTools.BindingModels;
|
using ModuleTools.BindingModels;
|
||||||
using ModuleTools.BusinessLogics;
|
using ModuleTools.BusinessLogics;
|
||||||
|
using ModuleTools.Enums;
|
||||||
using ModuleTools.Extensions;
|
using ModuleTools.Extensions;
|
||||||
using ModuleTools.ViewModels;
|
using ModuleTools.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
@ -13,6 +14,7 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace DesktopTools.Controls
|
namespace DesktopTools.Controls
|
||||||
{
|
{
|
||||||
@ -94,6 +96,43 @@ namespace DesktopTools.Controls
|
|||||||
public IControl GetInstanceControl() => _genericControlViewEntityList?.GetInstanceGenericControl();
|
public IControl GetInstanceControl() => _genericControlViewEntityList?.GetInstanceGenericControl();
|
||||||
|
|
||||||
public string GetTitleFromIdControl(Guid id) => _businessLogic.GetElement(new G { Id = id })?.ToString();
|
public string GetTitleFromIdControl(Guid id) => _businessLogic.GetElement(new G { Id = id })?.ToString();
|
||||||
|
|
||||||
|
public string SaveControlToXml() => new XElement("Control",
|
||||||
|
new XAttribute("Type", GetType().FullName),
|
||||||
|
new XAttribute("ControlId", ControlId),
|
||||||
|
new XAttribute("Title", Title),
|
||||||
|
new XAttribute("AccessOperation", AccessOperation),
|
||||||
|
new XElement("Configurate",
|
||||||
|
new XElement("Page", toolStripTextBoxPage.Text),
|
||||||
|
new XElement("CountElementsOnPage", toolStripTextBoxCountRecords.Text),
|
||||||
|
new XElement("PageName",
|
||||||
|
new XElement("Key", ((toolStripComboBoxPageNames.SelectedItem as PageNamesForPaginationModel)?.Key ?? "-")),
|
||||||
|
new XElement("Value", ((toolStripComboBoxPageNames.SelectedItem as PageNamesForPaginationModel)?.Value ?? "-"))),
|
||||||
|
new XElement("ParentId", ParentId?.ToString() ?? "-"))).ToString();
|
||||||
|
|
||||||
|
public void LoadControlFromXml(string xml)
|
||||||
|
{
|
||||||
|
var control = XElement.Parse(xml).Element("Control");
|
||||||
|
ControlId = new Guid(control.Attribute("ControlId").Value.ToString());
|
||||||
|
Title = control.Attribute("Title").Value.ToString();
|
||||||
|
AccessOperation = (AccessOperation)Enum.Parse(typeof(AccessOperation), control.Attribute("AccessOperation").Value.ToString());
|
||||||
|
var config = control.Element("Configurate");
|
||||||
|
toolStripTextBoxPage.Text = config.Element("Page").Value.ToString();
|
||||||
|
toolStripTextBoxCountRecords.Text = config.Element("CountElementsOnPage").Value.ToString();
|
||||||
|
if (config.Element("PageName").Element("Key").Value.ToString() != "-")
|
||||||
|
{
|
||||||
|
var pageName = new PageNamesForPaginationModel
|
||||||
|
{
|
||||||
|
Key = config.Element("PageName").Element("Key").Value.ToString(),
|
||||||
|
Value = config.Element("PageName").Element("Value").Value.ToString()
|
||||||
|
};
|
||||||
|
toolStripComboBoxPageNames.SelectedItem = pageName;
|
||||||
|
}
|
||||||
|
if (config.Element("ParentId").Value.ToString() != "-")
|
||||||
|
{
|
||||||
|
ParentId = new Guid(config.Element("ParentId").Value.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -330,13 +369,9 @@ namespace DesktopTools.Controls
|
|||||||
|
|
||||||
if (ParentPropertyName.IsNotEmpty())
|
if (ParentPropertyName.IsNotEmpty())
|
||||||
{
|
{
|
||||||
if (ParentObject != null)
|
if (ParentId.HasValue)
|
||||||
{
|
{
|
||||||
var property = ParentObject.GetType().GetProperty("Id");
|
await Task.Run(() => data = GetDataFromParent(ParentId.Value));
|
||||||
if (property != null)
|
|
||||||
{
|
|
||||||
await Task.Run(() => data = GetDataFromParent(new Guid(property.GetValue(ParentObject).ToString())));
|
|
||||||
}
|
|
||||||
Visible = true;
|
Visible = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -495,10 +530,9 @@ namespace DesktopTools.Controls
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var control = ControlViewEntityElement.GetInstance() as IControlChildEntity;
|
var control = ControlViewEntityElement.GetInstance() as IControlChildEntity;
|
||||||
var property = ParentObject?.GetType()?.GetProperty("Id");
|
if (ParentId.HasValue)
|
||||||
if (property != null)
|
|
||||||
{
|
{
|
||||||
control.ParentId = new Guid(property.GetValue(ParentObject).ToString());
|
control.ParentId = ParentId;
|
||||||
control.ParentPropertyName = ParentPropertyName;
|
control.ParentPropertyName = ParentPropertyName;
|
||||||
}
|
}
|
||||||
if (toolStripFooter.Visible && toolStripComboBoxPageNames.Visible)
|
if (toolStripFooter.Visible && toolStripComboBoxPageNames.Visible)
|
||||||
|
@ -24,6 +24,10 @@ namespace DesktopTools.Controls
|
|||||||
|
|
||||||
public IControl GetInstance() => _controlViewEntityElement?.GetInstanceControl();
|
public IControl GetInstance() => _controlViewEntityElement?.GetInstanceControl();
|
||||||
|
|
||||||
|
public string SaveToXml() => _controlViewEntityElement?.SaveControlToXml();
|
||||||
|
|
||||||
|
public void LoadFromXml(string xml) => _controlViewEntityElement?.LoadControlFromXml(xml);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IControlChildEntity
|
#region IControlChildEntity
|
||||||
|
@ -23,6 +23,10 @@ namespace DesktopTools.Controls
|
|||||||
public void Open(ControlOpenModel model) => _controlViewEntityList?.OpenControl(model);
|
public void Open(ControlOpenModel model) => _controlViewEntityList?.OpenControl(model);
|
||||||
|
|
||||||
public IControl GetInstance() => _controlViewEntityList?.GetInstanceControl();
|
public IControl GetInstance() => _controlViewEntityList?.GetInstanceControl();
|
||||||
|
|
||||||
|
public string SaveToXml() => _controlViewEntityList?.SaveControlToXml();
|
||||||
|
|
||||||
|
public void LoadFromXml(string xml) => _controlViewEntityList?.LoadControlFromXml(xml);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IControlEntityList
|
#region IControlEntityList
|
||||||
|
@ -34,12 +34,10 @@ namespace DepartmentPortalDesctop
|
|||||||
this.dataGridViewControls = new System.Windows.Forms.DataGridView();
|
this.dataGridViewControls = new System.Windows.Forms.DataGridView();
|
||||||
this.ColumnControlId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.ColumnControlId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.ColumnControlName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
this.ColumnControlName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||||
this.splitContainerMain = new System.Windows.Forms.SplitContainer();
|
|
||||||
this.ButtonShowHideControlList = new System.Windows.Forms.Button();
|
this.ButtonShowHideControlList = new System.Windows.Forms.Button();
|
||||||
|
this.panelControl = new System.Windows.Forms.Panel();
|
||||||
this.panelControls.SuspendLayout();
|
this.panelControls.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridViewControls)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridViewControls)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainerMain)).BeginInit();
|
|
||||||
this.splitContainerMain.SuspendLayout();
|
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// menuMain
|
// menuMain
|
||||||
@ -97,20 +95,6 @@ namespace DepartmentPortalDesctop
|
|||||||
this.ColumnControlName.Name = "ColumnControlName";
|
this.ColumnControlName.Name = "ColumnControlName";
|
||||||
this.ColumnControlName.ReadOnly = true;
|
this.ColumnControlName.ReadOnly = true;
|
||||||
//
|
//
|
||||||
// splitContainerMain
|
|
||||||
//
|
|
||||||
this.splitContainerMain.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
||||||
this.splitContainerMain.Location = new System.Drawing.Point(216, 24);
|
|
||||||
this.splitContainerMain.Name = "splitContainerMain";
|
|
||||||
this.splitContainerMain.Panel1MinSize = 100;
|
|
||||||
//
|
|
||||||
// splitContainerMain.Panel2
|
|
||||||
//
|
|
||||||
this.splitContainerMain.Panel2.AutoScroll = true;
|
|
||||||
this.splitContainerMain.Size = new System.Drawing.Size(584, 426);
|
|
||||||
this.splitContainerMain.SplitterDistance = 295;
|
|
||||||
this.splitContainerMain.TabIndex = 2;
|
|
||||||
//
|
|
||||||
// ButtonShowHideControlList
|
// ButtonShowHideControlList
|
||||||
//
|
//
|
||||||
this.ButtonShowHideControlList.Dock = System.Windows.Forms.DockStyle.Left;
|
this.ButtonShowHideControlList.Dock = System.Windows.Forms.DockStyle.Left;
|
||||||
@ -122,12 +106,20 @@ namespace DepartmentPortalDesctop
|
|||||||
this.ButtonShowHideControlList.UseVisualStyleBackColor = true;
|
this.ButtonShowHideControlList.UseVisualStyleBackColor = true;
|
||||||
this.ButtonShowHideControlList.Click += new System.EventHandler(this.ButtonShowHideControlList_Click);
|
this.ButtonShowHideControlList.Click += new System.EventHandler(this.ButtonShowHideControlList_Click);
|
||||||
//
|
//
|
||||||
|
// panelControl
|
||||||
|
//
|
||||||
|
this.panelControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.panelControl.Location = new System.Drawing.Point(216, 24);
|
||||||
|
this.panelControl.Name = "panelControl";
|
||||||
|
this.panelControl.Size = new System.Drawing.Size(584, 426);
|
||||||
|
this.panelControl.TabIndex = 4;
|
||||||
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||||
this.Controls.Add(this.splitContainerMain);
|
this.Controls.Add(this.panelControl);
|
||||||
this.Controls.Add(this.ButtonShowHideControlList);
|
this.Controls.Add(this.ButtonShowHideControlList);
|
||||||
this.Controls.Add(this.panelControls);
|
this.Controls.Add(this.panelControls);
|
||||||
this.Controls.Add(this.menuMain);
|
this.Controls.Add(this.menuMain);
|
||||||
@ -138,8 +130,6 @@ namespace DepartmentPortalDesctop
|
|||||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||||
this.panelControls.ResumeLayout(false);
|
this.panelControls.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridViewControls)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridViewControls)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainerMain)).EndInit();
|
|
||||||
this.splitContainerMain.ResumeLayout(false);
|
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
@ -149,11 +139,11 @@ namespace DepartmentPortalDesctop
|
|||||||
|
|
||||||
private System.Windows.Forms.MenuStrip menuMain;
|
private System.Windows.Forms.MenuStrip menuMain;
|
||||||
private System.Windows.Forms.Panel panelControls;
|
private System.Windows.Forms.Panel panelControls;
|
||||||
private System.Windows.Forms.SplitContainer splitContainerMain;
|
|
||||||
private System.Windows.Forms.Button ButtonShowHideControlList;
|
private System.Windows.Forms.Button ButtonShowHideControlList;
|
||||||
private System.Windows.Forms.DataGridView dataGridViewControls;
|
private System.Windows.Forms.DataGridView dataGridViewControls;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnControlId;
|
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnControlId;
|
||||||
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnControlName;
|
private System.Windows.Forms.DataGridViewTextBoxColumn ColumnControlName;
|
||||||
|
private System.Windows.Forms.Panel panelControl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,8 +74,8 @@ namespace DepartmentPortalDesctop
|
|||||||
ctrl.Open(new ControlOpenModel { OpenMode = ControlOpenMode.List, CloseList = CloseControl });
|
ctrl.Open(new ControlOpenModel { OpenMode = ControlOpenMode.List, CloseList = CloseControl });
|
||||||
_controls.Add(ctrl.ControlId, ctrl);
|
_controls.Add(ctrl.ControlId, ctrl);
|
||||||
|
|
||||||
splitContainerMain.Panel1.Controls.Clear();
|
panelControl.Controls.Clear();
|
||||||
splitContainerMain.Panel1.Controls.Add(ctrl as UserControl);
|
panelControl.Controls.Add(ctrl as UserControl);
|
||||||
dataGridViewControls.Rows.Add(new object[] { ctrl.ControlId, ctrl.Title });
|
dataGridViewControls.Rows.Add(new object[] { ctrl.ControlId, ctrl.Title });
|
||||||
dataGridViewControls.Rows[^1].Selected = true;
|
dataGridViewControls.Rows[^1].Selected = true;
|
||||||
}
|
}
|
||||||
@ -132,8 +132,8 @@ namespace DepartmentPortalDesctop
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
splitContainerMain.Panel1.Controls.Clear();
|
panelControl.Controls.Clear();
|
||||||
splitContainerMain.Panel1.Controls.Add(ctrl as UserControl);
|
panelControl.Controls.Add(ctrl as UserControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonShowHideControlList_Click(object sender, EventArgs e)
|
private void ButtonShowHideControlList_Click(object sender, EventArgs e)
|
||||||
|
@ -28,7 +28,7 @@ namespace DepartmentPortalDesctop
|
|||||||
|
|
||||||
if (form.ShowDialog() == DialogResult.OK && securityManager.IsAuth)
|
if (form.ShowDialog() == DialogResult.OK && securityManager.IsAuth)
|
||||||
{
|
{
|
||||||
Application.Run(DependencyManager.Instance.Resolve<FormMain>());
|
Application.Run(new FormMain());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user