diff --git a/MainPage.xaml b/MainPage.xaml
new file mode 100644
index 0000000..87cf610
--- /dev/null
+++ b/MainPage.xaml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MainPage.xaml.cs b/MainPage.xaml.cs
new file mode 100644
index 0000000..adb2239
--- /dev/null
+++ b/MainPage.xaml.cs
@@ -0,0 +1,191 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using System.Windows.Threading;
+
+namespace MyPomodoroApp
+{
+ ///
+ /// Interaction logic for MainPage.xaml
+ ///
+ public partial class MainPage : Page
+ {
+ // Create the Timer
+ private static DispatcherTimer timer = new DispatcherTimer();
+
+ // Store the time remaining for the current session
+ private int minutes = 25;
+ private int seconds = 0;
+
+ // Store the statuses for the sessions
+ public static string workStatus = "Work";
+ private string longBreakStatus = "Long Break";
+ private string shortBreakStatus = "Short Break";
+
+ // Store the duration of each session
+ private int pomodoroTime = 25;
+ private int longBreakTime = 15;
+ private int shortBreakTime = 5;
+
+ // Store the current session number and maximum number of sessions
+ private int curSession = 1;
+ private int maxSessions = 4;
+
+ public MainPage()
+ {
+ InitializeComponent();
+ }
+
+ private void MainPage_Loaded(object sender, RoutedEventArgs e)
+ {
+ // Set the initial values for the timer label and status label
+ UpdateTimerLabel();
+ StatusLabel.Content = workStatus;
+
+ // Set the interval of the timer to 1 second
+ timer.Interval = TimeSpan.FromSeconds(1);
+
+ // Attach the Tick event handler to the timer
+ timer.Tick += Timer_Tick;
+ }
+
+ private void Timer_Tick(object sender, EventArgs e)
+ {
+ // Decrement a second per tick
+ seconds--;
+
+ // If the number of seconds is less than 0, decrement the minutes and reset the number of seconds
+ if (seconds < 0)
+ {
+ minutes--;
+ seconds = 59;
+ }
+
+ // If the number of minutes and seconds is 0, move to the next stage.
+ if (minutes == 0 && seconds == 0)
+ {
+ NextStage();
+ timer.Start();
+ }
+ else
+ {
+ // Update Timer Label
+ UpdateTimerLabel();
+ }
+ }
+
+ private void ToggleButton_Click(object sender, RoutedEventArgs e)
+ {
+ // If the timer is currently running stop it
+ if (timer.IsEnabled)
+ {
+ timer.Stop();
+ ToggleButton.Content = "Start";
+ }
+ else
+ {
+ // If the timer is not currently running, start it
+ timer.Start();
+ ToggleButton.Content = "Stop";
+ }
+ }
+
+ private void ResetButton_Click(object sender, RoutedEventArgs e)
+ {
+ Reset();
+ }
+
+ private void SkipButton_Click(object sender, RoutedEventArgs e)
+ {
+ // Move to the next stage
+ NextStage();
+
+ // Update timer label
+ UpdateTimerLabel();
+ }
+
+ private void Reset()
+ {
+ // Stop the timer
+ timer.Stop();
+
+ // Reset the number of minutes and seconds
+ minutes = pomodoroTime;
+ seconds = 0;
+
+ // Update label
+ UpdateTimerLabel();
+
+ // Update Status Label
+ StatusLabel.Content = workStatus;
+
+ // Reset Current Session and session label
+ curSession = 1;
+ UpdateSessionLabel();
+ }
+
+ private void NextStage()
+ {
+ // Stop the timer
+ timer.Stop();
+
+ // Reset the number of seconds
+ seconds = 0;
+
+ // Update the toggle button
+ ToggleButton.Content = "Start";
+
+ // Check the status of the timer and swithc to the next stage accordingly
+ if (StatusLabel.Content.ToString() == workStatus)
+ {
+ // If max sessions have been completed, start long break
+ if (curSession >= maxSessions)
+ {
+ minutes = longBreakTime;
+ StatusLabel.Content = longBreakStatus;
+ }
+ else
+ {
+ minutes = shortBreakTime;
+ StatusLabel.Content = shortBreakStatus;
+ }
+ }
+ else if (StatusLabel.Content.ToString() == longBreakStatus)
+ {
+ Reset();
+ }
+ else
+ {
+ minutes = pomodoroTime;
+ StatusLabel.Content = workStatus;
+
+ // One cycle has been completed
+ curSession++;
+ }
+
+ // Update the session label
+ UpdateSessionLabel();
+ }
+
+ private void UpdateTimerLabel()
+ {
+ TimerLabel.Content = string.Format("{0:00}:{1:00}", minutes, seconds);
+ }
+
+ private void UpdateSessionLabel()
+ {
+ SessionLabel.Content = string.Format("{0}/{1}", curSession, maxSessions);
+ }
+ }
+}
diff --git a/MainWindow.xaml b/MainWindow.xaml
index 1b0565b..07060de 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -30,18 +30,13 @@
-
+
-
-
-
-
-
-
+
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index f031f67..2cbe341 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -19,27 +19,6 @@ namespace MyPomodoroApp
{
public partial class MainWindow : Window
{
- // Create the Timer
- private DispatcherTimer timer = new DispatcherTimer();
-
- // Store the time remaining for the current session
- private int minutes = 25;
- private int seconds = 0;
-
- // Store the statuses for the sessions
- private string workStatus = "Work";
- private string longBreakStatus = "Long Break";
- private string shortBreakStatus = "Short Break";
-
- // Store the duration of each session
- private int pomodoroTime = 25;
- private int longBreakTime = 15;
- private int shortBreakTime = 5;
-
- // Store the current session number and maximum number of sessions
- private int curSession = 1;
- private int maxSessions = 4;
-
public MainWindow()
{
InitializeComponent();
@@ -47,143 +26,8 @@ public MainWindow()
private void Window_Loaded(object sender, RoutedEventArgs e)
{
- // Set the initial values for the timer label and status label
- UpdateTimerLabel();
- StatusLabel.Content = workStatus;
-
- // Set the interval of the timer to 1 second
- timer.Interval = TimeSpan.FromSeconds(1);
-
- // Attach the Tick event handler to the timer
- timer.Tick += Timer_Tick;
- }
-
- private void Timer_Tick(object sender, EventArgs e)
- {
- // Decrement a second per tick
- seconds--;
-
- // If the number of seconds is less than 0, decrement the minutes and reset the number of seconds
- if (seconds < 0)
- {
- minutes--;
- seconds = 59;
- }
-
- // If the number of minutes and seconds is 0, move to the next stage.
- if (minutes == 0 && seconds == 0)
- {
- NextStage();
- timer.Start();
- }
- else
- {
- // Update Timer Label
- UpdateTimerLabel();
- }
- }
-
- private void ToggleButton_Click(object sender, RoutedEventArgs e)
- {
- // If the timer is currently running stop it
- if (timer.IsEnabled)
- {
- timer.Stop();
- ToggleButton.Content = "Start";
- }
- else
- {
- // If the timer is not currently running, start it
- timer.Start();
- ToggleButton.Content = "Stop";
- }
- }
-
- private void ResetButton_Click(object sender, RoutedEventArgs e)
- {
- Reset();
- }
-
- private void SkipButton_Click(object sender, RoutedEventArgs e)
- {
- // Move to the next stage
- NextStage();
-
- // Update timer label
- UpdateTimerLabel();
- }
-
- private void Reset()
- {
- // Stop the timer
- timer.Stop();
-
- // Reset the number of minutes and seconds
- minutes = pomodoroTime;
- seconds = 0;
-
- // Update label
- UpdateTimerLabel();
-
- // Update Status Label
- StatusLabel.Content = workStatus;
-
- // Reset Current Session and session label
- curSession = 1;
- UpdateSessionLabel();
- }
-
- private void NextStage()
- {
- // Stop the timer
- timer.Stop();
-
- // Reset the number of seconds
- seconds = 0;
-
- // Update the toggle button
- ToggleButton.Content = "Start";
-
- // Check the status of the timer and swithc to the next stage accordingly
- if (StatusLabel.Content.ToString() == workStatus)
- {
- // If max sessions have been completed, start long break
- if (curSession >= maxSessions)
- {
- minutes = longBreakTime;
- StatusLabel.Content = longBreakStatus;
- }
- else
- {
- minutes = shortBreakTime;
- StatusLabel.Content = shortBreakStatus;
- }
- }
- else if (StatusLabel.Content.ToString() == longBreakStatus)
- {
- Reset();
- }
- else
- {
- minutes = pomodoroTime;
- StatusLabel.Content = workStatus;
-
- // One cycle has been completed
- curSession++;
- }
-
- // Update the session label
- UpdateSessionLabel();
- }
-
- private void UpdateTimerLabel()
- {
- TimerLabel.Content = string.Format("{0:00}:{1:00}", minutes, seconds);
- }
-
- private void UpdateSessionLabel()
- {
- SessionLabel.Content = string.Format("{0}/{1}", curSession, maxSessions);
+ // Load main page
+ MainFrame.Navigate(new Uri("MainPage.xaml", UriKind.Relative));
}
private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
@@ -200,5 +44,9 @@ private void CloseButton_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
+
+ private void SettingsButton_Click(object sender, RoutedEventArgs e)
+ {
+ }
}
}
diff --git a/SettingsPage.xaml b/SettingsPage.xaml
new file mode 100644
index 0000000..4e55b3a
--- /dev/null
+++ b/SettingsPage.xaml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
diff --git a/SettingsPage.xaml.cs b/SettingsPage.xaml.cs
new file mode 100644
index 0000000..06ef9ea
--- /dev/null
+++ b/SettingsPage.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace MyPomodoroApp
+{
+ ///
+ /// Interaction logic for SettingsPage.xaml
+ ///
+ public partial class SettingsPage : Page
+ {
+ public SettingsPage()
+ {
+ InitializeComponent();
+ }
+ }
+}