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

uses now the values from the settings; frontend with the changing UI of the...

uses now the values from the settings; frontend with the changing UI of the circles implemented and progressbar integrated
parent c6907a4a
No related branches found
No related tags found
1 merge request!22uses now the values from the settings; frontend with the changing UI of the...
Showing
with 117 additions and 25 deletions
No preview for this file type
No preview for this file type
...@@ -151,7 +151,31 @@ namespace InnoLabProjektDektopApp ...@@ -151,7 +151,31 @@ namespace InnoLabProjektDektopApp
// Ereignis-Handler für den "Start"-Button // Ereignis-Handler für den "Start"-Button
private void StartButton_Click(object sender, RoutedEventArgs e) 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();
} }
} }
} }
...@@ -14,7 +14,9 @@ ...@@ -14,7 +14,9 @@
<Button Content="Distractions" Style="{StaticResource TopMenuButon}" HorizontalAlignment="Right" Margin="0,4,20,0" VerticalAlignment="Top" Height="26" Width="80"/> <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 ="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"/>
<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> </Grid>
</Window> </Window>
\ No newline at end of file
...@@ -30,10 +30,10 @@ namespace InnoLabProjektDektopApp ...@@ -30,10 +30,10 @@ namespace InnoLabProjektDektopApp
private Timer timer; private Timer timer;
private const int maxTime = (0 * 60) + 5;// total time for each session in seconds private int maxTime;
private int seconds = maxTime; // Tracks the remaining seconds in the current session private int seconds;
private int step = 0; //Indicates whether the timer is running (-1) or paused (0) 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 private int currentSession = 1; //Tracks which session is currently running
public Session(int focusPeriod, public Session(int focusPeriod,
...@@ -54,8 +54,14 @@ namespace InnoLabProjektDektopApp ...@@ -54,8 +54,14 @@ namespace InnoLabProjektDektopApp
this.insultingWords = insultingWords; this.insultingWords = insultingWords;
GlobalSettings.setDefaults(this); 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 timer = new Timer(timertick, null,0,1000); //A background timer calls timertick every second
CreateCycleIndicators(); // Kreise erstellen
updateTexts(); updateTexts();
} }
...@@ -65,11 +71,7 @@ namespace InnoLabProjektDektopApp ...@@ -65,11 +71,7 @@ namespace InnoLabProjektDektopApp
{ {
seconds += step; // Decrement seconds if running seconds += step; // Decrement seconds if running
updateTexts(); // Update UI updateTexts(); // Update UI
ProgressBar.Fill = GradientGenerator.generateTwoColorBrush( CreateCycleIndicators(); // Update the indicators dynamically
Color.FromRgb(72, 98, 132),
Color.FromRgb(222, 222, 222),
1 - (seconds / (double)maxTime)
);
if (seconds <= 0) // When time runs out if (seconds <= 0) // When time runs out
{ {
...@@ -122,6 +124,70 @@ namespace InnoLabProjektDektopApp ...@@ -122,6 +124,70 @@ namespace InnoLabProjektDektopApp
startTimer(); 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);
}
}
}
} }
} }
......
...@@ -14,7 +14,7 @@ using System.Reflection; ...@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("CoFlow")] [assembly: System.Reflection.AssemblyCompanyAttribute("CoFlow")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e6579ef0d3b607362222ce416775f79a38e2a15b")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+c6907a4a2e47a9c230c74e6c3a0399a282943f7d")]
[assembly: System.Reflection.AssemblyProductAttribute("CoFlow")] [assembly: System.Reflection.AssemblyProductAttribute("CoFlow")]
[assembly: System.Reflection.AssemblyTitleAttribute("CoFlow")] [assembly: System.Reflection.AssemblyTitleAttribute("CoFlow")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
......
aada719c9e57b2dfa11e1b6fee01ad786fcaf6337a6a62c39bf8cce0ea37e6c6 15f2250c7ca34adfd29337a15ef6a5753f245b54dab62d9fed0df2a386f60940
#pragma checksum "..\..\..\..\..\Screens\Regulaer\02Session.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "9B6D99D6ED8E1A78DB85CB3A5AD191E6830B5E1A" #pragma checksum "..\..\..\..\..\Screens\Regulaer\02Session.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "C4D93C0A65CE4771BDEE790F0915FF047E545018"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
...@@ -59,15 +59,15 @@ namespace InnoLabProjektDektopApp { ...@@ -59,15 +59,15 @@ namespace InnoLabProjektDektopApp {
#line hidden #line hidden
#line 17 "..\..\..\..\..\Screens\Regulaer\02Session.xaml" #line 18 "..\..\..\..\..\Screens\Regulaer\02Session.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Shapes.Rectangle ProgressBar; internal System.Windows.Controls.StackPanel CyclesIndicatorPanel;
#line default #line default
#line hidden #line hidden
#line 18 "..\..\..\..\..\Screens\Regulaer\02Session.xaml" #line 20 "..\..\..\..\..\Screens\Regulaer\02Session.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button PlayPauseButton; internal System.Windows.Controls.Button PlayPauseButton;
...@@ -118,12 +118,12 @@ namespace InnoLabProjektDektopApp { ...@@ -118,12 +118,12 @@ namespace InnoLabProjektDektopApp {
this.Clock = ((System.Windows.Controls.TextBlock)(target)); this.Clock = ((System.Windows.Controls.TextBlock)(target));
return; return;
case 3: case 3:
this.ProgressBar = ((System.Windows.Shapes.Rectangle)(target)); this.CyclesIndicatorPanel = ((System.Windows.Controls.StackPanel)(target));
return; return;
case 4: case 4:
this.PlayPauseButton = ((System.Windows.Controls.Button)(target)); 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); this.PlayPauseButton.Click += new System.Windows.RoutedEventHandler(this.Button_Click);
#line default #line default
......
#pragma checksum "..\..\..\..\..\Screens\Regulaer\02Session.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "9B6D99D6ED8E1A78DB85CB3A5AD191E6830B5E1A" #pragma checksum "..\..\..\..\..\Screens\Regulaer\02Session.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "C4D93C0A65CE4771BDEE790F0915FF047E545018"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
...@@ -59,15 +59,15 @@ namespace InnoLabProjektDektopApp { ...@@ -59,15 +59,15 @@ namespace InnoLabProjektDektopApp {
#line hidden #line hidden
#line 17 "..\..\..\..\..\Screens\Regulaer\02Session.xaml" #line 18 "..\..\..\..\..\Screens\Regulaer\02Session.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Shapes.Rectangle ProgressBar; internal System.Windows.Controls.StackPanel CyclesIndicatorPanel;
#line default #line default
#line hidden #line hidden
#line 18 "..\..\..\..\..\Screens\Regulaer\02Session.xaml" #line 20 "..\..\..\..\..\Screens\Regulaer\02Session.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Button PlayPauseButton; internal System.Windows.Controls.Button PlayPauseButton;
...@@ -118,12 +118,12 @@ namespace InnoLabProjektDektopApp { ...@@ -118,12 +118,12 @@ namespace InnoLabProjektDektopApp {
this.Clock = ((System.Windows.Controls.TextBlock)(target)); this.Clock = ((System.Windows.Controls.TextBlock)(target));
return; return;
case 3: case 3:
this.ProgressBar = ((System.Windows.Shapes.Rectangle)(target)); this.CyclesIndicatorPanel = ((System.Windows.Controls.StackPanel)(target));
return; return;
case 4: case 4:
this.PlayPauseButton = ((System.Windows.Controls.Button)(target)); 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); this.PlayPauseButton.Click += new System.Windows.RoutedEventHandler(this.Button_Click);
#line default #line default
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment