From 7fb51e2dee01ca5e7ffd14fb9e9d9026d20553a1 Mon Sep 17 00:00:00 2001
From: muellerp <Philipp1.Mueller@Student.Reutlingen-University.de>
Date: Mon, 10 Mar 2025 17:46:57 +0100
Subject: [PATCH] do some spinny thingy

---
 .../Screens/FirstLaunch/03_2ProgramsList.xaml | 128 +++++++++---------
 .../FirstLaunch/03_2ProgramsList.xaml.cs      |   5 +
 2 files changed, 72 insertions(+), 61 deletions(-)

diff --git a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/FirstLaunch/03_2ProgramsList.xaml b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/FirstLaunch/03_2ProgramsList.xaml
index 4d9f9d9..20db2a2 100644
--- a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/FirstLaunch/03_2ProgramsList.xaml
+++ b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/FirstLaunch/03_2ProgramsList.xaml
@@ -1,12 +1,28 @@
 <Page x:Class="InnoLabProjektDektopApp.ProgramsList"
-        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-        xmlns:local="clr-namespace:InnoLabProjektDektopApp"
-        xmlns:header="clr-namespace:InnoLabProjektDektopApp.Screens.Templates"
-        mc:Ignorable="d"
+      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+      xmlns:local="clr-namespace:InnoLabProjektDektopApp"
+      xmlns:header="clr-namespace:InnoLabProjektDektopApp.Screens.Templates"
+      mc:Ignorable="d"
       Background="{StaticResource BACKGROUND_PRIMARY_BRUSH}">
+
+    <Page.Resources>
+        <Storyboard x:Key="RefreshButtonSpinStoryboard">
+            <DoubleAnimation
+                Storyboard.TargetName="RefreshPath"
+                Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
+                From="0"
+                To="360"
+                Duration="0:0:0.5">
+                <DoubleAnimation.EasingFunction>
+                    <CubicEase EasingMode="EaseInOut" />
+                </DoubleAnimation.EasingFunction>
+            </DoubleAnimation>
+        </Storyboard>
+    </Page.Resources>
+
     <Grid VerticalAlignment="Center">
         <StackPanel Margin="20,20,20,20">
             <Grid>
@@ -22,63 +38,55 @@
                            HorizontalAlignment="Left" />
 
                 <!-- Suchfeld -->
-
-                <Border  CornerRadius="10" Padding="10" Grid.Column="1" HorizontalAlignment="Right" Margin="10,0,0,0" Background="{StaticResource BACKGROUND_SECONDARY_BRUSH}">
+                <Border CornerRadius="10" Padding="10" Grid.Column="1" HorizontalAlignment="Right" Margin="10,0,0,0" Background="{StaticResource BACKGROUND_SECONDARY_BRUSH}">
                     <!-- Input Field with Placeholder -->
                     <Grid>
                         <TextBox x:Name="SearchBox"
                                  Margin="10,0"
-                 Width="150"
-                 Height="30"
-                 FontSize="14"
-                 VerticalAlignment="Center"
-                 Padding="5"
-                 HorizontalAlignment="Left"
-                 Background="Transparent"
-                 Foreground="{StaticResource TEXT_PRIMARY_BRUSH}"
-                 BorderBrush="{StaticResource TEXT_SECONDARY_BRUSH}"
-                 BorderThickness="0"
-                 TextChanged="SearchBox_TextChanged" />
+                                 Width="150"
+                                 Height="30"
+                                 FontSize="14"
+                                 VerticalAlignment="Center"
+                                 Padding="5"
+                                 HorizontalAlignment="Left"
+                                 Background="Transparent"
+                                 Foreground="{StaticResource TEXT_PRIMARY_BRUSH}"
+                                 BorderBrush="{StaticResource TEXT_SECONDARY_BRUSH}"
+                                 BorderThickness="0"
+                                 TextChanged="SearchBox_TextChanged" />
                         <TextBlock x:Name="SearchPlaceholder"
-                   Text="Search..."
-                   VerticalAlignment="Center"
-                   HorizontalAlignment="Left"
-                   Foreground="{StaticResource TEXT_SECONDARY_BRUSH}"
-                   FontSize="14"
-                   Padding="5"
-                   IsHitTestVisible="False"
-                   Margin="15,0,0,0" />
+                                   Text="Search..."
+                                   VerticalAlignment="Center"
+                                   HorizontalAlignment="Left"
+                                   Foreground="{StaticResource TEXT_SECONDARY_BRUSH}"
+                                   FontSize="14"
+                                   Padding="5"
+                                   IsHitTestVisible="False"
+                                   Margin="15,0,0,0" />
 
                         <!-- Untere Linie als Border -->
                         <Border Height="1"
-                Background="{StaticResource TEXT_PRIMARY_BRUSH}"
-                VerticalAlignment="Bottom"
-                HorizontalAlignment="Stretch"
-                Margin="10,0,40,0" />
+                                Background="{StaticResource TEXT_PRIMARY_BRUSH}"
+                                VerticalAlignment="Bottom"
+                                HorizontalAlignment="Stretch"
+                                Margin="10,0,40,0" />
 
                         <Border Width="30"
-Height="30"
-Margin="165,0,0,0"
-VerticalAlignment="Center"
-HorizontalAlignment="Right"
->
+                                Height="30"
+                                Margin="165,0,0,0"
+                                VerticalAlignment="Center"
+                                HorizontalAlignment="Right">
                             <TextBlock Text="🔍"
-       FontSize="14"
-       VerticalAlignment="Center"
-       HorizontalAlignment="Center" 
-                                       />
-
+                                       FontSize="14"
+                                       VerticalAlignment="Center"
+                                       HorizontalAlignment="Center" />
                         </Border>
                     </Grid>
                 </Border>
-
-
             </Grid>
-            <TextBlock  Margin="0,10,0,0"
+            <TextBlock Margin="0,10,0,0"
                        Text="On the left side, you can find the programs that you marked as distracting. On the left, you find all currently running programs that you can potentially add to the distracting programs." />
 
-
-
             <!-- Überschrift -->
             <Grid Margin="0,20">
                 <!-- Define two equal columns -->
@@ -93,9 +101,9 @@ HorizontalAlignment="Right"
                     <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,0,15">
                         <CheckBox x:Name="OtherProgramsCheckBox" IsChecked="True" VerticalAlignment="Center"/>
                         <TextBlock x:Name="HeaderTextBlock"
-                       Style="{StaticResource Header2}" 
-                       Text="CATEGORY"
-                       Margin="10,0,0,0"/>
+                                   Style="{StaticResource Header2}" 
+                                   Text="CATEGORY"
+                                   Margin="10,0,0,0"/>
                     </StackPanel>
 
                     <!-- ScrollViewer for Items -->
@@ -107,16 +115,20 @@ HorizontalAlignment="Right"
                 <!-- Right Column StackPanel -->
                 <StackPanel Grid.Column="1" Margin="20,10,20,8">
                     <!-- Header -->
-                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0" >
+                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,0,0,0">
                         <TextBlock x:Name="HeaderTextBlock2"
-                       Style="{StaticResource Header2}" 
-                       Text="Running Programs"
-                       VerticalAlignment="Center"/>
+                                   Style="{StaticResource Header2}" 
+                                   Text="Running Programs"
+                                   VerticalAlignment="Center"/>
 
                         <!-- Refresh Button -->
                         <Border Margin="10,0,0,0" Style="{StaticResource RoundedButtonBorder}" MouseDown="RefreshButton_Click" Width="40" Height="40" VerticalAlignment="Center">
                             <Viewbox Width="20" Height="20" HorizontalAlignment="Center">
-                                <Path Margin="-4,0,0,0" Fill="Black" Data="M12,4V1L8,5L12,9V6C15.3,6 18,8.7 18,12C18,15.3 15.3,18 12,18C8.7,18 6,15.3 6,12H4C4,16.4 7.6,20 12,20C16.4,20 20,16.4 20,12C20,7.6 16.4,4 12,4Z"/>
+                                <Path x:Name="RefreshPath" Margin="-4,0,0,0" Fill="Black" Data="M12,4V1L8,5L12,9V6C15.3,6 18,8.7 18,12C18,15.3 15.3,18 12,18C8.7,18 6,15.3 6,12H4C4,16.4 7.6,20 12,20C16.4,20 20,16.4 20,12C20,7.6 16.4,4 12,4Z">
+                                    <Path.RenderTransform>
+                                        <RotateTransform Angle="0" CenterX="12" CenterY="12" />
+                                    </Path.RenderTransform>
+                                </Path>
                             </Viewbox>
                         </Border>
                     </StackPanel>
@@ -127,12 +139,6 @@ HorizontalAlignment="Right"
                     </ScrollViewer>
                 </StackPanel>
             </Grid>
-
-
-
         </StackPanel>
-        
-
-
     </Grid>
 </Page>
\ No newline at end of file
diff --git a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/FirstLaunch/03_2ProgramsList.xaml.cs b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/FirstLaunch/03_2ProgramsList.xaml.cs
index 5660309..66737bc 100644
--- a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/FirstLaunch/03_2ProgramsList.xaml.cs
+++ b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/FirstLaunch/03_2ProgramsList.xaml.cs
@@ -18,6 +18,7 @@ using System.Diagnostics;
 using static InnoLabProjektDektopApp.DistractionsList;
 using System;
 using InnoLabProjektDektopApp.Utils;
+using System.Windows.Media.Animation;
 
 
 namespace InnoLabProjektDektopApp
@@ -75,6 +76,10 @@ namespace InnoLabProjektDektopApp
 
         private void RefreshButton_Click(object sender, RoutedEventArgs e)
         {
+            // Start the spin animation
+            var storyboard = (Storyboard)FindResource("RefreshButtonSpinStoryboard");
+            storyboard.Begin();
+
             RefreshRunningProcessList();
         }
 
-- 
GitLab