6using System.Threading.Tasks;
7using System.Windows.Input;
28 private readonly
Command signAsRole;
29 private readonly
Command proposeForRole;
30 private readonly
Command removeRole;
32 private readonly
Role role;
89 public Role
Role => this.role;
96 get => this.name.Value;
99 this.Role.Name = value;
100 this.name.Value = value;
109 get => this.description.Value;
117 get => this.descriptionAsMarkdown.Value;
120 string Language = this.designModel?.Language ?? this.contractModel?.Language ?? this.contract.DefaultLanguage;
124 this.role.Descriptions = this.role.Descriptions.Remove(Language);
126 this.role.Descriptions = this.role.Descriptions.Append(Text);
128 this.descriptionAsMarkdown.Value = value;
129 this.description.Value = value.ToSimpleXAML(this.contract, Language).Result;
138 get => this.minCount.Value;
141 this.role.MinCount = value;
142 this.minCount.Value = value;
151 get => this.maxCount.Value;
154 this.role.MaxCount = value;
155 this.maxCount.Value = value;
164 get => this.canRevoke.Value;
167 this.role.CanRevoke = value;
168 this.canRevoke.Value = value;
175 base.RaisePropertyChanged(PropertyName);
177 this.designModel?.RaisePropertyChanged(nameof(this.designModel.Roles));
180 internal void CanBeSignedChanged()
182 this.signAsRole.RaiseCanExecuteChanged();
183 this.proposeForRole.RaiseCanExecuteChanged();
197 return this.contractModel?.CanBeSigned ??
false;
207 if (this.contractModel is not
null)
208 await this.contractModel.SignAsRole(this.
Name);
227 return this.contractModel?.CanBeSigned ??
false;
235 if (this.contractModel is not
null)
236 await this.contractModel.ProposeForRole(this.
Name);
250 return this.designModel is not
null;
258 this.designModel?.RemoveRole(
this);
259 return Task.CompletedTask;
283 if (Texts.Length > 0)
284 this.DescriptionAsMarkdown = Texts[0].Trim();
Interaction logic for MainWindow.xaml
static void ErrorBox(string ErrorMessage)
Displays an error message on the screen, on the main UI thread.
Defines a custom command.
Abstract base class for ordered items
Contains information about a role
bool CanExecuteProposeForRole()
If the propose for role command can be exeucted.
int MinCount
Minimum number of signatures for this role required.
async Task ExecuteSignAsRole()
Proposes the contract.
void SetTranslatableTexts(string[] Texts, string Language)
Sets translated texts.
ICommand RemoveRole
Remove role command
async Task ExecuteProposeForRole()
Proposes the contract for a given role.
bool CanExecuteRemoveRole()
If the remove role command can be exeucted.
ICommand ProposeForRole
Propose for role command
RoleInfo(DesignModel DesignModel, Role Role, Property< RoleInfo[]> Roles)
Contains information about a role
override void RaisePropertyChanged(string PropertyName)
Raises the PropertyChanged event.
async Task< string[]> GetTranslatableTexts(string Language)
Gets associated texts to translate.
bool CanExecuteSignAsRole()
If the sign as role command can be exeucted.
RoleInfo(ContractModel ContractModel, Role Role, Property< RoleInfo[]> Roles)
Contains information about a role
object Description
Description (formatted) of the role.
int MaxCount
Maximum number of signatures for this role.
string DescriptionAsMarkdown
Description, as Markdown
bool CanRevoke
If the role can revoke the contract.
Role Role
Role reference object.
Task ExecuteRemoveRole()
Removes the role.
ICommand SignAsRole
Sign as role command
Generic class for properties
Contains the definition of a contract
string DefaultLanguage
Default language for contract.
Class representing human-readable text.
Task< string > GenerateMarkdown(Contract Contract)
Generates markdown for the human-readable text.
HumanReadableText[] Descriptions
Discriptions of the object, in different languages.
Task< string > ToMarkdown(string Language, Contract Contract)
Creates a human-readable Markdown document for the contract.
bool CanRevoke
If parts having this role, can revoke their signature, once signed.
int MaxCount
Largest amount of signatures of this role required for a legally binding contract.
int MinCount
Smallest amount of signatures of this role required for a legally binding contract.
string Name
Name of the role.
Interface for named items
Interface for translatable objects.
MarkdownType
Type of Markdown to generate