diff --git a/InnoLabProjektDektopApp/.vs/InnoLabProjektDektopApp/DesignTimeBuild/.dtbcache.v2 b/InnoLabProjektDektopApp/.vs/InnoLabProjektDektopApp/DesignTimeBuild/.dtbcache.v2 index 34e5ad45a5a882f84f086a4377652f8300217539..53c26d9735f7895783a776d9f980702687f48c61 100644 Binary files a/InnoLabProjektDektopApp/.vs/InnoLabProjektDektopApp/DesignTimeBuild/.dtbcache.v2 and b/InnoLabProjektDektopApp/.vs/InnoLabProjektDektopApp/DesignTimeBuild/.dtbcache.v2 differ diff --git a/InnoLabProjektDektopApp/.vs/InnoLabProjektDektopApp/v17/.suo b/InnoLabProjektDektopApp/.vs/InnoLabProjektDektopApp/v17/.suo index eceae58602897565fe534a6209dbbf265d9d0213..d066e3be0500fedbccb416aede4fe402cd1c0586 100644 Binary files a/InnoLabProjektDektopApp/.vs/InnoLabProjektDektopApp/v17/.suo and b/InnoLabProjektDektopApp/.vs/InnoLabProjektDektopApp/v17/.suo differ diff --git a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/Regulaer/01Overview.xaml.cs b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/Regulaer/01Overview.xaml.cs index 3b145007f6b449f868fa3add977e7d0f02aebece..a3d93ab2c30a6982b573edf0b7cc9058ab8205d7 100644 --- a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/Regulaer/01Overview.xaml.cs +++ b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/Regulaer/01Overview.xaml.cs @@ -151,7 +151,31 @@ namespace InnoLabProjektDektopApp // Ereignis-Handler für den "Start"-Button private void StartButton_Click(object sender, RoutedEventArgs e) { - MessageBox.Show("Focus session started!", "Start", MessageBoxButton.OK, MessageBoxImage.Information); + // Werte auslesen + int focusPeriod = int.Parse(((ComboBoxItem)FocusPeriodComboBox.SelectedItem)?.Content.ToString().Split()[0] ?? "50"); + int breakPeriod = int.Parse(((ComboBoxItem)BreakPeriodComboBox.SelectedItem)?.Content.ToString().Split()[0] ?? "10"); + int cycles = int.Parse(((ComboBoxItem)CyclesComboBox.SelectedItem)?.Content.ToString() ?? "4"); + string distractionMode = ((ComboBoxItem)DistractionModeComboBox.SelectedItem)?.Content.ToString() ?? "Full-blocking mode"; + string mascotVisible = ((ComboBoxItem)MascotVisibilityComboBox.SelectedItem)?.Content.ToString() ?? "Yes"; + bool wordsOfAffirmation = WordsOfAffirmationCheckBox.IsChecked ?? false; + bool insultingWords = InsultingWordsCheckBox.IsChecked ?? false; + + // Anzeige der Werte in einer MessageBox + MessageBox.Show($"Focus Period: {focusPeriod} minutes\n" + + $"Break Period: {breakPeriod} minutes\n" + + $"Cycles: {cycles}\n" + + $"Distraction Mode: {distractionMode}\n" + + $"Mascot Visible: {mascotVisible}\n" + + $"Words of Affirmation: {wordsOfAffirmation}\n" + + $"Insulting Words: {insultingWords}", + "Current Settings", + MessageBoxButton.OK, + MessageBoxImage.Information); + + var sessionScreen = new Session(focusPeriod, breakPeriod, cycles, distractionMode, mascotVisible, wordsOfAffirmation, insultingWords); + sessionScreen.Show(); + this.Close(); } + } } diff --git a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/Regulaer/02Session.xaml b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/Regulaer/02Session.xaml index 59c33b913783b92c7d67a0bea211793f09257af7..ecfce639437f8f8f4ba112be6b505ebbae3782d5 100644 --- a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/Regulaer/02Session.xaml +++ b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/Regulaer/02Session.xaml @@ -14,7 +14,9 @@ <Button Content="Distractions" Style="{StaticResource TopMenuButon}" HorizontalAlignment="Right" Margin="0,4,20,0" VerticalAlignment="Top" Height="26" Width="80"/> <TextBlock Name ="Title" Text="Focus Session 0 of 0" Style="{StaticResource Heading1}" HorizontalAlignment="Center" Height="42" TextWrapping="Wrap" VerticalAlignment="Top" Width="442" Margin="0,133,0,0"/> <TextBlock Name="Clock" Text="00:00" Style="{StaticResource Heading1}" HorizontalAlignment="Center" Height="104" TextWrapping="Wrap" VerticalAlignment="Top" Width="326" Margin="0,180,0,0" FontSize="72" FontWeight="Bold"/> - <Rectangle Name="ProgressBar" Style="{StaticResource CircleSmall}" HorizontalAlignment="Center" Margin="0,289,0,0" VerticalAlignment="Top" Width="407"/> - <Button Content="Start" Name="PlayPauseButton" Style="{StaticResource PlayPauseButton}" HorizontalAlignment="Center" Margin="0,346,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" Click="Button_Click"/> + + <StackPanel x:Name="CyclesIndicatorPanel" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,60,0,0"> + </StackPanel> + <Button Content="Start" Name="PlayPauseButton" Style="{StaticResource PlayPauseButton}" HorizontalAlignment="Center" Margin="0,320,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" Click="Button_Click"/> </Grid> </Window> \ No newline at end of file diff --git a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/Regulaer/02Session.xaml.cs b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/Regulaer/02Session.xaml.cs index 65e3f75e1e4881e27f2172a45c15cf2233100a62..912c3120316dcafd993e1157d813f554229f2bba 100644 --- a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/Regulaer/02Session.xaml.cs +++ b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/Screens/Regulaer/02Session.xaml.cs @@ -26,14 +26,15 @@ namespace InnoLabProjektDektopApp private bool wordsOfAffirmation; private bool insultingWords; + private bool isBreakPeriod = false; // Speichert, ob wir in einer Pause sind private Timer timer; - private const int maxTime = (0 * 60) + 5;// total time for each session in seconds - private int seconds = maxTime; // Tracks the remaining seconds in the current session + private int maxTime; + private int seconds; private int step = 0; //Indicates whether the timer is running (-1) or paused (0) - private const int sessions = 4; //Total number of focus sessions in one cycle + private int sessions; private int currentSession = 1; //Tracks which session is currently running public Session(int focusPeriod, @@ -54,36 +55,59 @@ namespace InnoLabProjektDektopApp this.insultingWords = insultingWords; GlobalSettings.setDefaults(this); + this.maxTime = focusPeriod/2; //todo: multiply with 60 later + this.seconds = this.maxTime; + this.sessions = cycles; + + timer = new Timer(timertick, null,0,1000); //A background timer calls timertick every second + CreateCycleIndicators(); // Kreise erstellen updateTexts(); } - private void timertick(object state) + private void timertick(object state) +{ + Dispatcher.Invoke(() => + { + seconds += step; // Reduziere Zeit, wenn der Timer läuft + updateTexts(); // Aktualisiere die UI + + // Fortschrittsanzeige nur während der Fokusperiode aktualisieren + if (!isBreakPeriod) + { + CreateCycleIndicators(); // Fortschritt für Fokus-Perioden anzeigen + } + + if (seconds <= 0) // Wenn die Zeit abgelaufen ist { - Dispatcher.Invoke(() => + stopTimer(); // Timer stoppen + + if (isBreakPeriod) // Wenn wir in einer Pause sind { - seconds += step; // Decrement seconds if running - updateTexts(); // Update UI - ProgressBar.Fill = GradientGenerator.generateTwoColorBrush( - Color.FromRgb(72, 98, 132), - Color.FromRgb(222, 222, 222), - 1 - (seconds / (double)maxTime) - ); - - if (seconds <= 0) // When time runs out - { - stopTimer(); // Pause the timer - currentSession++; - seconds = maxTime; // Reset timer for the next session + isBreakPeriod = false; // Zurück zum Fokus + seconds = maxTime; // Zeit für die Fokusperiode + currentSession++; // Gehe zum nächsten Zyklus + } + else // Wenn wir im Fokus sind + { + isBreakPeriod = true; // Wechsel in den Pausenmodus + seconds = breakPeriod; // Zeit für die Pause + } - if (currentSession > sessions) - { - timer.Dispose(); // Stop and clean up the timer after all sessions - } - } - }); + if (currentSession > sessions) // Wenn alle Zyklen abgeschlossen sind + { + timer.Dispose(); // Timer stoppen und aufräumen + MessageBox.Show("All sessions completed!", "Info", MessageBoxButton.OK, MessageBoxImage.Information); + return; + } + + startTimer(); // Starte den Timer für die nächste Periode } + }); +} + + public void startTimer() @@ -111,9 +135,18 @@ namespace InnoLabProjektDektopApp private void updateTexts() { Clock.Text = seconds / 60 + ":" + (seconds % 60 < 10 ? "0" : "") + seconds % 60; - Title.Text = "Focus Session " + currentSession + " of " + sessions; + + if (isBreakPeriod) + { + Title.Text = $"Break Session {currentSession} of {sessions}"; + } + else + { + Title.Text = $"Focus Session {currentSession} of {sessions}"; + } } + private void Button_Click(object sender, RoutedEventArgs e) { if (step < 0) { @@ -122,6 +155,70 @@ namespace InnoLabProjektDektopApp startTimer(); } } + + + private void CreateCycleIndicators() + { + // Clear existing indicators + CyclesIndicatorPanel.Children.Clear(); + + for (int i = 0; i < cycles; i++) + { + if (i + 1 == currentSession) // Highlight the current session with a ProgressBar + { + Grid cycleGrid = new Grid + { + Width = 50, + Height = 20, // Höhe des erweiterten Kreises + Margin = new Thickness(10), + }; + + // Background for the current cycle + Rectangle backgroundRectangle = new Rectangle + { + Width = 50, + Height = 20, + Fill = Brushes.LightGray, + RadiusX = 10, + RadiusY = 10, + }; + + // ProgressBar (uses the existing logic) + Rectangle progressBar = new Rectangle + { + Width = 50, // Gleiche Breite wie der Hintergrund + Height = 20, // Gleiche Höhe wie der Hintergrund + Fill = GradientGenerator.generateTwoColorBrush( + Color.FromRgb(72, 98, 132), + Color.FromRgb(222, 222, 222), + 1 - (seconds / (double)maxTime) + ), + RadiusX = 10, + RadiusY = 10, + HorizontalAlignment = HorizontalAlignment.Left, + }; + + cycleGrid.Children.Add(backgroundRectangle); + cycleGrid.Children.Add(progressBar); // ProgressBar überlagert den Hintergrund + CyclesIndicatorPanel.Children.Add(cycleGrid); + } + else + { + // Standardkreis für abgeschlossene oder zukünftige Zyklen + Ellipse cycleIndicator = new Ellipse + { + Width = 20, + Height = 20, + Margin = new Thickness(10), + Fill = i < currentSession ? new SolidColorBrush(Color.FromRgb(72, 98, 132)) : Brushes.LightGray, + }; + + CyclesIndicatorPanel.Children.Add(cycleIndicator); + } + } + } + + } } diff --git a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/InnoLabProjektDektopApp.AssemblyInfo.cs b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/InnoLabProjektDektopApp.AssemblyInfo.cs index 061a6df9644020fc59694724b7c65d1f1eacb611..e5c7e7b1b385bf193c28b846cd0687b45e8f95cc 100644 --- a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/InnoLabProjektDektopApp.AssemblyInfo.cs +++ b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/InnoLabProjektDektopApp.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("CoFlow")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e6579ef0d3b607362222ce416775f79a38e2a15b")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+93d144893d8dadca6f285ef4a5529527314cd24b")] [assembly: System.Reflection.AssemblyProductAttribute("CoFlow")] [assembly: System.Reflection.AssemblyTitleAttribute("CoFlow")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/InnoLabProjektDektopApp.AssemblyInfoInputs.cache b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/InnoLabProjektDektopApp.AssemblyInfoInputs.cache index b2798ae95212fb84f9a1dc698caabfc35491a399..a73bfa9218c40705042df231c5b58e6b78434206 100644 --- a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/InnoLabProjektDektopApp.AssemblyInfoInputs.cache +++ b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/InnoLabProjektDektopApp.AssemblyInfoInputs.cache @@ -1 +1 @@ -aada719c9e57b2dfa11e1b6fee01ad786fcaf6337a6a62c39bf8cce0ea37e6c6 +81fe44d744b1d9f6bc5c21f59489eb8a1ce8533d6aa9ebb2bad659cbb6cd413b diff --git a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/Screens/Regulaer/02Session.g.cs b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/Screens/Regulaer/02Session.g.cs index a6a5b27ac8170d2c3417129f3e7489291b933078..589d8a350064841dadabca6c19db677494002c5c 100644 --- a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/Screens/Regulaer/02Session.g.cs +++ b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/Screens/Regulaer/02Session.g.cs @@ -1,4 +1,4 @@ -#pragma checksum "..\..\..\..\..\Screens\Regulaer\02Session.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "9B6D99D6ED8E1A78DB85CB3A5AD191E6830B5E1A" +#pragma checksum "..\..\..\..\..\Screens\Regulaer\02Session.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "4D171F84F09119FFF5927E5550B6D53DBDAC090D" //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. @@ -59,15 +59,15 @@ namespace InnoLabProjektDektopApp { #line hidden - #line 17 "..\..\..\..\..\Screens\Regulaer\02Session.xaml" + #line 18 "..\..\..\..\..\Screens\Regulaer\02Session.xaml" [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - internal System.Windows.Shapes.Rectangle ProgressBar; + internal System.Windows.Controls.StackPanel CyclesIndicatorPanel; #line default #line hidden - #line 18 "..\..\..\..\..\Screens\Regulaer\02Session.xaml" + #line 20 "..\..\..\..\..\Screens\Regulaer\02Session.xaml" [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] internal System.Windows.Controls.Button PlayPauseButton; @@ -118,12 +118,12 @@ namespace InnoLabProjektDektopApp { this.Clock = ((System.Windows.Controls.TextBlock)(target)); return; case 3: - this.ProgressBar = ((System.Windows.Shapes.Rectangle)(target)); + this.CyclesIndicatorPanel = ((System.Windows.Controls.StackPanel)(target)); return; case 4: this.PlayPauseButton = ((System.Windows.Controls.Button)(target)); - #line 18 "..\..\..\..\..\Screens\Regulaer\02Session.xaml" + #line 20 "..\..\..\..\..\Screens\Regulaer\02Session.xaml" this.PlayPauseButton.Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default diff --git a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/Screens/Regulaer/02Session.g.i.cs b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/Screens/Regulaer/02Session.g.i.cs index a6a5b27ac8170d2c3417129f3e7489291b933078..589d8a350064841dadabca6c19db677494002c5c 100644 --- a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/Screens/Regulaer/02Session.g.i.cs +++ b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/Screens/Regulaer/02Session.g.i.cs @@ -1,4 +1,4 @@ -#pragma checksum "..\..\..\..\..\Screens\Regulaer\02Session.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "9B6D99D6ED8E1A78DB85CB3A5AD191E6830B5E1A" +#pragma checksum "..\..\..\..\..\Screens\Regulaer\02Session.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "4D171F84F09119FFF5927E5550B6D53DBDAC090D" //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. @@ -59,15 +59,15 @@ namespace InnoLabProjektDektopApp { #line hidden - #line 17 "..\..\..\..\..\Screens\Regulaer\02Session.xaml" + #line 18 "..\..\..\..\..\Screens\Regulaer\02Session.xaml" [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - internal System.Windows.Shapes.Rectangle ProgressBar; + internal System.Windows.Controls.StackPanel CyclesIndicatorPanel; #line default #line hidden - #line 18 "..\..\..\..\..\Screens\Regulaer\02Session.xaml" + #line 20 "..\..\..\..\..\Screens\Regulaer\02Session.xaml" [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] internal System.Windows.Controls.Button PlayPauseButton; @@ -118,12 +118,12 @@ namespace InnoLabProjektDektopApp { this.Clock = ((System.Windows.Controls.TextBlock)(target)); return; case 3: - this.ProgressBar = ((System.Windows.Shapes.Rectangle)(target)); + this.CyclesIndicatorPanel = ((System.Windows.Controls.StackPanel)(target)); return; case 4: this.PlayPauseButton = ((System.Windows.Controls.Button)(target)); - #line 18 "..\..\..\..\..\Screens\Regulaer\02Session.xaml" + #line 20 "..\..\..\..\..\Screens\Regulaer\02Session.xaml" this.PlayPauseButton.Click += new System.Windows.RoutedEventHandler(this.Button_Click); #line default diff --git a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/apphost.exe b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/apphost.exe index cfdd2ea0393cc608c1c9093114dd02d266fd6c77..e0a257ebe93b4c1e0f06695666311ce3fa01b6f4 100644 Binary files a/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/apphost.exe and b/InnoLabProjektDektopApp/InnoLabProjektDektopApp/obj/Debug/net8.0-windows/apphost.exe differ