コード例 #1
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            String CategoryId;
            if (updatingCategory == null && NavigationContext.QueryString.TryGetValue("CategoryId", out CategoryId))
            {
                updatingCategory = this.viewModel.CategoryList.Single<Category>(s => s.Id == int.Parse(CategoryId));
                this.newName_TextBox.Text = updatingCategory.Name;
                this.CategoryListPicker.SelectedIndex = this.viewModel.CategoryList.IndexOf(updatingCategory.Parent);
            }
        }
コード例 #2
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            string CategoryIdString;
            this.NavigationContext.QueryString.TryGetValue("CategoryId", out CategoryIdString);

            CategoryId = int.Parse(CategoryIdString);

            currentCategory = viewModel.CategoryList.First(s => s.Id == CategoryId);
            this.LayoutRoot.DataContext = currentCategory;

            if (currentCategory.Id == this.viewModel.All.Id)
                ((ApplicationBarIconButton)this.ApplicationBar.Buttons[0]).IsEnabled = false;

            if (currentCategory.Id == viewModel.All.Id)
            {
                this.CategoryPivot.Items.Remove(this.AchievedTasks);
            }
            else
            {
                try
                {
                    this.incompleteTasks = new ObservableCollection<Task>(this.currentCategory.Tasks.Where<Task>(t => t.IsComplete == false).OrderByDescending(t => t.When));
                }
                catch (Exception error)
                {
                    this.incompleteTasks = new ObservableCollection<Task>();
                }
                try
                {

                    this.completeTasks = new ObservableCollection<Task>(this.currentCategory.Tasks.Where<Task>(t => t.IsComplete == true).OrderByDescending(t => t.When));
                }
                catch (Exception)
                {
                    this.completeTasks = new ObservableCollection<Task>();
                }
                this.AllTasks.ItemsSource = incompleteTasks;
                this.CompletedTasks.ItemsSource = completeTasks;
            }

            this.Rewards_ListBox.ItemsSource = this.currentCategory.Rewards;
        }
コード例 #3
0
ファイル: TaskModel.cs プロジェクト: ulyssesp/RewardYourTasks
 private void detatch_Child(Category child)
 {
     NotifyPropertyChanging("Child");
     child.Parent = null;
     NotifyPropertyChanged("Child");
 }
コード例 #4
0
ファイル: TaskModel.cs プロジェクト: ulyssesp/RewardYourTasks
 private void attach_Child(Category child)
 {
     NotifyPropertyChanging("Child");
     child.Parent = this;
     NotifyPropertyChanged("Child");
 }