コード例 #1
0
        public static void Go(PhoneApplicationPage fromPage, Category category)
        {
            SelectionHandler = new PageActionHandler<Category>();
            SelectionHandler.AfterSelected = delegate(Category item)
            {
                if ((item != null) && (item.Id != category.ParentCategoryId))
                {
                    if (category.ParentCategory != null)
                    {
                        category.ParentCategory.Childrens.Remove(category);
                    }

                    category.ParentCategory = item;
                    if (item.Childrens.Count(p => p.Name == category.Name) == 0)
                    {
                        // reset order.
                        category.Order = item.Childrens
                            .Select(p => (int)p.Order).ToList().Max(p => p) + 1;

                        item.Childrens.Add(category);
                    }

                    ((System.Collections.Generic.IEnumerable<AccountItem>)category.AccountItems).ForEach<AccountItem>(p =>
                    {
                        p.RaisePropertyChangd("NameInfo");
                    });
                    ViewModelLocator.CategoryViewModel.Update(category);
                }
            };
            fromPage.NavigateTo("/pages/CategoryManager/SelectParentCategoryPage.xaml?id={0}&currentName={1}&type={2}&childName={3}", new object[] { category.ParentCategoryId, category.ParentCategory == null ? "N/A" : category.ParentCategory.Name, category.CategoryType, category.Name });
        }
コード例 #2
0
 public static void Go(PhoneApplicationPage fromPage, Category category)
 {
     SelectionHandler = new PageActionHandler<Category>();
     SelectionHandler.AfterSelected = delegate(Category item)
     {
         if ((item != null) && (item.Id != category.ParentCategoryId))
         {
             category.ParentCategory.Childrens.Remove(category);
             category.ParentCategory = item;
             if (!item.Childrens.Contains(category))
             {
                 item.Childrens.Add(category);
             }
             ((System.Collections.Generic.IEnumerable<AccountItem>)category.AccountItems).ForEach<AccountItem>(delegate(AccountItem p)
             {
                 p.RaisePropertyChangd("NameInfo");
             });
             ViewModelLocator.CategoryViewModel.Update(category);
         }
     };
     fromPage.NavigateTo("/pages/CategoryManager/SelectParentCategoryPage.xaml?id={0}&currentName={1}&type={2}&childName={3}", new object[] { category.ParentCategoryId, category.ParentCategory.Name, category.CategoryType, category.Name });
 }
コード例 #3
0
 private void BrowserLib_Click(object sender, System.EventArgs e)
 {
     System.Action<PeopleProfile> action = null;
     if (this.peopleChooserHandler == null)
     {
         this.peopleChooserHandler = new PageActionHandler<PeopleProfile>();
         this.peopleChooserHandler.GetItems = () => ViewModelLocator.PeopleViewModel.AccountBookDataContext.Peoples.AsEnumerable<PeopleProfile>();
         if (action == null)
         {
             action = delegate(PeopleProfile result)
             {
                 PeopleAssociationData item = new PeopleAssociationData
                 {
                     PeopleInfo = result,
                     AttachedId = this.CurrentAttachedObjectId
                 };
                 this.Peoples.Add(item);
                 PeopleSelectorHandler.OnAfterAdd(item);
             };
         }
         PeopleImporter.ResultGetter = action;
     }
     PeopleImporter.Go(this.peopleChooserHandler, this);
 }
コード例 #4
0
 private void PeopleTotalInfoTakerButton_Click(object sender, RoutedEventArgs e)
 {
     System.Action<PeopleAssociationData> action = null;
     System.Action<PeopleAssociationData> action2 = null;
     System.Action<PeopleAssociationData> action3 = null;
     if (this.peopleHandler == null)
     {
         this.peopleHandler = new PageActionHandler<PeopleAssociationData>();
         if (action == null)
         {
             action = delegate(PeopleAssociationData i)
             {
                 currentEditObject.Peoples.Add(i);
                 if (this.actionType == PageActionType.Edit)
                 {
                     this.accountItemViewModel.Update(currentEditObject);
                 }
             };
         }
         this.peopleHandler.AfterAdd = action;
         if (action2 == null)
         {
             action2 = delegate(PeopleAssociationData i)
             {
                 if (this.actionType == PageActionType.Edit)
                 {
                     this.accountItemViewModel.Update(currentEditObject);
                 }
             };
         }
         this.peopleHandler.Update = action2;
         if (action3 == null)
         {
             action3 = delegate(PeopleAssociationData i)
             {
                 currentEditObject.Peoples.Remove(i);
                 if (this.actionType == PageActionType.Edit)
                 {
                     this.accountItemViewModel.Update(currentEditObject);
                 }
             };
         }
         this.peopleHandler.AfterDelete = action3;
         this.peopleHandler.GetItems = () => currentEditObject.Peoples;
         AttachPeoplePage.PeopleSelectorHandler = this.peopleHandler;
     }
     AttachPeoplePage.Go(currentEditObject.Id, this);
 }
コード例 #5
0
 private PageActionHandler<Category> InitializeCategorySelectorDialogBox()
 {
     System.Action<Category> action = null;
     System.Func<Category> func = null;
     if (this.categorySelectorHandler == null)
     {
         this.categorySelectorHandler = new PageActionHandler<Category>();
         if (action == null)
         {
             action = delegate(Category item)
             {
                 if (item != null)
                 {
                     this.CategoryNameButton.DataContext = item.CategoryInfo;
                     this.tempCategory = item;
                     if (this.actionType == PageActionType.Add)
                     {
                         this.TotalMoneyBox.Text = item.DefaultAmountString;
                     }
                 }
             };
         }
         this.categorySelectorHandler.AfterSelected = action;
         if (func == null)
         {
             func = () => this.tempCategory;
         }
         this.categorySelectorHandler.GetSelected = func;
     }
     return this.categorySelectorHandler;
 }
コード例 #6
0
 static MoneyBuildingPage()
 {
     BuildingHandler = new PageActionHandler<TypedKeyValuePair<string, decimal>>();
 }
コード例 #7
0
 public static void Go(PageActionHandler<PeopleProfile> selectorHandler, PhoneApplicationPage fromPage)
 {
     PeopleSelectorHandler = selectorHandler;
     fromPage.NavigateTo("/pages/DialogBox/PeopleImporter.xaml");
 }
コード例 #8
0
 public static void Go(PhoneApplicationPage fromPage, PageActionHandler<Category> categorySelectorHandler, ItemType categoryType, bool selectionMode = false)
 {
     SelectionModeHandler = categorySelectorHandler;
     fromPage.NavigateTo("/Pages/CategoryManager/CategoryManagment.xaml?type={0}&selectionMode={1}", new object[] { categoryType, selectionMode });
 }
コード例 #9
0
        private void PeopleTotalInfoTakerButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.peopleHandler == null)
            {
                this.peopleHandler = new PageActionHandler<PeopleAssociationData>();

                this.peopleHandler.AfterAdd = (i) =>
                    {
                        if (!IsSelectionMode)
                        {
                            currentEditObject.Peoples.Add(i);

                            if (this.actionType == PageActionType.Edit)
                            {
                                this.accountItemViewModel.Update(currentEditObject);
                            }
                        }
                        else
                        {
                            //...
                            //i.Tag = PictureInfo.ScheduledAccountItemsTag;
                            i.AttachedId = currentEditObject.AutoTokenId;
                            // record pictures added.
                            currentEditObject.AddPeople(i);

                            if (actionType == PageActionType.Edit)
                            {
                                ViewModelLocator.PeopleViewModel.InsertAndSubmit(i);
                            }
                        }
                    };


                this.peopleHandler.Update = (i) =>
                    {
                        if (actionType == PageActionType.Edit)
                        {
                            if (IsSelectionMode)
                            {
                                var peopleInfo = ViewModelLocator.AccountBookDataContext.PeopleAssociationDatas.FirstOrDefault(p => p.Id == i.Id);

                                if (peopleInfo != null)
                                {
                                    peopleInfo.Comments = i.Comments;

                                    ViewModelLocator.PeopleViewModel.Update<PeopleAssociationData>(peopleInfo);
                                }
                            }
                            else
                            {
                                this.accountItemViewModel.Update(currentEditObject);
                            }
                        }
                    };

                this.peopleHandler.AfterDelete = (i) =>
                    {
                        if (!IsSelectionMode)
                        {
                            currentEditObject.Peoples.Remove(i);

                            if (this.actionType == PageActionType.Edit)
                            {
                                this.accountItemViewModel.Update(currentEditObject);
                            }
                        }

                        else
                        {
                            // record pictures removed.
                            currentEditObject.RemovePeople(i);

                            if (actionType == PageActionType.Edit)
                            {
                                //...
                                ViewModelLocator.PeopleViewModel.Delete(i);
                            }
                        }
                    };

                this.peopleHandler.GetItems = () =>
                {
                    if (IsSelectionMode)
                    {
                        return currentEditObject.PeoplesOutOfDatabase;
                    }
                    else
                    {
                        return currentEditObject.Peoples;
                    }
                };

                AttachPeoplePage.PeopleSelectorHandler = this.peopleHandler;
            }

            if (IsSelectionMode)
            {
                AttachPeoplePage.Go(currentEditObject.AutoTokenId, this);
            }
            else
            {
                AttachPeoplePage.Go(currentEditObject.Id, this);
            }
        }
コード例 #10
0
        public static void GoTo(PhoneApplicationPage fromPage, string pageNextGoTo, Action<string> afterFileChosenAndBeforeGoNext)
        {
            PageActionHandler = new PageActionHandler<string>();
            PageActionHandler.AfterSelected = afterFileChosenAndBeforeGoNext;

            fromPage.NavigateTo("/Pages/DialogBox/BackupDatabaseChooser.xaml?pageNextGoTo={0}", pageNextGoTo);
        }
コード例 #11
0
 private void PeopleEditor_Click(object sender, RoutedEventArgs e)
 {
     System.Action<PeopleAssociationData> action = null;
     System.Action<PeopleAssociationData> action2 = null;
     System.Action<PeopleAssociationData> action3 = null;
     System.Func<IEnumerable<PeopleAssociationData>> func = null;
     if (this.peopleHandler == null)
     {
         this.peopleHandler = new PageActionHandler<PeopleAssociationData>();
         if (action == null)
         {
             action = delegate(PeopleAssociationData i)
             {
                 this.CurrentObject.Peoples.Add(i);
                 this.accountItemViewModel.Update(this.CurrentObject);
             };
         }
         this.peopleHandler.AfterAdd = action;
         if (action2 == null)
         {
             action2 = delegate(PeopleAssociationData i)
             {
                 this.accountItemViewModel.Update(this.CurrentObject);
             };
         }
         this.peopleHandler.Update = action2;
         if (action3 == null)
         {
             action3 = delegate(PeopleAssociationData i)
             {
                 this.CurrentObject.Peoples.Remove(i);
                 this.accountItemViewModel.Update(this.CurrentObject);
             };
         }
         this.peopleHandler.AfterDelete = action3;
         if (func == null)
         {
             func = () => this.CurrentObject.Peoples;
         }
         this.peopleHandler.GetItems = func;
         AttachPeoplePage.PeopleSelectorHandler = this.peopleHandler;
     }
     AttachPeoplePage.Go(this.CurrentObject.Id, this);
 }