Skip to content

Commit 33596d1

Browse files
committed
Finished working with Notification management.
1 parent aaf8059 commit 33596d1

File tree

7 files changed

+27
-79
lines changed

7 files changed

+27
-79
lines changed

CutCode/Interfaces/INotificationManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ public class NotificationManager : INotificationManager
1818
public event EventHandler ShowNotification;
1919
public void CreateNotification(string message, int delay)
2020
{
21-
var notify = new NotifyModel(){ Message = message, Delay= delay};
21+
var notify = new Object(){ Message = message, Delay= delay};
2222
ShowNotification?.Invoke(notify, EventArgs.Empty);
2323
}
2424
}
2525

26-
public class NotifyModel : PropertyChangedBase
26+
public class Object : PropertyChangedBase
2727
{
2828
public string Message { get; set; }
2929
public int Delay { get; set; }
30-
public Object View { get; set; }
30+
public System.Object View { get; set; }
3131
}
3232
}

CutCode/Interfaces/IPageService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace CutCode
1010
public interface IPageService
1111
{
1212
event EventHandler PageChanged;
13-
Object Page { get; set; }
13+
System.Object Page { get; set; }
1414
event EventHandler PageRemoteChanged;
1515
string remoteChange { get; set; }
1616

@@ -19,8 +19,8 @@ public interface IPageService
1919
public class PageService : IPageService
2020
{
2121
public event EventHandler PageChanged;
22-
private Object _Page { get; set; }
23-
public Object Page
22+
private System.Object _Page { get; set; }
23+
public System.Object Page
2424
{
2525
get => _Page;
2626
set

CutCode/ViewModels/AddViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public AddViewModel(IThemeService _themeService, IPageService _pageService, IDat
3232
leftText = "";
3333
SetAppearance();
3434
}
35-
private void ThemeChanged(Object sender, EventArgs e)
35+
private void ThemeChanged(System.Object sender, EventArgs e)
3636
{
3737
SetAppearance();
3838
}

CutCode/ViewModels/MainViewModel.cs

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace CutCode
2121
public class MainViewModel : Screen
2222
{
2323
//private List<Button> leftBarBtns;
24-
public static List<Object> Pages;
24+
public static List<System.Object> Pages;
2525
private readonly IThemeService _themeService;
2626
private IWindowManager windowManager;
2727
private readonly IPageService pageService;
@@ -33,7 +33,7 @@ public MainViewModel(IWindowManager _windowManager,IThemeService themeService, I
3333

3434
notifyManager = _notifyManager;
3535
notifyManager.ShowNotification += showNotification;
36-
notificationList = new ObservableCollection<NotifyModel>();
36+
notificationList = new ObservableCollection<Object>();
3737

3838
_themeService = themeService;
3939
_themeService.ThemeChanged += ThemeChanged;
@@ -54,7 +54,7 @@ public MainViewModel(IWindowManager _windowManager,IThemeService themeService, I
5454
sideBarBtns[0].background = _themeService.IsLightTheme ? ColorCon.Convert("#FCFCFC") : ColorCon.Convert("#36393F");
5555

5656

57-
Pages = new List<Object>() { new HomeViewModel(_themeService, pageService, _dataBase),
57+
Pages = new List<System.Object>() { new HomeViewModel(_themeService, pageService, _dataBase),
5858
new AddViewModel(_themeService, pageService, _dataBase),
5959
new FavViewModel(_themeService, pageService, _dataBase),
6060
new ShareViewModel(_themeService, pageService, _dataBase),
@@ -76,8 +76,8 @@ private void ThemeChanged(object sender, EventArgs e)
7676
titlebarBtnsHoverColor = _themeService.IsLightTheme ? ColorCon.Convert("#D0D1D2") : ColorCon.Convert("#373737");
7777
}
7878

79-
private Object _currentPage;
80-
public Object currentPage
79+
private System.Object _currentPage;
80+
public System.Object currentPage
8181
{
8282
get => _currentPage;
8383
set { SetAndNotify(ref _currentPage, value); }
@@ -102,15 +102,7 @@ public void ChangePageCommand(string selected_item)
102102

103103
sideBarBtns[ind].background = _themeService.IsLightTheme ? ColorCon.Convert("#FCFCFC") : ColorCon.Convert("#36393F");
104104
if (currentPage != Pages[ind]) pageService.Page = Pages[ind];
105-
106-
107-
if(selected_item == "Share")
108-
{
109-
notifyManager.CreateNotification($"{k} : This is just for test", 5);
110-
k++;
111-
}
112105
}
113-
private int k = 1;
114106
#region Color
115107
private SolidColorBrush _backgroundColor;
116108
public SolidColorBrush backgroundColor
@@ -203,20 +195,20 @@ public string minImage
203195
}
204196

205197
#region NotificationDialogView
206-
private ObservableCollection<NotifyModel> _notificationList;
207-
public ObservableCollection<NotifyModel> notificationList
198+
private ObservableCollection<Object> _notificationList;
199+
public ObservableCollection<Object> notificationList
208200
{
209201
get => _notificationList;
210202
set => SetAndNotify(ref _notificationList, value);
211203
}
212204

213-
private List<NotifyModel> WaitingNotifications = new List<NotifyModel>();
205+
private List<Object> WaitingNotifications = new List<Object>();
214206
private void showNotification(object sender, EventArgs e)
215207
{
216-
var notification = sender as NotifyModel;
208+
var notification = sender as Object;
217209

218210
var notifcationViewModel = new NotificationDialogViewModel(_themeService, notification.Message);
219-
notification.View = (Object)notifcationViewModel;
211+
notification.View = (System.Object)notifcationViewModel;
220212

221213
if(notificationList.Count > 2)
222214
{

CutCode/ViewModels/NotificationDialogViewModel.cs

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,7 @@ public NotificationDialogViewModel(IThemeService _themeService, string _message)
2222
private void SetAppearance(object sender, EventArgs e)
2323
{
2424
background = themeService.IsLightTheme ? ColorCon.Convert("#DCDCDC") : ColorCon.Convert("#26292F");
25-
exitBtnHoverColor = themeService.IsLightTheme ? ColorCon.Convert("#D0D1D2") : ColorCon.Convert("#1F232B");
26-
textColor = themeService.IsLightTheme ? ColorCon.Convert("#060607") : ColorCon.Convert("#94969A");
27-
exitImage = themeService.IsLightTheme ? "../Resources/Images/Icons/exit_black.png" : "../Resources/Images/Icons/exit_white.png";
28-
}
29-
30-
private string _exitImage;
31-
public string exitImage
32-
{
33-
get => _exitImage;
34-
set
35-
{ SetAndNotify(ref _exitImage, value); }
25+
textColor = themeService.IsLightTheme ? ColorCon.Convert("#060607") : ColorCon.Convert("#F0F0F0");
3626
}
3727

3828
private string _message;
@@ -63,24 +53,5 @@ public SolidColorBrush textColor
6353
}
6454
}
6555
}
66-
67-
private SolidColorBrush _exitBtnHoverColor;
68-
public SolidColorBrush exitBtnHoverColor
69-
{
70-
get => _exitBtnHoverColor;
71-
set
72-
{
73-
if (value != _exitBtnHoverColor)
74-
{
75-
SetAndNotify(ref _exitBtnHoverColor, value);
76-
}
77-
}
78-
79-
}
80-
81-
public void ExitCommand()
82-
{
83-
84-
}
8556
}
8657
}

CutCode/Views/MainView.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
</Grid>
154154

155155
<Grid Grid.Row="1">
156-
<ItemsControl Background="Transparent"
156+
<ItemsControl Background="Transparent" Margin="0,0,10,10"
157157
ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
158158
HorizontalAlignment="Right" VerticalAlignment="Bottom" ItemsSource="{Binding notificationList}">
159159
<ItemsControl.ItemTemplate>

CutCode/Views/NotificationDialogView.xaml

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,15 @@
3737
</UserControl.Resources>
3838

3939
<Border Background="{Binding background}" CornerRadius="8"
40-
Height="50" MinWidth="250">
40+
Height="50" MinWidth="230">
4141
<Grid>
42-
<Grid.ColumnDefinitions>
43-
<ColumnDefinition Width="*"/>
44-
<ColumnDefinition Width="40"/>
45-
</Grid.ColumnDefinitions>
46-
47-
<Grid Grid.Column="0">
48-
<Grid.RowDefinitions>
49-
<RowDefinition Height="30"/>
50-
<RowDefinition Height="Auto"/>
51-
</Grid.RowDefinitions>
52-
<Label Grid.Row="0" FontSize="10.5" FontFamily="{StaticResource poppins_semibold}" Content="Notification" Foreground="{Binding textColor}"/>
53-
<Label Grid.Row="1" Foreground="{Binding textColor}" Content="{Binding message}" Margin="0,-12,0,0"
54-
FontSize="14" FontFamily="{StaticResource poppins_semibold}"/>
55-
</Grid>
56-
57-
<Button Margin="10,2,2,2" Grid.Column="1" Background="Transparent"
58-
Style="{DynamicResource ButtonStyle}" Command="{s:Action ExitCommand}"
59-
BorderBrush="{Binding exitBtnHoverColor}" VerticalAlignment="Center" Height="50">
60-
<Image Width="18" Height="18" Source="{Binding exitImage}"
61-
RenderOptions.BitmapScalingMode="HighQuality" RenderOptions.EdgeMode="Aliased"/>
62-
</Button>
63-
42+
<Grid.RowDefinitions>
43+
<RowDefinition Height="30"/>
44+
<RowDefinition Height="Auto"/>
45+
</Grid.RowDefinitions>
46+
<Label Grid.Row="0" FontSize="10.5" FontFamily="{StaticResource poppins_semibold}" Content="Notification" Foreground="{Binding textColor}"/>
47+
<Label Grid.Row="1" Foreground="{Binding textColor}" Content="{Binding message}" Margin="0,-12,0,0"
48+
FontSize="14" FontFamily="{StaticResource poppins_semibold}"/>
6449
</Grid>
6550
</Border>
6651
</UserControl>

0 commit comments

Comments
 (0)