123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- using AIPractice.LabellerServer.Managers.Entities;
- using System;
- namespace AIPractice.LabellerServer.ViewModels
- {
- public class AccountViewModel : ViewModel
- {
- private string _name;
- private string _password;
- private string _id;
- private DateTime _createdTime;
- private bool _isSelected;
- private string _labels;
- private string _description;
- private bool _isReviewer;
- private string _email;
- public Account Account => new Account() { Id = Id, Name = Name, Password = Password, Description = string.IsNullOrEmpty(Description)? null:Description.Trim(), CreatedTime= CreatedTime, Labels = Labels, IsReviewer = IsReviewer, Email = Email};
- public event EventHandler IsSelectedChanged;
- public bool IsSelected
- {
- get => _isSelected;
- set
- {
- if (_isSelected != value)
- {
- _isSelected = value;
- OnIsSelectedChanged();
- OnPropertyChanged();
- }
- }
- }
- public string Id
- {
- get => _id;
- set
- {
- if (_id != value)
- {
- _id = value;
- OnPropertyChanged();
- }
- }
- }
- public string Name
- {
- get => _name;
- set
- {
- if (_name != value)
- {
- _name = value;
- OnPropertyChanged();
- }
- }
- }
- public string Password
- {
- get => _password;
- set
- {
- _password = value;
- OnPropertyChanged();
- }
- }
- public string Description
- {
- get => _description;
- set
- {
- if (_description != value)
- {
- _description = value;
- OnPropertyChanged();
- }
- }
- }
- public DateTime CreatedTime
- {
- get => _createdTime;
- set
- {
- if (_createdTime != value)
- {
- _createdTime = value;
- OnPropertyChanged();
- }
- }
- }
- public string Labels
- {
- get => _labels;
- set
- {
- if (_labels != value)
- {
- _labels = value;
- OnPropertyChanged();
- }
- }
- }
- public bool IsReviewer
- {
- get => _isReviewer;
- set
- {
- if (_isReviewer != value)
- {
- _isReviewer = value;
- OnPropertyChanged();
- }
- }
- }
- public string FriendlyName
- {
- get
- {
- if (string.IsNullOrEmpty(Description))
- {
- return Name;
- }
- return Description;
- }
- }
- public string Email
- {
- get => _email;
- set
- {
- if (_email != value)
- {
- _email = value;
- OnPropertyChanged();
- }
- }
- }
- public AccountViewModel Clone()
- {
- return new AccountViewModel
- {
- Id = Id,
- Name = Name,
- Password = Password,
- Description = string.IsNullOrEmpty(Description) ? null : Description.Trim(),
- CreatedTime = CreatedTime,
- Labels = Labels,
- IsReviewer = IsReviewer,
- Email = Email,
- };
- }
- private void OnIsSelectedChanged()
- {
- IsSelectedChanged?.Invoke(this, EventArgs.Empty);
- }
- }
- }
|