Files
ReminderOrganizer/TaskWindow.xaml

259 lines
17 KiB
Plaintext
Raw Permalink Normal View History

<Window x:Class="ReminderOrganizer.TaskWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="{Binding WindowTitle}"
Width="440" SizeToContent="Height"
WindowStartupLocation="CenterOwner"
ResizeMode="NoResize"
ShowInTaskbar="False"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent"
MouseLeftButtonDown="Window_MouseLeftButtonDown">
<Window.Resources>
<SolidColorBrush x:Key="PrimaryBrush" Color="#6366F1"/>
<SolidColorBrush x:Key="WarningBrush" Color="#F59E0B"/>
<SolidColorBrush x:Key="TextPrimaryBrush" Color="#1E293B"/>
<SolidColorBrush x:Key="TextSecondaryBrush" Color="#64748B"/>
<SolidColorBrush x:Key="BorderBrush" Color="#CBD5E1"/>
<SolidColorBrush x:Key="CardBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="InputBackgroundBrush" Color="#F1F5F9"/>
<SolidColorBrush x:Key="HoverBrush" Color="#E2E8F0"/>
<Style x:Key="Label" TargetType="TextBlock">
<Setter Property="FontSize" Value="11"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}"/>
<Setter Property="Margin" Value="0,0,0,4"/>
</Style>
<Style x:Key="Input" TargetType="TextBox">
<Setter Property="Background" Value="{DynamicResource InputBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
<Setter Property="CaretBrush" Value="{DynamicResource TextPrimaryBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="10,8"/>
<Setter Property="FontSize" Value="13"/>
</Style>
<Style x:Key="Chip" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="Margin" Value="0,0,6,0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1" CornerRadius="12" Padding="10,4">
<ContentPresenter HorizontalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bd" Property="Background" Value="{DynamicResource HoverBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="DialogButton" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="18,8"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="8" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="bd" Property="Opacity" Value="0.4"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bd" Property="Opacity" Value="0.85"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Border CornerRadius="10" Background="{DynamicResource CardBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Margin="10">
<Border.Effect>
<DropShadowEffect BlurRadius="20" ShadowDepth="5" Opacity="0.25" Direction="270" Color="Black"/>
</Border.Effect>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Header -->
<Border Grid.Row="0" Background="Transparent" CornerRadius="12,12,0,0" Padding="20,14,12,6">
<Grid>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding WindowTitle}" FontSize="16" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimaryBrush}" VerticalAlignment="Center"/>
</StackPanel>
<Button Content="&#xE8BB;" Style="{StaticResource IconButton}" FontSize="10" HorizontalAlignment="Right" Command="{Binding CancelCommand}" IsCancel="True"/>
</Grid>
</Border>
<!-- Content -->
<StackPanel Grid.Row="1" Margin="18,16,18,18">
<!-- Type: appointment / birthday -->
<Border Style="{StaticResource SegmentHost}" Margin="0,0,0,14" HorizontalAlignment="Left">
<StackPanel Orientation="Horizontal">
<RadioButton GroupName="type" IsChecked="{Binding IsAppointment}" Style="{StaticResource Segment}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xE787;" FontFamily="Segoe MDL2 Assets" FontSize="12" VerticalAlignment="Center" Margin="0,0,6,0"/>
<TextBlock Text="{Binding AppointmentText}"/>
</StackPanel>
</RadioButton>
<RadioButton GroupName="type" IsChecked="{Binding IsAnniversary}" Style="{StaticResource Segment}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xED55;" FontFamily="Segoe MDL2 Assets" FontSize="12" VerticalAlignment="Center" Margin="0,0,6,0"/>
<TextBlock Text="{Binding BirthdayTypeText}"/>
</StackPanel>
</RadioButton>
</StackPanel>
</Border>
<TextBlock Text="{Binding NameLabel}" Style="{StaticResource Label}"/>
<TextBox x:Name="NameBox" Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}"/>
<TextBlock Text="{Binding ErrorMessage}" Foreground="#EF4444" FontSize="11" Margin="0,4,0,0"
Visibility="{Binding HasError, Converter={StaticResource BoolToVisibility}}"/>
<!-- Birthday: one date field, no time -->
<StackPanel Visibility="{Binding IsAnniversary, Converter={StaticResource BoolToVisibility}}">
<TextBlock Text="{Binding CategoryLabel}" Style="{StaticResource Label}" Margin="0,14,0,4"/>
<ComboBox ItemsSource="{Binding Categories}" SelectedItem="{Binding SelectedCategory}" Height="34" VerticalContentAlignment="Center">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Glyph}" FontFamily="Segoe MDL2 Assets" FontSize="13" VerticalAlignment="Center"
Foreground="{Binding Color, Converter={StaticResource HexToBrush}}"/>
<TextBlock Text="{Binding Name}" FontSize="13" Margin="8,0,0,0" VerticalAlignment="Center"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock Text="{Binding BirthdayLabel}" Style="{StaticResource Label}" Margin="0,14,0,4"/>
<TextBox x:Name="BirthdayBox" Text="{Binding BirthdayText, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}" FontSize="15"/>
<TextBlock Text="{Binding BirthdayPreview}" FontSize="12" Margin="0,6,0,0" TextWrapping="Wrap">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding BirthdayInvalid}" Value="True">
<Setter Property="Foreground" Value="#EF4444"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</StackPanel>
<!-- Appointment: date, time, recurrence -->
<StackPanel Visibility="{Binding IsAppointment, Converter={StaticResource BoolToVisibility}}">
<TextBlock Text="{Binding DateLabel}" Style="{StaticResource Label}" Margin="0,14,0,4"/> <Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<DatePicker Grid.Column="0" SelectedDate="{Binding SelectedDay, Mode=TwoWay}" Height="32" VerticalContentAlignment="Center"/>
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="8,0,0,0">
<ComboBox Width="56" Height="32" VerticalContentAlignment="Center" SelectedIndex="{Binding SelectedHourIndex}">
<ComboBoxItem Content="00"/><ComboBoxItem Content="01"/><ComboBoxItem Content="02"/>
<ComboBoxItem Content="03"/><ComboBoxItem Content="04"/><ComboBoxItem Content="05"/>
<ComboBoxItem Content="06"/><ComboBoxItem Content="07"/><ComboBoxItem Content="08"/>
<ComboBoxItem Content="09"/><ComboBoxItem Content="10"/><ComboBoxItem Content="11"/>
<ComboBoxItem Content="12"/><ComboBoxItem Content="13"/><ComboBoxItem Content="14"/>
<ComboBoxItem Content="15"/><ComboBoxItem Content="16"/><ComboBoxItem Content="17"/>
<ComboBoxItem Content="18"/><ComboBoxItem Content="19"/><ComboBoxItem Content="20"/>
<ComboBoxItem Content="21"/><ComboBoxItem Content="22"/><ComboBoxItem Content="23"/>
</ComboBox>
<TextBlock Text=":" VerticalAlignment="Center" Margin="4,0" FontSize="14" Foreground="{DynamicResource TextPrimaryBrush}"/>
<ComboBox Width="56" Height="32" VerticalContentAlignment="Center" SelectedIndex="{Binding SelectedMinuteIndex}">
<ComboBoxItem Content="00"/><ComboBoxItem Content="05"/>
<ComboBoxItem Content="10"/><ComboBoxItem Content="15"/>
<ComboBoxItem Content="20"/><ComboBoxItem Content="25"/>
<ComboBoxItem Content="30"/><ComboBoxItem Content="35"/>
<ComboBoxItem Content="40"/><ComboBoxItem Content="45"/>
<ComboBoxItem Content="50"/><ComboBoxItem Content="55"/>
</ComboBox>
</StackPanel>
</Grid>
<!-- Quick picks -->
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
<TextBlock Text="{Binding QuickLabel}" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}" VerticalAlignment="Center" Margin="0,0,8,0"/>
<Button Content="{Binding TomorrowText}" Command="{Binding SetTomorrowCommand}" Style="{StaticResource Chip}"/>
<Button Content="{Binding NextWeekText}" Command="{Binding SetNextWeekCommand}" Style="{StaticResource Chip}"/>
<Button Content="{Binding NextMonthText}" Command="{Binding SetNextMonthCommand}" Style="{StaticResource Chip}"/>
</StackPanel>
<TextBlock Text="{Binding PastDateWarning}" Foreground="{DynamicResource WarningBrush}" FontSize="11" Margin="0,6,0,0"
Visibility="{Binding IsInPast, Converter={StaticResource BoolToVisibility}}"/>
<!-- Recurrence -->
<StackPanel Orientation="Horizontal" Margin="0,14,0,0">
<CheckBox IsChecked="{Binding IsRecurring, Mode=TwoWay}" VerticalAlignment="Center"
Foreground="{DynamicResource TextPrimaryBrush}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xE8EE;" FontFamily="Segoe MDL2 Assets" FontSize="12" VerticalAlignment="Center" Foreground="{DynamicResource TextPrimaryBrush}"/>
<TextBlock Text="{Binding RecurringLabel}" FontSize="12" Margin="6,0,0,0" VerticalAlignment="Center" Foreground="{DynamicResource TextPrimaryBrush}"/>
</StackPanel>
</CheckBox>
<ComboBox Margin="10,0,0,0" Width="100" Height="28" VerticalContentAlignment="Center"
SelectedIndex="{Binding SelectedRecurrenceIndex}" IsEnabled="{Binding IsRecurring}">
<ComboBoxItem Content="{Binding DailyText}"/>
<ComboBoxItem Content="{Binding WeeklyText}"/>
<ComboBoxItem Content="{Binding MonthlyText}"/>
<ComboBoxItem Content="{Binding YearlyText}"/>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,6,0,0"
Visibility="{Binding IsRecurring, Converter={StaticResource BoolToVisibility}}">
<TextBlock Text="{Binding NextOccurrenceLabel}" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}"/>
<TextBlock Text="{Binding NextOccurrenceText}" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimaryBrush}" Margin="4,0,0,0"/>
</StackPanel>
</StackPanel>
<!-- Lead reminder -->
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
<TextBlock Text="{Binding LeadLabel}" FontSize="12" Foreground="{DynamicResource TextPrimaryBrush}" VerticalAlignment="Center" Width="150"/>
<ComboBox Width="120" Height="28" VerticalContentAlignment="Center" SelectedIndex="{Binding SelectedLeadIndex}">
<ComboBoxItem Content="{Binding LeadNone}"/>
<ComboBoxItem Content="{Binding Lead1}"/>
<ComboBoxItem Content="{Binding Lead2}"/>
<ComboBoxItem Content="{Binding Lead3}"/>
<ComboBoxItem Content="{Binding Lead7}"/>
</ComboBox>
</StackPanel>
<TextBlock Text="{Binding DescriptionLabel}" Style="{StaticResource Label}" Margin="0,14,0,4"/>
<TextBox Text="{Binding Description, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}"
Height="72" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" FontSize="12"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,18,0,0">
<Button Content="{Binding CancelText}" Command="{Binding CancelCommand}" Style="{StaticResource DialogButton}"/>
<Button Content="{Binding SaveText}" Command="{Binding SaveCommand}" Style="{StaticResource DialogButton}" IsDefault="True"
Background="{DynamicResource PrimaryBrush}" Foreground="White" BorderThickness="0" Margin="8,0,0,0"/>
</StackPanel>
</StackPanel>
</Grid>
</Border>
</Window>