Skip to content

Commit

Permalink
Used DevExpress (#98) (#99)
Browse files Browse the repository at this point in the history
* WatchList.WPF - Used DevExpress in project.

* WatchList.WPF - Change view page.
  • Loading branch information
Stan-Kudri authored Nov 27, 2024
1 parent d2a0699 commit 7eb8b8c
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 142 deletions.
13 changes: 0 additions & 13 deletions WatchList.WPF/Models/BindingBaseModel.cs

This file was deleted.

45 changes: 9 additions & 36 deletions WatchList.WPF/Models/CinemaModel.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using DevExpress.Mvvm;
using WatchList.Core.Model.ItemCinema;
using WatchList.Core.Model.ItemCinema.Components;

namespace WatchList.WPF.Models
{
public class CinemaModel : BindingBaseModel
public class CinemaModel : BindableBase
{
private Guid _id;
private string _title;
Expand All @@ -27,71 +28,43 @@ private CinemaModel(string title, decimal? sequel, DateTime? date, decimal? grad
public Guid Id
{
get => _id;
set
{
_id = value;
OnPropertyChanged("Id");
}
set => SetValue(ref _id, value);
}

public string Title
{
get => _title;
set
{
_title = value;
OnPropertyChanged("Title");
}
set => SetValue(ref _title, value);
}

public TypeCinema Type
{
get => _type;
set
{
_type = value;
OnPropertyChanged("Type");
}
set => SetValue(ref _type, value);
}

public StatusCinema Status
{
get => _status;
set
{
_status = value;
OnPropertyChanged("Status");
}
set => SetValue(ref _status, value);
}

public int Sequel
{
get => _sequel;
set
{
_sequel = value;
OnPropertyChanged("Sequel");
}
set => SetValue(ref _sequel, value);
}

public DateTime? Date
{
get => _date;
set
{
_date = value;
OnPropertyChanged("Date");
}
set => SetValue(ref _date, value);
}

public int? Grade
{
get => _grade;
set
{
_grade = value;
OnPropertyChanged("Grade");
}
set => SetValue(ref _grade, value);
}

public static CinemaModel CreateNonPlanned(
Expand Down
9 changes: 4 additions & 5 deletions WatchList.WPF/Models/Filter/FilterItemModel.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System.Collections.ObjectModel;
using DevExpress.Mvvm;
using WatchList.Core.Model.Filter;
using WatchList.Core.Model.ItemCinema.Components;

namespace WatchList.WPF.Models.Filter
{
public class FilterItemModel : BindingBaseModel, IFilterItem
public class FilterItemModel : BindableBase, IFilterItem
{
private IEnumerable<TypeCinema> _filterTypeField;
private IEnumerable<StatusCinema> _filterStatusField;
Expand Down Expand Up @@ -36,8 +37,7 @@ public IEnumerable<TypeCinema> FilterTypeField
return;
}

_filterTypeField = value;
OnPropertyChanged(nameof(_filterTypeField));
SetValue(ref _filterTypeField, value);
}
}

Expand All @@ -56,8 +56,7 @@ public IEnumerable<StatusCinema> FilterStatusField
return;
}

_filterStatusField = value;
OnPropertyChanged(nameof(_filterStatusField));
SetValue(ref _filterStatusField, value);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System.Collections.ObjectModel;
using DevExpress.Mvvm;
using WatchList.Core.Model.Load;

namespace WatchList.WPF.Models.ModelDataLoad.LoadModel
{
public class ModelDownloadMoreGrade : BindingBaseModel
public class ModelDownloadMoreGrade : BindableBase
{
private Grade _value = Grade.AnyGrade;

Expand All @@ -21,11 +22,7 @@ public ModelDownloadMoreGrade(Grade value)
public Grade Value
{
get => _value;
set
{
_value = value;
OnPropertyChanged("Grade");
}
set => SetValue(ref _value, value);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System.Collections.ObjectModel;
using DevExpress.Mvvm;
using WatchList.Core.Model.Load.Components;

namespace WatchList.WPF.Models.ModelDataLoad.LoadModel
{
public class ModelTypeCinemaUpload : BindingBaseModel
public class ModelTypeCinemaUpload : BindableBase
{
private TypeLoadingCinema _type = new TypeLoadingCinema();

Expand All @@ -21,11 +22,7 @@ public ModelTypeCinemaUpload(TypeLoadingCinema type)
public TypeLoadingCinema SelectedValue
{
get => _type;
set
{
_type = value;
OnPropertyChanged("SelectedValue");
}
set => SetValue(ref _type, value);
}
}
}
15 changes: 4 additions & 11 deletions WatchList.WPF/Models/PageModel.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System.Collections.ObjectModel;
using DevExpress.Mvvm;
using WatchList.Core.PageItem;

namespace WatchList.WPF.Models
{
public class PageModel : BindingBaseModel
public class PageModel : BindableBase
{
private const int StartPageSize = 10;
private const int NumberStartPage = 1;
Expand All @@ -22,21 +23,13 @@ public PageModel(int pageNumber = NumberStartPage, int pageSize = StartPageSize)
public int Number
{
get => _number;
set
{
_number = value;
OnPropertyChanged("Number");
}
set => SetValue(ref _number, value);
}

public int Size
{
get => _size;
set
{
_size = value;
OnPropertyChanged("Size");
}
set => SetValue(ref _size, value);
}

public Page GetPage() => new Page(_number, _size);
Expand Down
6 changes: 3 additions & 3 deletions WatchList.WPF/Models/Sorter/SortItemsModel.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System.Collections.ObjectModel;
using DevExpress.Mvvm;
using WatchList.Core.Model.Sortable;

namespace WatchList.WPF.Models.Sorter
{
public class SortItemsModel<T> : BindingBaseModel, ISortItem<T>
public class SortItemsModel<T> : BindableBase, ISortItem<T>
{
private readonly ISortItem<T> _sortType;

Expand Down Expand Up @@ -36,8 +37,7 @@ public IEnumerable<ISortableSmartEnum<T>> SortFields
return;
}

_sortType.SortFields = value;
OnPropertyChanged(nameof(_sortType.SortFields));
SetValue(_sortType.SortFields);
}
}

Expand Down
20 changes: 4 additions & 16 deletions WatchList.WPF/ViewModel/CinemaPageViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.ObjectModel;
using System.Windows;
using DevExpress.Mvvm;
using Microsoft.Extensions.Logging;
using WatchList.Core.Model.ItemCinema;
using WatchList.Core.PageItem;
Expand All @@ -16,7 +17,7 @@

namespace WatchList.WPF.ViewModel
{
public class CinemaPageViewModel : BindingBaseModel
public class CinemaPageViewModel : BindableBase
{
private readonly WatchItemService _itemService;
private readonly IMessageBox _messageBox;
Expand All @@ -37,11 +38,7 @@ public class CinemaPageViewModel : BindingBaseModel
private int CurPage
{
get => _curPage;
set
{
_curPage = value;
OnPropertyChanged(nameof(PageDisplayText));
}
set => SetValue(ref _curPage, value);
}

public CinemaPageViewModel(IMessageBox messageBox,
Expand All @@ -66,16 +63,7 @@ public CinemaPageViewModel(IMessageBox messageBox,
public ObservableCollection<WatchItem> WatchItems
{
get => _watchItems;
private set
{
if (value == _watchItems)
{
return;
}

_watchItems = value;
OnPropertyChanged(nameof(_watchItems));
}
private set => SetValue(ref _watchItems, value);
}

private PageModel Page { get; set; } = new PageModel();
Expand Down
7 changes: 5 additions & 2 deletions WatchList.WPF/ViewModel/CinemaWindowViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
using System.Windows.Controls;
using DevExpress.Mvvm;
using WatchList.WPF.Data;
using WatchList.WPF.Views;

namespace WatchList.WPF.ViewModel
{
public sealed class CinemaWindowViewModel
public sealed class CinemaWindowViewModel : BindableBase
{
private Page? _currentPage;

public CinemaWindowViewModel(PageService pageService)
{
pageService.PageChanged += (o, page) => CurrentPage = page;
pageService.Open(this, new CinemaPage());
}

public Page? CurrentPage { get; private set; }
public Page? CurrentPage { get => _currentPage; set => SetValue(ref _currentPage, value); }
}
}
Loading

0 comments on commit 7eb8b8c

Please sign in to comment.