示例#1
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public SurfaceWindow1()
        {
            log = new Logger("Rememo");
            log.Write("Starting application");

            if (DiaryManager.ConfigExists())
            {
                InitializeComponent();

                clock.Elapsed += new System.Timers.ElapsedEventHandler(clock_Elapsed);
                log.Write("Config found!");
                clock.Enabled = true;
                log.Write("Clock enabled");
                log.Write("Welcome Text set");
            }
            else
            {
                InitializeComponent();

                clock.Elapsed += new System.Timers.ElapsedEventHandler(clock_Elapsed);
                log.Write("No config file!");
                clock.Enabled = true;
                log.Write("clock enabled");
                welcomeText(false);
            }
            // Add handlers for Application activation events
            AddActivationHandlers();
        }
示例#2
0
        /* private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
         * {
         *   String temp = ContentSelector.SelectedItem.ToString();
         *   timeSelect.Content = temp.Substring(temp.IndexOf(':')+1,6);
         *
         * }*/

        private void userName_Loaded(object sender, RoutedEventArgs e)
        {
            if (DiaryManager.ConfigExists())
            {
                userName.Text     = diaryConfig.Name;
                setMorning.Text   = diaryConfig.MorningTime.ToString();
                setAfternoon.Text = diaryConfig.AfternoonTime.ToString();
                setEvening.Text   = diaryConfig.EveningTime.ToString();
                setSpecial.Text   = diaryConfig.SpecialTime.ToString();
            }
        }
示例#3
0
 private void button2_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         diaryConfig.MorningTime   = TimeSpan.Parse(setMorning.Text);
         diaryConfig.AfternoonTime = TimeSpan.Parse(setAfternoon.Text);
         diaryConfig.EveningTime   = TimeSpan.Parse(setEvening.Text);
         diaryConfig.SpecialTime   = TimeSpan.Parse(setSpecial.Text);
         DiaryManager.WriteConfig(diaryConfig);
     }
     catch (Exception)
     {
         log.Write("{0}: Exception");
     }
     welcomeText(true);
     tabItem1.IsSelected = true;
 }
示例#4
0
        private void InitDiary()
        {
            diaryConfig          = DiaryManager.ReadConfig();
            diaryEntryCollection = DiaryEntryCollection.Load();

            log.Write("Initialised Diary.");


            DateTime now   = DateTime.Now;
            DateTime start = diaryConfig.StartDate;

            bool configured = DiaryManager.ConfigExists();

            if (configured)
            {
                welcomeText(true);
            }


            if (now.DayOfYear - start.DayOfYear > 7)
            {
                // We're in week 2 now
                //button_nextWeek.Background = (SolidColorBrush)Resources["Colour6"];

                selectedWeek = 2;
            }
            else
            {
                // Still in week 1
                //button_prevWeek.Background = (SolidColorBrush)Resources["Colour6"];

                selectedWeek = 1;
            }

            // Update diary UI
            UpdateDiaryUI();

            //editingNote = false;
        }
示例#5
0
 private void userName_TextChanged(object sender, TextChangedEventArgs e)
 {
     diaryConfig.Name = userName.Text;
     DiaryManager.WriteConfig(diaryConfig);
 }