Class AlterFileProperty
A view command that opens a file and returns the selected file as a byte array. For example:
byte[] myFile = null;
var cmd = new AlterFileProperty(View.Displayer,
(dll) => myFile = dll,
() => true,
new LemonEdge.Core.Client.CommandDecriptor("Change Dll", Images.ImageType.AddIn, "Select a new dll for this add-in."),
new (string, string)[] { (".net Dlls", "*.dll"), ("All Files", "*.*") });
Inheritance
System.Object
AlterFileProperty
Implements
System.IDisposable
System.Windows.Input.ICommand
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: LemonEdge.Client.Core.Commands.ViewCommands
Assembly: ClientCore.dll
Syntax
public class AlterFileProperty : ViewCommand, IHasChildren<EPCommandWithDescriptor>, IHasChildren, IDisposable, IEPCommandWithDescriptor, IEPCommand, ICommand, ICommandDescriptor
Constructors
AlterFileProperty(IModelLayoutDisplayer, Func<Byte[], Task>, Func<Boolean>, ICommandDescriptor, Func<(String FileTypeName, String fileType)[]>)
Creates a new alter file command
Declaration
public AlterFileProperty(IModelLayoutDisplayer owner, Func<byte[], Task> fileSelected, Func<bool> canExecute, ICommandDescriptor descriptor, Func<(string FileTypeName, string fileType)[]> getFileTypes)
Parameters
Type | Name | Description |
---|---|---|
IModelLayoutDisplayer | owner | The owning host context for this command |
System.Func<System.Byte[], System.Threading.Tasks.Task> | fileSelected | The method that is called when a file has been selected by the user from invoking this command |
System.Func<System.Boolean> | canExecute | A function that returns true if a file is valid to be selected or not |
ICommandDescriptor | descriptor | A descriptor to use for the title, icon, etc and other attributes of this command |
System.Func<System.ValueTuple<System.String, System.String>[]> | getFileTypes |
Properties
Description
Declaration
public override string Description { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
IconID
Declaration
public override Guid IconID { get; }
Property Value
Type | Description |
---|---|
System.Guid |
Overrides
OverlayIconID
Declaration
public override Guid? OverlayIconID { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Guid> |
Overrides
Title
Declaration
public override string Title { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
ToolTip
Declaration
public override string ToolTip { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
Methods
InternalCanExecute(Object)
Returns if this command can be executed or not
Declaration
public override bool InternalCanExecute(object parameter)
Parameters
Type | Name | Description |
---|---|---|
System.Object | parameter | The command parameter |
Returns
Type | Description |
---|---|
System.Boolean | True if this command can be executed |
Overrides
InternalExecuteAsync(Object)
Displays a prompt to the user for a file to be selected then reads and returns the file as a byte array to the owner of this command
Declaration
public override Task InternalExecuteAsync(object parameter)
Parameters
Type | Name | Description |
---|---|---|
System.Object | parameter | The command parameter |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task indicating the completion of this operation |
Overrides
Implements
System.IDisposable
System.Windows.Input.ICommand