-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
146 additions
and
44 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
ZongziTEK_Blackboard_Sticker/Controls/TimetableLesson.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<UserControl x:Class="ZongziTEK_Blackboard_Sticker.TimetableLesson" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf" | ||
xmlns:local="clr-namespace:ZongziTEK_Blackboard_Sticker" | ||
mc:Ignorable="d" | ||
d:DesignHeight="44" d:DesignWidth="200" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Loaded="UserControl_Loaded" Height="44"> | ||
<Grid> | ||
<Grid> | ||
<Border Background="{DynamicResource {x:Static ui:ThemeKeys.CardBackgroundFillColorDefaultBrushKey}}" | ||
CornerRadius="4" BorderBrush="{DynamicResource {x:Static ui:ThemeKeys.CardStrokeColorDefaultBrushKey}}" BorderThickness="1" MinHeight="44"> | ||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="auto"/> | ||
<ColumnDefinition/> | ||
<ColumnDefinition Width="auto"/> | ||
</Grid.ColumnDefinitions> | ||
<Border x:Name="BorderActiveIndicator" Grid.Column="0" CornerRadius="2" Width="4" Background="#99555555" Margin="8"/> | ||
<Viewbox Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="6"> | ||
<TextBlock Foreground="{DynamicResource ForegroundColor}" Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:TimetableLesson}, Mode=FindAncestor}, Path=Subject}" FontSize="32" Padding="0,0,0,2"/> | ||
</Viewbox> | ||
<TextBlock Foreground="{DynamicResource ForegroundColor}" Grid.Column="2" Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:TimetableLesson}, Mode=FindAncestor}, Path=Time}" VerticalAlignment="Center" Margin="8" FontSize="20" Opacity="0.75" FontFamily="../Resources/#Digital-7 Mono"/> | ||
</Grid> | ||
</Border> | ||
</Grid> | ||
</Grid> | ||
</UserControl> |
78 changes: 78 additions & 0 deletions
78
ZongziTEK_Blackboard_Sticker/Controls/TimetableLesson.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using iNKORE.UI.WPF.Modern; | ||
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.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
using ZongziTEK_Blackboard_Sticker.Helpers; | ||
|
||
namespace ZongziTEK_Blackboard_Sticker | ||
{ | ||
/// <summary> | ||
/// TimetableLesson.xaml 的交互逻辑 | ||
/// </summary> | ||
public partial class TimetableLesson : UserControl | ||
{ | ||
public TimetableLesson() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void UserControl_Loaded(object sender, RoutedEventArgs e) | ||
{ | ||
if (IsActive) Activate(); | ||
else Deactivate(); | ||
} | ||
|
||
public void Activate() | ||
{ | ||
ControlsHelper.SetDynamicResource(BorderActiveIndicator, Border.BackgroundProperty, ThemeKeys.SystemControlBackgroundAccentBrushKey); | ||
if (!IsActive) IsActive = true; | ||
} | ||
|
||
public void Deactivate() | ||
{ | ||
BorderActiveIndicator.Background = new SolidColorBrush(Color.FromArgb(153, 85, 85, 85)); | ||
if (IsActive) IsActive = false; | ||
} | ||
|
||
public string Subject | ||
{ | ||
get { return (string)GetValue(SubjectProperty); } | ||
set { SetValue(SubjectProperty, value); } | ||
} | ||
|
||
// Using a DependencyProperty as the backing store for Subject. This enables animation, styling, binding, etc... | ||
public static readonly DependencyProperty SubjectProperty = | ||
DependencyProperty.Register("Subject", typeof(string), typeof(TimetableLesson), new PropertyMetadata("")); | ||
|
||
public string Time | ||
{ | ||
get { return (string)GetValue(TimeProperty); } | ||
set { SetValue(TimeProperty, value); } | ||
} | ||
|
||
// Using a DependencyProperty as the backing store for Time. This enables animation, styling, binding, etc... | ||
public static readonly DependencyProperty TimeProperty = | ||
DependencyProperty.Register("Time", typeof(string), typeof(TimetableLesson), new PropertyMetadata("")); | ||
|
||
public bool IsActive | ||
{ | ||
get { return (bool)GetValue(IsActiveProperty); } | ||
set { SetValue(IsActiveProperty, value); } | ||
} | ||
|
||
// Using a DependencyProperty as the backing store for IsActive. This enables animation, styling, binding, etc... | ||
public static readonly DependencyProperty IsActiveProperty = | ||
DependencyProperty.Register("IsActive", typeof(bool), typeof(TimetableLesson), new PropertyMetadata(false)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters