diff options
-rw-r--r-- | ApartmentManager/ApartmentManager/ApartmentManager.csproj | 4 | ||||
-rw-r--r-- | ApartmentManager/ApartmentManager/Assets/Person1.jpg | bin | 448838 -> 0 bytes | |||
-rw-r--r-- | ApartmentManager/ApartmentManager/Assets/Person2.jpg | bin | 48173 -> 0 bytes | |||
-rw-r--r-- | ApartmentManager/ApartmentManager/Assets/Person3.jpg | bin | 4614 -> 0 bytes | |||
-rw-r--r-- | ApartmentManager/ApartmentManager/Assets/plan.jpg | bin | 69301 -> 0 bytes | |||
-rw-r--r-- | ApartmentManager/ApartmentManager/Common/Controls/NavMenuListView.cs (renamed from ApartmentManager/ApartmentManager/Controls/NavMenuListView.cs) | 0 | ||||
-rw-r--r-- | ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs | 8 | ||||
-rw-r--r-- | ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs | 23 | ||||
-rw-r--r-- | ApartmentManager/ApartmentManager/ViewModel/ApartmentViewModel.cs | 24 |
9 files changed, 22 insertions, 37 deletions
diff --git a/ApartmentManager/ApartmentManager/ApartmentManager.csproj b/ApartmentManager/ApartmentManager/ApartmentManager.csproj index 2378b79..601b96b 100644 --- a/ApartmentManager/ApartmentManager/ApartmentManager.csproj +++ b/ApartmentManager/ApartmentManager/ApartmentManager.csproj @@ -173,10 +173,6 @@ <ItemGroup> <Content Include="Assets\BrokenDownpipe.jpg" /> <Content Include="Assets\Ostbanehus.jpg" /> - <Content Include="Assets\Person1.jpg" /> - <Content Include="Assets\Person2.jpg" /> - <Content Include="Assets\Person3.jpg" /> - <Content Include="Assets\plan.jpg" /> <Content Include="Properties\Default.rd.xml" /> <Content Include="Assets\LockScreenLogo.scale-200.png" /> <Content Include="Assets\SplashScreen.scale-200.png" /> diff --git a/ApartmentManager/ApartmentManager/Assets/Person1.jpg b/ApartmentManager/ApartmentManager/Assets/Person1.jpg Binary files differdeleted file mode 100644 index edf9716..0000000 --- a/ApartmentManager/ApartmentManager/Assets/Person1.jpg +++ /dev/null diff --git a/ApartmentManager/ApartmentManager/Assets/Person2.jpg b/ApartmentManager/ApartmentManager/Assets/Person2.jpg Binary files differdeleted file mode 100644 index 4e67876..0000000 --- a/ApartmentManager/ApartmentManager/Assets/Person2.jpg +++ /dev/null diff --git a/ApartmentManager/ApartmentManager/Assets/Person3.jpg b/ApartmentManager/ApartmentManager/Assets/Person3.jpg Binary files differdeleted file mode 100644 index b9ed3a7..0000000 --- a/ApartmentManager/ApartmentManager/Assets/Person3.jpg +++ /dev/null diff --git a/ApartmentManager/ApartmentManager/Assets/plan.jpg b/ApartmentManager/ApartmentManager/Assets/plan.jpg Binary files differdeleted file mode 100644 index 54df873..0000000 --- a/ApartmentManager/ApartmentManager/Assets/plan.jpg +++ /dev/null diff --git a/ApartmentManager/ApartmentManager/Controls/NavMenuListView.cs b/ApartmentManager/ApartmentManager/Common/Controls/NavMenuListView.cs index 9591ad1..9591ad1 100644 --- a/ApartmentManager/ApartmentManager/Controls/NavMenuListView.cs +++ b/ApartmentManager/ApartmentManager/Common/Controls/NavMenuListView.cs diff --git a/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs b/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs index 52849aa..df38ecb 100644 --- a/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs +++ b/ApartmentManager/ApartmentManager/Handler/ApartmentHandler.cs @@ -45,7 +45,6 @@ namespace ApartmentManager.Handler new MessageDialog(e.Message).ShowAsync(); } } - /// <summary> /// RESIDENT HANDLERS /// </summary> @@ -72,7 +71,6 @@ namespace ApartmentManager.Handler { try { - Resident resident = ApartmentViewModel.NewResident ?? new Resident(); resident.ApartmentId = ApartmentViewModel.UserSingleton.CurrentUser.ApartmentId; if (string.IsNullOrEmpty(resident.Picture)) @@ -97,7 +95,6 @@ namespace ApartmentManager.Handler { Resident resident = ApartmentViewModel.NewResident ?? new Resident(); resident.ApartmentId = ApartmentViewModel.UserSingleton.CurrentUser.ApartmentId; - ApiClient.DeleteData("api/residents/" + resident.ResidentId); GetApartmentResidents(); } @@ -113,7 +110,6 @@ namespace ApartmentManager.Handler { Resident resident = ApartmentViewModel.NewResident ?? new Resident(); resident.ApartmentId = ApartmentViewModel.UserSingleton.CurrentUser.ApartmentId; - ApiClient.PutData("api/residents/" + resident.ResidentId, resident); GetApartmentResidents(); } @@ -172,10 +168,8 @@ namespace ApartmentManager.Handler { Defect Defect = new Defect(); Defect.ApartmentId = ApartmentViewModel.UserSingleton.CurrentUser.ApartmentId; - var defectsFromDatabase = ApiClient.GetData("api/ApartmentDefects/" + Defect.ApartmentId); var defecttlist = JsonConvert.DeserializeObject<ObservableCollection<Defect>>(defectsFromDatabase); - foreach (var defect in defecttlist) { var picturesFromDatabase = ApiClient.GetData("api/DefectPictures/" + defect.DefectId); @@ -221,11 +215,9 @@ namespace ApartmentManager.Handler defect.ApartmentId = ApartmentViewModel.UserSingleton.CurrentUser.ApartmentId; defect.Status = "New"; defect.UploadDate = DateTime.Now; - var response = ApiClient.PostData("api/defects/", defect); var defectResponse = JsonConvert.DeserializeObject<Defect>(response); defect.DefectId = defectResponse.DefectId; - foreach (var picture in ApartmentViewModel.CatalogSingleton.DefectPictures) { picture.DefectId = defect.DefectId; diff --git a/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs b/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs index 39f352e..689f08d 100644 --- a/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs +++ b/ApartmentManager/ApartmentManager/Singletons/CatalogSingleton.cs @@ -9,27 +9,26 @@ namespace ApartmentManager.Singletons { public class CatalogSingleton { - private static CatalogSingleton instance = new CatalogSingleton(); - - public static CatalogSingleton Instance => instance; - - + ////////// Singleton ////////// + private static CatalogSingleton _instance; + public static CatalogSingleton Instance => _instance ?? (_instance = new CatalogSingleton()); + ////////// For Apartment ////////// public Apartment Apartment { get; set; } + ////////// For Residents ////////// public ObservableCollection<Resident> Residents { get; set; } + ////////// For Defects ////////// public ObservableCollection<Defect> Defects { get; set; } - public ObservableCollection<DefectPicture> DefectPictures { get; set; } - public int DefectId { get; set; } - + public ObservableCollection<DefectPicture> DefectPictures { get; set; } public ObservableCollection<DefectComments> DefectComments { get; set; } public Defect Defect { get; set; } + public int DefectId { get; set; } + ////////// Constructor ////////// private CatalogSingleton() { DefectComments = new ObservableCollection<DefectComments>(); Residents = new ObservableCollection<Resident>(); Defects = new ObservableCollection<Defect>(); - DefectPictures = new ObservableCollection<DefectPicture>(); - - } - + DefectPictures = new ObservableCollection<DefectPicture>(); + } } } diff --git a/ApartmentManager/ApartmentManager/ViewModel/ApartmentViewModel.cs b/ApartmentManager/ApartmentManager/ViewModel/ApartmentViewModel.cs index 9c1542b..b84602d 100644 --- a/ApartmentManager/ApartmentManager/ViewModel/ApartmentViewModel.cs +++ b/ApartmentManager/ApartmentManager/ViewModel/ApartmentViewModel.cs @@ -17,20 +17,17 @@ namespace ApartmentManager.ViewModel { public class ApartmentViewModel : INotifyPropertyChanged { + ////////// Handler ////////// public ApartmentHandler ApartmentHandler { get; set; } + ////////// Singletons ////////// public CatalogSingleton CatalogSingleton { get; set; } public UserSingleton UserSingleton { get; set; } - - + ////////// Store Data From Interface////////// private User _newUser; private Resident _newResident; - private Defect _newDefect = new Defect(); + private Defect _newDefect; private DefectPicture _selectedDefectPicture; private DefectComments _newDefectComment; - - - - public static int ServerResponse { get; set; } ////////// Resident relay commands////////// public ICommand CreateResidentCommand { get; set; } public ICommand DeleteResidentCommand { get; set; } @@ -45,19 +42,20 @@ namespace ApartmentManager.ViewModel public ICommand CreateDefect { get; set; } public ICommand DefectInfo { get; set; } public ICommand CreateDefectComment { get; set; } + ////////// Constructor ////////// public ApartmentViewModel() { + ////////// Store Data From Interface instance ////////// NewUser = new User(); NewResident = new Resident(); - //NewDefect = new Defect(); + NewDefect = new Defect(); NewDefectComment = new DefectComments(); - SelectedDefectPicture = new DefectPicture(); + ////////// Handler ////////// ApartmentHandler = new ApartmentHandler(this); ////////// Singletons ////////// CatalogSingleton = CatalogSingleton.Instance; - UserSingleton = UserSingleton.Instance; - + UserSingleton = UserSingleton.Instance; ////////// User relay commands////////// UpdateUser = new RelayCommand(ApartmentHandler.UpdateUser); UploadUserPhoto = new RelayCommand(ApartmentHandler.UploadUserPhoto); @@ -73,7 +71,7 @@ namespace ApartmentManager.ViewModel DefectInfo = new RelayCommand(ApartmentHandler.GetDefectInfo); CreateDefectComment = new RelayCommand(ApartmentHandler.CreateDefectComment); } - + ////////// Store Data From Interface////////// public DefectComments NewDefectComment { get => _newDefectComment; @@ -119,8 +117,8 @@ namespace ApartmentManager.ViewModel OnPropertyChanged(); } } + ////////// INotifyPropertyChanged ////////// public event PropertyChangedEventHandler PropertyChanged; - [NotifyPropertyChangedInvocator] protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { |