Beispiel #1
0
        private void SaveAsNotepadFile_OnClick(object sender, RoutedEventArgs e)
        {
            DrawerHost.IsBottomDrawerOpen = false;
            var slots    = TimetableViewer.GetCurrentTimetable().ToList();
            var subjects = SubjectSummaryModel.GroupIntoSubjects(slots);
            var p        = new SaveFileDialog()
            {
                Filter   = "Notepad file (*.txt)|*.txt",
                FileName = "MyTimetableSummary"
            };

            if (p.ShowDialog() == false)
            {
                return;
            }
            string result = "";

            foreach (var s in subjects)
            {
                result += s.ToString() + "\r\n\r\n";
            }
            try {
                File.WriteAllText(p.FileName, result);
                Global.Snackbar.MessageQueue.Enqueue("File saved at " + p.FileName, "OPEN",
                                                     () => { Process.Start(p.FileName); });
            }
            catch (Exception ex) {
                Global.Snackbar.MessageQueue.Enqueue("Failed to save file.", "SHOW DETAILS",
                                                     () => { MessageBox.Show(ex.Message); });
            }
        }
Beispiel #2
0
 private void TimetableViewer_OnViewChanged(object sender, EventArgs e)
 {
     _currentViewedTimetable.SetState(TimetableViewer.GetCurrentTimetable());
     if (!TimetableViewer.JustBuilded())
     {
         ;
     }
     //SelectSubjectPanel.Collapse();
 }
Beispiel #3
0
        private void SaveAsPicture_OnClick(object sender, RoutedEventArgs e)
        {
            DrawerHost.IsBottomDrawerOpen = false;
            var p = new Window {
                SizeToContent = SizeToContent.WidthAndHeight,
                Content       = new Page_SaveTimetableAsImage(TimetableViewer.GetCurrentTimetable())
            };

            p.Show();
            p.Close();
        }
Beispiel #4
0
 private void SaveToGoogleCalendarButton_OnClick(object sender, RoutedEventArgs e)
 {
     DrawerHost.IsBottomDrawerOpen = false;
     NavigationService.Navigate(new Page_AddToGoogleCalendar(TimetableViewer.GetCurrentTimetable(),
                                                             Global.TimetableStartDate));
 }
 private void PrintAsPng_OnClick(object sender, RoutedEventArgs e)
 {
     this.NavigationService.Navigate(
         new Page_SaveTimetableAsImage(TimetableViewer.GetCurrentTimetable())
         );
 }
 private void AddToGoogleCalendarButton_OnClick(object sender, RoutedEventArgs e)
 {
     NavigationService.Navigate(new Page_AddToGoogleCalendar(TimetableViewer.GetCurrentTimetable(),
                                                             Global.TimetableStartDate));
 }
 private void FavoriteButton_OnUnchecked(object sender, RoutedEventArgs e)
 {
     TimetableViewer.GetCurrentTimetable().IsLiked = false;
 }