Пример #1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            //如果页面可以回退,则显示回退按钮,使得点击NewPage顶部的“<-”按钮,跳转回MainPage
            if (rootFrame.CanGoBack)
            {
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                    AppViewBackButtonVisibility.Visible;
            }
            else
            {
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                    AppViewBackButtonVisibility.Collapsed;
            }

            ViewModel = ((ViewModels.TodoItemViewModel)e.Parameter);
            if (ViewModel.SelectedItem == null)
            {
                createOrUpdateButton.Content = "Create";
                //var i = new MessageDialog("Welcome!").ShowAsync();
            }
            else
            {
                createOrUpdateButton.Content = "Update";
                Title.Text      = ViewModel.SelectedItem.title;
                myImage.Source  = ViewModel.SelectedItem.img;
                Details.Text    = ViewModel.SelectedItem.description;
                datepicker.Date = ViewModel.SelectedItem.date;
                // ...
            }
        }
Пример #2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame.CanGoBack)
            {
                // Show UI in title bar if opted-in and in-app backstack is not empty.
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                    AppViewBackButtonVisibility.Visible;
            }
            else
            {
                // Remove the UI from the title bar if in-app back stack is empty.
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                    AppViewBackButtonVisibility.Collapsed;
            }

            if (e.Parameter.GetType() == typeof(ViewModels.TodoItemViewModel))
            {
                this.ViewModel = (ViewModels.TodoItemViewModel)(e.Parameter);
            }
            DataTransferManager.GetForCurrentView().DataRequested += OnShareDataRequested;
            TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
            UpdateTile();
        }
Пример #3
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     if (e.Parameter.GetType() == typeof(ViewModels.TodoItemViewModel))
     {
         this.ViewModel = (ViewModels.TodoItemViewModel)(e.Parameter);
     }
 }
Пример #4
0
 public static TodoItemViewModel GetInstance()
 {
     if (instance == null)
     {
         instance = new TodoItemViewModel();
     }
     return(instance);
 }
Пример #5
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     DataTransferManager.GetForCurrentView().DataRequested += OnShareDataRequested;
     if (e.Parameter.GetType() == typeof(ViewModels.TodoItemViewModel))
     {
         this.ViewModel = (ViewModels.TodoItemViewModel)(e.Parameter);
     }
 }
Пример #6
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
         AppViewBackButtonVisibility.Collapsed;
     if (e.Parameter.GetType() == typeof(ViewModels.TodoItemViewModel))
     {
         ViewModel = e.Parameter as ViewModels.TodoItemViewModel;
     }
 }
Пример #7
0
        public NewPage()
        {
            this.InitializeComponent();
            var viewTitleBar = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().TitleBar;

            viewTitleBar.BackgroundColor       = Windows.UI.Colors.CornflowerBlue;
            viewTitleBar.ButtonBackgroundColor = Windows.UI.Colors.CornflowerBlue;
            ViewModel = new ViewModels.TodoItemViewModel();
        }
Пример #8
0
        public MainPage()
        {
            InitializeComponent();
            var titleBar = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().TitleBar;

            titleBar.ForegroundColor       = Colors.White;
            titleBar.BackgroundColor       = Colors.DodgerBlue;
            titleBar.ButtonBackgroundColor = Colors.DodgerBlue;
            NavigationCacheMode            = NavigationCacheMode.Enabled;
            ViewModel = new ViewModels.TodoItemViewModel();
        }
Пример #9
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     if (e.Parameter.GetType() == typeof(ViewModels.TodoItemViewModel))
     {
         this.ViewModel = (ViewModels.TodoItemViewModel)(e.Parameter);
     }
     base.OnNavigatedTo(e);
     dtm = DataTransferManager.GetForCurrentView();
     //创建event handler
     dtm.DataRequested += dtm_DataRequested;
 }
Пример #10
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                AppViewBackButtonVisibility.Collapsed;

            if (e.Parameter.GetType() == typeof(ViewModels.TodoItemViewModel))
            {
                this.ViewModel = (ViewModels.TodoItemViewModel)(e.Parameter);
            }
        }
Пример #11
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     ViewModel = ((ViewModels.TodoItemViewModel)e.Parameter);
     if (ViewModel.SelectedItem == null)
     {
         createButton.Content = "Create";
         //var i = new MessageDialog("Welcome!").ShowAsync();
     }
     else
     {
         createButton.Content = "Update";
         title.Text           = ViewModel.SelectedItem.title;
         details.Text         = ViewModel.SelectedItem.description;
     }
 }
Пример #12
0
        internal static void Tile(ViewModels.TodoItemViewModel View)
        {
            var updater = TileUpdateManager.CreateTileUpdaterForApplication();

            updater.EnableNotificationQueueForSquare150x150(true);
            updater.EnableNotificationQueueForSquare310x310(true);
            updater.EnableNotificationQueueForWide310x150(true);
            updater.EnableNotificationQueue(true);
            foreach (var n in View.AllItems)
            {
                Windows.Data.Xml.Dom.XmlDocument doc = new Windows.Data.Xml.Dom.XmlDocument();
                doc = TileService.CreateTiles(n);
                TileNotification tileNotification = new TileNotification(doc);
                updater.Update(tileNotification);
            }
        }
Пример #13
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     ViewModel = ((ViewModels.TodoItemViewModel)e.Parameter);
     if (ViewModel.SelectedItem == null)
     {
         createButton.Content = "Create";
     }
     else
     {
         createButton.Content = "Update";
         title.Text           = ViewModel.SelectedItem.title;
         details.Text         = ViewModel.SelectedItem.description;
         dueDate.Date         = ViewModel.SelectedItem.DueDate;
         image.Source         = ViewModel.SelectedItem.ImagePath;
     }
 }
Пример #14
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
         AppViewBackButtonVisibility.Visible;
     this.ViewModel = e.Parameter as ViewModels.TodoItemViewModel;
     if (this.ViewModel.SelectedItem != null)
     {
         create_update.Content = "Update";
         title.Text            = ViewModel.SelectedItem.title;
         ITextRange range = detail.Document.GetRange(0, TextConstants.MaxUnitCount);
         range.Text        = ViewModel.SelectedItem.detail;
         ddl.Date          = ViewModel.SelectedItem.date;
         pic.Source        = ViewModel.SelectedItem.img;
         delete.Visibility = Visibility.Visible;
     }
 }
Пример #15
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            ViewModel = ((ViewModels.TodoItemViewModel)e.Parameter);
            if (ViewModel.SelectedItem == null)
            {
                createButton.Content = "Create";
            }
            else
            {
                createButton.Content = "Update";
                //点进已有项目后显示相关信息
                title.Text   = ViewModel.SelectedItem.title;
                details.Text = ViewModel.SelectedItem.description;

                image.Source = ViewModel.SelectedItem.imagesource;
            }
        }
Пример #16
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     ViewModel = ((ViewModels.TodoItemViewModel)e.Parameter);
     if (ViewModel.selected != null)
     {
         CreateButton.Content = "Update";
         title.Text           = ViewModel.selected.title;
         detail.Text          = ViewModel.selected.detail;
         date.Date            = ViewModel.selected.date;
         pictureBox1.Source   = new BitmapImage(ViewModel.selected.ImageUri);
     }
     else
     {
         CreateButton.Content = "Create";
         title.Text           = "";
         detail.Text          = "";
         date.Date            = DateTime.Now;
     }
 }
Пример #17
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     if (e.Parameter.GetType() == typeof(ViewModels.TodoItemViewModel))
     {
         ViewModel = ((ViewModels.TodoItemViewModel)e.Parameter);
         if (ViewModel.SelectedItem == null)
         {
             createButton.Content = "Create";
         }
         else
         {
             createButton.Content = "Update";
             title.Text           = ViewModel.SelectedItem.title;
             details.Text         = ViewModel.SelectedItem.description;
             dueDate.Date         = ViewModel.SelectedItem.DueDate;
             image.Source         = ViewModel.SelectedItem.ImagePath;
         }
     }
     DataTransferManager.GetForCurrentView().DataRequested += OnShareDataRequested;
 }
Пример #18
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame.CanGoBack)
            {
                // Show UI in title bar if opted-in and in-app backstack is not empty.
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                    AppViewBackButtonVisibility.Visible;
            }
            else
            {
                // Remove the UI from the title bar if in-app back stack is empty.
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                    AppViewBackButtonVisibility.Collapsed;
            }

            if (e.Parameter.GetType() == typeof(ViewModels.TodoItemViewModel))
            {
                this.ViewModel = (ViewModels.TodoItemViewModel)(e.Parameter);
            }
        }
Пример #19
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                AppViewBackButtonVisibility.Visible;

            ViewModel = ((ViewModels.TodoItemViewModel)e.Parameter);
            if (ViewModel.SelectedItem == null)
            {
                CUButton.Content = "Create";
                //var i = new MessageDialog("Welcome!").ShowAsync();
            }
            else
            {
                title.Text       = ViewModel.SelectedItem.title;
                detail.Text      = ViewModel.SelectedItem.detail;
                image.Source     = ViewModel.SelectedItem.image;
                date.Date        = ViewModel.SelectedItem.date;
                CUButton.Content = "Update";
            }
        }