Skip to content
Snippets Groups Projects
Commit c9b946b3 authored by Sandra Borst's avatar Sandra Borst
Browse files

Merge branch 'focusSessionFeature4' into 'develop'

auto start of focus session; minutes instead of seconds; correct display of break session

See merge request !24
parents e8da55f8 31a6112d
Branches
No related tags found
1 merge request!24auto start of focus session; minutes instead of seconds; correct display of break session
...@@ -8,15 +8,17 @@ ...@@ -8,15 +8,17 @@
mc:Ignorable="d" mc:Ignorable="d"
Height="550" Width="900"> Height="550" Width="900">
<Grid> <Grid>
<header:HeaderTemplate VerticalAlignment="Top"/> <Button Margin="0,100,150,10" Width="40" Height="40" HorizontalAlignment="Right" VerticalAlignment="Top" Background="Transparent" BorderBrush="Transparent" Click="discardSession_Click">
<Button Content="Subscription" Style="{StaticResource TopMenuButon}" HorizontalAlignment="Right" Margin="0,4,180,0" VerticalAlignment="Top" Height="26" Width="80"/> <Grid >
<Button Content="Contact" Style="{StaticResource TopMenuButon}" HorizontalAlignment="Right" Margin="0,4,100,0" VerticalAlignment="Top" Height="26" Width="80"/> <Line X1="5" Y1="5" X2="35" Y2="35" Stroke="Gray" StrokeThickness="5" />
<Button Content="Distractions" Style="{StaticResource TopMenuButon}" HorizontalAlignment="Right" Margin="0,4,20,0" VerticalAlignment="Top" Height="26" Width="80"/> <Line X1="5" Y1="35" X2="35" Y2="5" Stroke="Gray" StrokeThickness="5" />
</Grid>
</Button>
<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 ="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"/> <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"/>
<StackPanel x:Name="CyclesIndicatorPanel" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,60,0,0"> <StackPanel x:Name="CyclesIndicatorPanel" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,60,0,0">
</StackPanel> </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"/> <Button Content="Pause" Name="PlayPauseButton" Style="{StaticResource PlayPauseButton}" HorizontalAlignment="Center" Margin="0,320,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" Click="PlayPause_Click"/>
</Grid> </Grid>
</Window> </Window>
\ No newline at end of file
...@@ -33,7 +33,7 @@ namespace InnoLabProjektDektopApp ...@@ -33,7 +33,7 @@ namespace InnoLabProjektDektopApp
private Timer timer; private Timer timer;
private int maxTime; private int maxTime;
private int seconds; private int seconds;
private int step = 0; //Indicates whether the timer is running (-1) or paused (0) private int step = -1; //Indicates whether the timer is running (-1) or paused (0)
private int sessions; private int sessions;
private int currentSession = 1; //Tracks which session is currently running private int currentSession = 1; //Tracks which session is currently running
...@@ -47,7 +47,7 @@ namespace InnoLabProjektDektopApp ...@@ -47,7 +47,7 @@ namespace InnoLabProjektDektopApp
{ {
InitializeComponent(); InitializeComponent();
this.focusPeriod = focusPeriod; this.focusPeriod = focusPeriod;
this.breakPeriod = breakPeriod; this.breakPeriod = breakPeriod * 60;
this.cycles = cycles; this.cycles = cycles;
this.distractionMode = distractionMode; this.distractionMode = distractionMode;
this.mascotVisible = mascotVisible; this.mascotVisible = mascotVisible;
...@@ -55,7 +55,7 @@ namespace InnoLabProjektDektopApp ...@@ -55,7 +55,7 @@ namespace InnoLabProjektDektopApp
this.insultingWords = insultingWords; this.insultingWords = insultingWords;
GlobalSettings.setDefaults(this); GlobalSettings.setDefaults(this);
this.maxTime = focusPeriod/2; //todo: multiply with 60 later this.maxTime = focusPeriod * 60; //todo: multiply with 60 later
this.seconds = this.maxTime; this.seconds = this.maxTime;
this.sessions = cycles; this.sessions = cycles;
...@@ -74,10 +74,9 @@ namespace InnoLabProjektDektopApp ...@@ -74,10 +74,9 @@ namespace InnoLabProjektDektopApp
updateTexts(); // Aktualisiere die UI updateTexts(); // Aktualisiere die UI
// Fortschrittsanzeige nur während der Fokusperiode aktualisieren // Fortschrittsanzeige nur während der Fokusperiode aktualisieren
if (!isBreakPeriod)
{
CreateCycleIndicators(); // Fortschritt für Fokus-Perioden anzeigen CreateCycleIndicators(); // Fortschritt für Fokus-Perioden anzeigen
}
if (seconds <= 0) // Wenn die Zeit abgelaufen ist if (seconds <= 0) // Wenn die Zeit abgelaufen ist
{ {
...@@ -147,11 +146,14 @@ namespace InnoLabProjektDektopApp ...@@ -147,11 +146,14 @@ namespace InnoLabProjektDektopApp
} }
private void Button_Click(object sender, RoutedEventArgs e) private void PlayPause_Click(object sender, RoutedEventArgs e)
{
if (step < 0)
{ {
if (step < 0) {
stopTimer(); stopTimer();
} else { }
else
{
startTimer(); startTimer();
} }
} }
...@@ -166,24 +168,29 @@ namespace InnoLabProjektDektopApp ...@@ -166,24 +168,29 @@ namespace InnoLabProjektDektopApp
{ {
if (i + 1 == currentSession) // Highlight the current session with a ProgressBar if (i + 1 == currentSession) // Highlight the current session with a ProgressBar
{ {
Grid cycleGrid = new Grid if (isBreakPeriod) // Während der BreakPeriod
{ {
Width = 50, // Zeige ausgefüllten Kreis für die aktuelle Session
Height = 20, // Höhe des erweiterten Kreises Ellipse filledCircle = new Ellipse
{
Width = 20,
Height = 20,
Margin = new Thickness(10), Margin = new Thickness(10),
Fill = new SolidColorBrush(Color.FromRgb(72, 98, 132)), // Ausgefüllter Kreis
}; };
CyclesIndicatorPanel.Children.Add(filledCircle);
// Background for the current cycle }
Rectangle backgroundRectangle = new Rectangle else // Während der FocusPeriod
{
// Zeige die ProgressBar für die aktuelle Session
Grid cycleGrid = new Grid
{ {
Width = 50, Width = 50,
Height = 20, Height = 20, // Höhe des erweiterten Kreises
Fill = Brushes.LightGray, Margin = new Thickness(10),
RadiusX = 10,
RadiusY = 10,
}; };
// ProgressBar (uses the existing logic) // ProgressBar
Rectangle progressBar = new Rectangle Rectangle progressBar = new Rectangle
{ {
Width = 50, // Gleiche Breite wie der Hintergrund Width = 50, // Gleiche Breite wie der Hintergrund
...@@ -198,10 +205,10 @@ namespace InnoLabProjektDektopApp ...@@ -198,10 +205,10 @@ namespace InnoLabProjektDektopApp
HorizontalAlignment = HorizontalAlignment.Left, HorizontalAlignment = HorizontalAlignment.Left,
}; };
cycleGrid.Children.Add(backgroundRectangle); cycleGrid.Children.Add(progressBar); // ProgressBar hinzufügen
cycleGrid.Children.Add(progressBar); // ProgressBar überlagert den Hintergrund
CyclesIndicatorPanel.Children.Add(cycleGrid); CyclesIndicatorPanel.Children.Add(cycleGrid);
} }
}
else else
{ {
// Standardkreis für abgeschlossene oder zukünftige Zyklen // Standardkreis für abgeschlossene oder zukünftige Zyklen
...@@ -218,6 +225,66 @@ namespace InnoLabProjektDektopApp ...@@ -218,6 +225,66 @@ namespace InnoLabProjektDektopApp
} }
} }
private void discardSession_Click(object sender, RoutedEventArgs e)
{
// Neues Fenster für die Auswahl des Abbruchgrunds erstellen
Window reasonWindow = new Window
{
Title = "Warum beenden Sie die Sitzung?",
Width = 600,
Height = 180,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
ResizeMode = ResizeMode.NoResize
};
// Haupt-StackPanel für die Radiobuttons und den OK-Button
StackPanel stackPanel = new StackPanel
{
Margin = new Thickness(10)
};
// Radiobuttons für die Gründe
RadioButton reason1 = new RadioButton { Content = "Ich habe mich dazu entschieden, frühzeitig zu beenden (wird in die Statistik mit aufgenommen).", Margin = new Thickness(5), IsChecked = true };
RadioButton reason2 = new RadioButton { Content = "Mir ist etwas sehr Wichtiges dazwischengekommen, was ich nicht verschieben konnte.", Margin = new Thickness(5) };
// OK-Button
Button okButton = new Button
{
Content = "Ok",
Margin = new Thickness(5),
Width = 80,
HorizontalAlignment = HorizontalAlignment.Right
};
okButton.Click += (s, args) =>
{
string selectedReason = reason1.IsChecked == true ? "Ich habe mich dazu entschieden, frühzeitig zu beenden" :
reason2.IsChecked == true ? "Mir ist etwas sehr Wichtiges dazwischengekommen, was ich nicht verschieben konnte." :
"Kein Grund ausgewählt";
MessageBox.Show($"Abbruchgrund: {selectedReason}", "Sitzung beendet", MessageBoxButton.OK, MessageBoxImage.Information);
// Zum OverviewScreen navigieren
var overviewScreen = new Overview();
overviewScreen.Show();
reasonWindow.Close(); // Fenster schließen
this.Close(); // Aktuelles Fenster schließen
};
// Radiobuttons und Button zum StackPanel hinzufügen
stackPanel.Children.Add(new TextBlock { Text = "Wählen Sie den Grund für den Abbruch aus:", Margin = new Thickness(5) });
stackPanel.Children.Add(reason1);
stackPanel.Children.Add(reason2);
stackPanel.Children.Add(okButton);
// StackPanel als Content des Fensters setzen
reasonWindow.Content = stackPanel;
// Fenster anzeigen
reasonWindow.ShowDialog();
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment