예제 #1
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 1:00"), DateTime.Parse("12/29/2012 3:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 2:00"), DateTime.Parse("12/29/2012 5:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 4:00"), DateTime.Parse("12/29/2012 7:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00"), DateTime.Parse("12/29/2012 9:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/24/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/24/2012 12:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/25/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/27/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/28/2012 18:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/28/2012 18:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/30/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/21/2012 12:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/21/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/22/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/18/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/20/2012 7:00")));

                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 12:15"), DateTime.Parse("12/29/2012 13:15")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 12:20"), DateTime.Parse("12/29/2012 16:15")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 17:15"), DateTime.Parse("12/29/2012 17:20")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 18:20"), DateTime.Parse("12/29/2012 18:50")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 20:00"), DateTime.Parse("12/29/2012 22:15")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 23:15"), DateTime.Parse("12/29/2012 23:50")));

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
                MyMainPage = rootFrame;
                MyEditAgendaPage = new EditAgendaPage();
                MyGanttPage = new GanttPage();
                DailyPage = new DailyPage();
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
예제 #2
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 1:00"), DateTime.Parse("12/29/2012 3:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 2:00"), DateTime.Parse("12/29/2012 5:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 4:00"), DateTime.Parse("12/29/2012 7:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00"), DateTime.Parse("12/29/2012 9:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/24/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/24/2012 12:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/25/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/27/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/28/2012 18:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/28/2012 18:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/30/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/21/2012 12:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/21/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/22/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/18/2012 6:00")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/20/2012 7:00")));

                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 12:15"), DateTime.Parse("12/29/2012 13:15")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 12:20"), DateTime.Parse("12/29/2012 16:15")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 17:15"), DateTime.Parse("12/29/2012 17:20")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 18:20"), DateTime.Parse("12/29/2012 18:50")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 20:00"), DateTime.Parse("12/29/2012 22:15")));
                AgendasModel.AddAgenda(new Agenda(DateTime.Parse("12/29/2012 23:15"), DateTime.Parse("12/29/2012 23:50")));

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
                MyMainPage             = rootFrame;
                MyEditAgendaPage       = new EditAgendaPage();
                MyGanttPage            = new GanttPage();
                DailyPage = new DailyPage();
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }