Ejemplo n.º 1
0
        public App()
        {
            //GenericHelpers.LogTime("A");
            InitializeComponent();
            Data.SetTimer();
            Directory.CreateDirectory(BkPath);
            EventManager.RegisterClassHandler(typeof(FrameworkElement), UIElement.GotFocusEvent, new RoutedEventHandler((s, e) => ((FrameworkElement)s).FocusVisualStyle = null), true);
            TimetableStructure.SetData(new List <TimetableStructureWeek>()
            {
                new TimetableStructureWeek("A", DataHelpers.ShortenedDaysOfTheWeek,
                                           new List <string>()
                {
                    "1", "2", "Brk", "3", "4", "Lch", "5"
                }, new List <int>()
                {
                    2, 5, 9, 12, 16, 19, 23, 26, 30, 33
                }),
                new TimetableStructureWeek("B", DataHelpers.ShortenedDaysOfTheWeek,
                                           new List <string>()
                {
                    "1", "2", "Brk", "3", "4", "Lch", "5"
                }, new List <int>()
                {
                    2, 5, 9, 12, 16, 19, 23, 26, 30, 33
                })
            });
            SessionEnding += delegate(object sender, SessionEndingCancelEventArgs e)
            {
                if (MainWindow is StartWindow)
                {
                    return;
                }
                MessageBoxResult result = VisualHelpers.ShowUnsavedBox();
                if (result == MessageBoxResult.Cancel)
                {
                    e.Cancel = true;
                    return;
                }
                if (result == MessageBoxResult.Yes)
                {
                    FileHelpers.SaveData(FilePath);
                }
            };

            //GenericHelpers.LogTime("B");
        }
Ejemplo n.º 2
0
 public WindowBase()
 {
     Icon     = BitmapFrame.Create(new Uri("../../Media/AppIcon2.png", UriKind.Relative));
     Closing += delegate(object sender, CancelEventArgs e)
     {
         if (Application.Current.Windows.Count == 1)
         {
             MessageBoxResult result = VisualHelpers.ShowUnsavedBox();
             if (result == MessageBoxResult.Yes)
             {
                 FileHelpers.SaveData(App.FilePath);
             }
             if (result == MessageBoxResult.Cancel)
             {
                 e.Cancel = true;
                 return;
             }
         }
     };
 }