Optimized growl
This commit is contained in:
1 parent
513e57f013
commit
f7ca63a1ca
10 files changed
+155
-77
No files matched your search
@@ -85,7 +85,7 @@
|
||||
public static readonly string GotoTopDemoCtl = nameof(GotoTopDemoCtl);
|
||||
|
||||
public static readonly string NotifyIconDemoCtl = nameof(NotifyIconDemoCtl);
|
||||
|
||||
|
||||
public static readonly string BadgeDemoCtl = nameof(BadgeDemoCtl);
|
||||
|
||||
public static readonly string GravatarDemoCtl = nameof(GravatarDemoCtl);
|
||||
@@ -160,5 +160,7 @@
|
||||
|
||||
public static readonly string SendChatMessage = nameof(SendChatMessage);
|
||||
|
||||
public static readonly string GrowlDemoPanel = nameof(GrowlDemoPanel);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ var controlList = new List<string>
|
||||
"TransferDemoCtl",
|
||||
"ChatBubbleDemoCtl",
|
||||
"GotoTopDemoCtl",
|
||||
"NotifyIconDemoCtl"
|
||||
"NotifyIconDemoCtl",
|
||||
"BadgeDemoCtl",
|
||||
"GravatarDemoCtl",
|
||||
"DialogDemoCtl"
|
||||
@@ -91,7 +91,8 @@ var messageList = new List<string>
|
||||
"FullSwitch",
|
||||
"ContributorsView",
|
||||
"ClearLeftSelected",
|
||||
"SendChatMessage"
|
||||
"SendChatMessage",
|
||||
"GrowlDemoPanel"
|
||||
};
|
||||
#>
|
||||
namespace HandyControlDemo.Data
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<userControl:MainContent Grid.Column="1"/>
|
||||
<GridSplitter Grid.Column="1" HorizontalAlignment="Left" Width="4" Background="Transparent" BorderThickness="1,0,0,0" BorderBrush="{DynamicResource BorderBrush}"/>
|
||||
<controls:ScrollViewer Grid.Column="1" VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Right" IsEnableInertia="True" IsPenetrating="True">
|
||||
<StackPanel Name="GrowlPanel" VerticalAlignment="Top" Margin="0,10,10,10"/>
|
||||
<StackPanel controls:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,10"/>
|
||||
</controls:ScrollViewer>
|
||||
</Grid>
|
||||
</controls:BlurWindow>
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
using HandyControl.Controls;
|
||||
using HandyControlDemo.Data;
|
||||
|
||||
@@ -12,20 +11,6 @@ namespace HandyControlDemo
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnActivated(EventArgs e)
|
||||
{
|
||||
base.OnActivated(e);
|
||||
|
||||
Growl.SetGrowlParent(GrowlPanel, true);
|
||||
}
|
||||
|
||||
protected override void OnDeactivated(EventArgs e)
|
||||
{
|
||||
base.OnDeactivated(e);
|
||||
|
||||
Growl.SetGrowlParent(GrowlPanel, false);
|
||||
}
|
||||
|
||||
protected override void OnClosing(CancelEventArgs e)
|
||||
{
|
||||
if (GlobalData.NotifyIconIsShow)
|
||||
|
||||
@@ -8,11 +8,23 @@ namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
public class GrowlDemoViewModel
|
||||
{
|
||||
private readonly string _token;
|
||||
|
||||
public GrowlDemoViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public GrowlDemoViewModel(string token)
|
||||
{
|
||||
_token = token;
|
||||
}
|
||||
|
||||
public RelayCommand InfoCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Info(Properties.Langs.Lang.GrowlInfo))).Value;
|
||||
new RelayCommand(() => Growl.Info(Properties.Langs.Lang.GrowlInfo, _token))).Value;
|
||||
|
||||
public RelayCommand SuccessCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Success(Properties.Langs.Lang.GrowlSuccess))).Value;
|
||||
new RelayCommand(() => Growl.Success(Properties.Langs.Lang.GrowlSuccess, _token))).Value;
|
||||
|
||||
public RelayCommand WarningCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Warning(new GrowlInfo
|
||||
@@ -23,24 +35,26 @@ namespace HandyControlDemo.ViewModel
|
||||
{
|
||||
Growl.Info(isConfirmed.ToString());
|
||||
return true;
|
||||
}
|
||||
},
|
||||
Token = _token
|
||||
}))).Value;
|
||||
|
||||
public RelayCommand ErrorCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Error(Properties.Langs.Lang.GrowlError))).Value;
|
||||
new RelayCommand(() => Growl.Error(Properties.Langs.Lang.GrowlError, _token))).Value;
|
||||
|
||||
public RelayCommand AskCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Ask(Properties.Langs.Lang.GrowlAsk, isConfirmed =>
|
||||
{
|
||||
Growl.Info(isConfirmed.ToString());
|
||||
return true;
|
||||
}))).Value;
|
||||
}, _token))).Value;
|
||||
|
||||
public RelayCommand FatalCmd => new Lazy<RelayCommand>(() =>
|
||||
new RelayCommand(() => Growl.Fatal(new GrowlInfo
|
||||
{
|
||||
Message = Properties.Langs.Lang.GrowlFatal,
|
||||
ShowDateTime = false
|
||||
ShowDateTime = false,
|
||||
Token = _token
|
||||
}))).Value;
|
||||
|
||||
public RelayCommand ClearCmd => new Lazy<RelayCommand>(() =>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Reflection.Emit;
|
||||
using System.Windows;
|
||||
using CommonServiceLocator;
|
||||
using GalaSoft.MvvmLight.Ioc;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Service;
|
||||
|
||||
namespace HandyControlDemo.ViewModel
|
||||
@@ -15,7 +17,8 @@ namespace HandyControlDemo.ViewModel
|
||||
SimpleIoc.Default.Register<DataService>();
|
||||
|
||||
SimpleIoc.Default.Register<MainViewModel>();
|
||||
SimpleIoc.Default.Register<GrowlDemoViewModel>();
|
||||
SimpleIoc.Default.Register(() => new GrowlDemoViewModel(), "GrowlDemo");
|
||||
SimpleIoc.Default.Register(() => new GrowlDemoViewModel(MessageToken.GrowlDemoPanel), "GrowlDemoWithToken");
|
||||
SimpleIoc.Default.Register<ImageBrowserDemoViewModel>();
|
||||
SimpleIoc.Default.Register<ComboBoxDemoViewModel>();
|
||||
SimpleIoc.Default.Register<WindowDemoViewModel>();
|
||||
@@ -36,7 +39,9 @@ namespace HandyControlDemo.ViewModel
|
||||
|
||||
public MainViewModel Main => ServiceLocator.Current.GetInstance<MainViewModel>();
|
||||
|
||||
public GrowlDemoViewModel GrowlDemo => ServiceLocator.Current.GetInstance<GrowlDemoViewModel>();
|
||||
public GrowlDemoViewModel GrowlDemo => ServiceLocator.Current.GetInstance<GrowlDemoViewModel>("GrowlDemo");
|
||||
|
||||
public GrowlDemoViewModel GrowlDemoWithToken => ServiceLocator.Current.GetInstance<GrowlDemoViewModel>("GrowlDemoWithToken");
|
||||
|
||||
public ImageBrowserDemoViewModel ImageBrowserDemo => ServiceLocator.Current.GetInstance<ImageBrowserDemoViewModel>();
|
||||
|
||||
|
||||
@@ -3,26 +3,24 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
|
||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||
DataContext="{Binding GrowlDemo,Source={StaticResource Locator}}"
|
||||
xmlns:data="clr-namespace:HandyControlDemo.Data"
|
||||
DataContext="{Binding GrowlDemoWithToken,Source={StaticResource Locator}}"
|
||||
Title="{x:Static langs:Lang.GrowlDemo}"
|
||||
Width="800"
|
||||
Height="500">
|
||||
<controls:TransitioningContentControl>
|
||||
<controls:SimplePanel>
|
||||
<StackPanel Margin="32">
|
||||
<WrapPanel HorizontalAlignment="Left" VerticalAlignment="Top">
|
||||
<Button Command="{Binding InfoCmd}" Content="{x:Static langs:Lang.Info}" Margin="0,5,5,5" Style="{StaticResource ButtonInfo}"/>
|
||||
<Button Command="{Binding SuccessCmd}" Content="{x:Static langs:Lang.Success}" Margin="5" Style="{StaticResource ButtonSuccess}"/>
|
||||
<Button Command="{Binding WarningCmd}" Content="{x:Static langs:Lang.Warning}" Margin="5" Style="{StaticResource ButtonWarning}"/>
|
||||
<Button Command="{Binding ErrorCmd}" Content="{x:Static langs:Lang.Error}" Margin="5" Style="{StaticResource ButtonDanger}"/>
|
||||
<Button Command="{Binding AskCmd}" Content="{x:Static langs:Lang.Ask}" Margin="5" Background="BlueViolet" Foreground="White"/>
|
||||
<Button Command="{Binding FatalCmd}" Content="{x:Static langs:Lang.Fatal}" Margin="5,0"/>
|
||||
<Button Command="{Binding ClearCmd}" Content="{x:Static langs:Lang.Clear}" Margin="5,0,0,0" Style="{StaticResource ButtonPrimary}"/>
|
||||
</WrapPanel>
|
||||
<Button Command="{Binding NewWindowCmd}" Content="{x:Static langs:Lang.NewWindow}" HorizontalAlignment="Left" Margin="0,5,0,0"/>
|
||||
</StackPanel>
|
||||
<controls:SimplePanel Margin="32">
|
||||
<WrapPanel>
|
||||
<Button Command="{Binding InfoCmd}" Content="{x:Static langs:Lang.Info}" Margin="0,5,5,5" Style="{StaticResource ButtonInfo}"/>
|
||||
<Button Command="{Binding SuccessCmd}" Content="{x:Static langs:Lang.Success}" Margin="5" Style="{StaticResource ButtonSuccess}"/>
|
||||
<Button Command="{Binding WarningCmd}" Content="{x:Static langs:Lang.Warning}" Margin="5" Style="{StaticResource ButtonWarning}"/>
|
||||
<Button Command="{Binding ErrorCmd}" Content="{x:Static langs:Lang.Error}" Margin="5" Style="{StaticResource ButtonDanger}"/>
|
||||
<Button Command="{Binding AskCmd}" Content="{x:Static langs:Lang.Ask}" Margin="5" Background="BlueViolet" Foreground="White"/>
|
||||
<Button Command="{Binding FatalCmd}" Content="{x:Static langs:Lang.Fatal}" Margin="5,0"/>
|
||||
<Button Command="{Binding ClearCmd}" Content="{x:Static langs:Lang.Clear}" Margin="5,0,0,0" Style="{StaticResource ButtonPrimary}"/>
|
||||
</WrapPanel>
|
||||
<controls:ScrollViewer VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Right" IsEnableInertia="True" IsPenetrating="True">
|
||||
<StackPanel Name="GrowlPanel" VerticalAlignment="Top" Margin="0,10,10,10"/>
|
||||
<StackPanel controls:Growl.Token="{x:Static data:MessageToken.GrowlDemoPanel}" VerticalAlignment="Top" Margin="0,10,10,10"/>
|
||||
</controls:ScrollViewer>
|
||||
</controls:SimplePanel>
|
||||
</controls:TransitioningContentControl>
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using HandyControl.Controls;
|
||||
|
||||
namespace HandyControlDemo.Window
|
||||
namespace HandyControlDemo.Window
|
||||
{
|
||||
public partial class GrowlDemoWindow
|
||||
{
|
||||
@@ -9,19 +6,5 @@ namespace HandyControlDemo.Window
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnActivated(EventArgs e)
|
||||
{
|
||||
base.OnActivated(e);
|
||||
|
||||
Growl.SetGrowlParent(GrowlPanel, true);
|
||||
}
|
||||
|
||||
protected override void OnDeactivated(EventArgs e)
|
||||
{
|
||||
base.OnDeactivated(e);
|
||||
|
||||
Growl.SetGrowlParent(GrowlPanel, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user