-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
108 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
#nullable enable | ||
|
||
namespace MemoGenerator.Model.MemoGenerating | ||
{ | ||
sealed class RecipientModel : BaseINotifyPropertyChanged | ||
{ | ||
private string? name; | ||
private string? emailAddress; | ||
|
||
internal string memoComponent | ||
{ | ||
get | ||
{ | ||
List<String> elements = new List<string>(); | ||
if (name != null) | ||
{ | ||
elements.Add(name); | ||
} | ||
if (emailAddress != null) | ||
{ | ||
elements.Add(emailAddress); | ||
} | ||
return String.Join(" ", elements); | ||
} | ||
} | ||
|
||
internal RecipientModel() | ||
{ | ||
initializeRecipientModel(); | ||
} | ||
|
||
internal void initializeRecipientModel() | ||
{ | ||
this.name = null; | ||
this.emailAddress = null; | ||
} | ||
|
||
// Bindings | ||
|
||
public string Name | ||
{ | ||
get => name ?? ""; | ||
set | ||
{ | ||
if (String.IsNullOrEmpty(value)) name = null; | ||
else name = value; | ||
} | ||
} | ||
|
||
public string EmailAddress | ||
{ | ||
get => emailAddress ?? ""; | ||
set | ||
{ | ||
if (String.IsNullOrEmpty(value)) emailAddress = null; | ||
else emailAddress = value; | ||
} | ||
} | ||
} | ||
} | ||
|
||
#nullable disable |