------ #### V1.0.2404.1201 - 新增支持手动运行规则。 - 规则播放时间间隔不再针对全局声效,而只针对当前规则声效。 - 修复规则中播放文件夹可能导致无法执行的BUG。 - 修复规则不勾选礼物和点赞,则无法执行的BUG。
111 lines
3.9 KiB
C#
111 lines
3.9 KiB
C#
using HandyControl.Tools.Extension;
|
|
using HandyControl.Tools;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Animation;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
using CommunityToolkit.Mvvm.Messaging;
|
|
using LiveTools.Data;
|
|
|
|
namespace LiveTools.Content
|
|
{
|
|
/// <summary>
|
|
/// MainWinContent.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class MainWinContent
|
|
{
|
|
private GridLength _columnDefinitionWidth;
|
|
public MainWinContent()
|
|
{
|
|
InitializeComponent();
|
|
WeakReferenceMessenger.Default.Register<MsgToken>(this, OnReceive);
|
|
}
|
|
private void OnLeftMainContentShiftOut(object sender, RoutedEventArgs e)
|
|
{
|
|
ButtonShiftOut.Collapse();
|
|
GridSplitter.IsEnabled = false;
|
|
|
|
double targetValue = -ColumnDefinitionLeft.MaxWidth;
|
|
_columnDefinitionWidth = ColumnDefinitionLeft.Width;
|
|
|
|
DoubleAnimation animation = AnimationHelper.CreateAnimation(targetValue, milliseconds: 100);
|
|
animation.FillBehavior = FillBehavior.Stop;
|
|
animation.Completed += OnAnimationCompleted;
|
|
LeftMainContent.RenderTransform.BeginAnimation(TranslateTransform.XProperty, animation);
|
|
|
|
void OnAnimationCompleted(object? _, EventArgs args)
|
|
{
|
|
animation.Completed -= OnAnimationCompleted;
|
|
LeftMainContent.RenderTransform.SetCurrentValue(TranslateTransform.XProperty, targetValue);
|
|
|
|
Grid.SetColumn(MainContent, 0);
|
|
Grid.SetColumnSpan(MainContent, 2);
|
|
|
|
ColumnDefinitionLeft.MinWidth = 0;
|
|
ColumnDefinitionLeft.Width = new GridLength();
|
|
ButtonShiftIn.Show();
|
|
}
|
|
}
|
|
private void OnLeftMainContentShiftIn(object sender, RoutedEventArgs e)
|
|
{
|
|
ButtonShiftIn.Collapse();
|
|
GridSplitter.IsEnabled = true;
|
|
|
|
double targetValue = ColumnDefinitionLeft.Width.Value;
|
|
|
|
DoubleAnimation animation = AnimationHelper.CreateAnimation(targetValue, milliseconds: 100);
|
|
animation.FillBehavior = FillBehavior.Stop;
|
|
animation.Completed += OnAnimationCompleted;
|
|
LeftMainContent.RenderTransform.BeginAnimation(TranslateTransform.XProperty, animation);
|
|
|
|
void OnAnimationCompleted(object? _, EventArgs args)
|
|
{
|
|
animation.Completed -= OnAnimationCompleted;
|
|
LeftMainContent.RenderTransform.SetCurrentValue(TranslateTransform.XProperty, targetValue);
|
|
|
|
Grid.SetColumn(MainContent, 1);
|
|
Grid.SetColumnSpan(MainContent, 1);
|
|
|
|
ColumnDefinitionLeft.MinWidth = 240;
|
|
ColumnDefinitionLeft.Width = _columnDefinitionWidth;
|
|
ButtonShiftOut.Show();
|
|
}
|
|
}
|
|
|
|
private void Border_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
|
|
}
|
|
private void OnReceive(object recipient, MsgToken message)
|
|
{
|
|
switch (message.ID)
|
|
{
|
|
case MsgTokenId.Login:
|
|
if(Config.IsLogin()==1)
|
|
{
|
|
LeftMainContent.IsEnabled = true;
|
|
LeftMainContent.LblNickName.Text = Config.UserInfo.NickName;
|
|
LeftMainContent.LblOutDate.Text = Config.UserInfo.OutDateStr;
|
|
}
|
|
else
|
|
{
|
|
LeftMainContent.IsEnabled = false;
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|