chore: use file-scoped namespace
This commit is contained in:
1 parent
99d2fafb72
commit
bbf1b7d4c6
748 files changed
+57929
-58678
No files matched your search
@@ -5,114 +5,113 @@ using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using HandyControlDemo.Data;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
namespace HandyControlDemo.ViewModel;
|
||||
|
||||
public class NotifyIconDemoViewModel : ViewModelBase
|
||||
{
|
||||
public class NotifyIconDemoViewModel : ViewModelBase
|
||||
private bool _isCleanup;
|
||||
|
||||
private bool _reversed;
|
||||
|
||||
private string _content = "Hello~~~";
|
||||
|
||||
public string Content
|
||||
{
|
||||
private bool _isCleanup;
|
||||
|
||||
private bool _reversed;
|
||||
|
||||
private string _content = "Hello~~~";
|
||||
|
||||
public string Content
|
||||
{
|
||||
get => _content;
|
||||
get => _content;
|
||||
#if NET40
|
||||
set => Set(nameof(Content), ref _content, value);
|
||||
#else
|
||||
set => Set(ref _content, value);
|
||||
set => Set(ref _content, value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private bool _contextMenuIsShow;
|
||||
private bool _contextMenuIsShow;
|
||||
|
||||
public bool ContextMenuIsShow
|
||||
public bool ContextMenuIsShow
|
||||
{
|
||||
get => _contextMenuIsShow;
|
||||
set
|
||||
{
|
||||
get => _contextMenuIsShow;
|
||||
set
|
||||
{
|
||||
#if NET40
|
||||
Set(nameof(ContextMenuIsShow), ref _contextMenuIsShow, value);
|
||||
#else
|
||||
Set(ref _contextMenuIsShow, value);
|
||||
Set(ref _contextMenuIsShow, value);
|
||||
#endif
|
||||
GlobalData.NotifyIconIsShow = ContextMenuIsShow || ContextContentIsShow;
|
||||
if (!_isCleanup && !_reversed)
|
||||
{
|
||||
_reversed = true;
|
||||
ContextContentIsShow = !value;
|
||||
_reversed = false;
|
||||
}
|
||||
GlobalData.NotifyIconIsShow = ContextMenuIsShow || ContextContentIsShow;
|
||||
if (!_isCleanup && !_reversed)
|
||||
{
|
||||
_reversed = true;
|
||||
ContextContentIsShow = !value;
|
||||
_reversed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool _contextMenuIsBlink;
|
||||
private bool _contextMenuIsBlink;
|
||||
|
||||
public bool ContextMenuIsBlink
|
||||
{
|
||||
get => _contextMenuIsBlink;
|
||||
public bool ContextMenuIsBlink
|
||||
{
|
||||
get => _contextMenuIsBlink;
|
||||
#if NET40
|
||||
set => Set(nameof(ContextMenuIsBlink), ref _contextMenuIsBlink, value);
|
||||
#else
|
||||
set => Set(ref _contextMenuIsBlink, value);
|
||||
set => Set(ref _contextMenuIsBlink, value);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private bool _contextContentIsShow;
|
||||
private bool _contextContentIsShow;
|
||||
|
||||
public bool ContextContentIsShow
|
||||
public bool ContextContentIsShow
|
||||
{
|
||||
get => _contextContentIsShow;
|
||||
set
|
||||
{
|
||||
get => _contextContentIsShow;
|
||||
set
|
||||
{
|
||||
#if NET40
|
||||
Set(nameof(ContextContentIsShow), ref _contextContentIsShow, value);
|
||||
#else
|
||||
Set(ref _contextContentIsShow, value);
|
||||
Set(ref _contextContentIsShow, value);
|
||||
#endif
|
||||
GlobalData.NotifyIconIsShow = ContextMenuIsShow || ContextContentIsShow;
|
||||
if (!_isCleanup && !_reversed)
|
||||
{
|
||||
_reversed = true;
|
||||
ContextMenuIsShow = !value;
|
||||
_reversed = false;
|
||||
}
|
||||
GlobalData.NotifyIconIsShow = ContextMenuIsShow || ContextContentIsShow;
|
||||
if (!_isCleanup && !_reversed)
|
||||
{
|
||||
_reversed = true;
|
||||
ContextMenuIsShow = !value;
|
||||
_reversed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool _contextContentIsBlink;
|
||||
private bool _contextContentIsBlink;
|
||||
|
||||
public bool ContextContentIsBlink
|
||||
{
|
||||
get => _contextContentIsBlink;
|
||||
public bool ContextContentIsBlink
|
||||
{
|
||||
get => _contextContentIsBlink;
|
||||
#if NET40
|
||||
set => Set(nameof(ContextContentIsBlink), ref _contextContentIsBlink, value);
|
||||
#else
|
||||
set => Set(ref _contextContentIsBlink, value);
|
||||
set => Set(ref _contextContentIsBlink, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
public RelayCommand<object> MouseCmd => new(str => Growl.Info(str.ToString()));
|
||||
|
||||
public RelayCommand SendNotificationCmd => new(SendNotification);
|
||||
|
||||
private void SendNotification()
|
||||
{
|
||||
NotifyIcon.ShowBalloonTip("HandyControl", Content, NotifyIconInfoType.None, ContextMenuIsShow ? MessageToken.NotifyIconDemo : MessageToken.NotifyIconContextDemo);
|
||||
}
|
||||
|
||||
public override void Cleanup()
|
||||
{
|
||||
base.Cleanup();
|
||||
|
||||
_isCleanup = true;
|
||||
ContextMenuIsShow = false;
|
||||
ContextMenuIsBlink = false;
|
||||
ContextContentIsShow = false;
|
||||
ContextContentIsBlink = false;
|
||||
GlobalData.NotifyIconIsShow = false;
|
||||
_isCleanup = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public RelayCommand<object> MouseCmd => new(str => Growl.Info(str.ToString()));
|
||||
|
||||
public RelayCommand SendNotificationCmd => new(SendNotification);
|
||||
|
||||
private void SendNotification()
|
||||
{
|
||||
NotifyIcon.ShowBalloonTip("HandyControl", Content, NotifyIconInfoType.None, ContextMenuIsShow ? MessageToken.NotifyIconDemo : MessageToken.NotifyIconContextDemo);
|
||||
}
|
||||
|
||||
public override void Cleanup()
|
||||
{
|
||||
base.Cleanup();
|
||||
|
||||
_isCleanup = true;
|
||||
ContextMenuIsShow = false;
|
||||
ContextMenuIsBlink = false;
|
||||
ContextContentIsShow = false;
|
||||
ContextContentIsBlink = false;
|
||||
GlobalData.NotifyIconIsShow = false;
|
||||
_isCleanup = false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user