public bool ExistAccount(PageActionType action, Account accountToCompare) { if (action == PageActionType.Add) { return (this.Accounts.Count<Account>(p => (p.Name == accountToCompare.Name)) > 0); } return (this.Accounts.Count<Account>(p => ((p.Name == accountToCompare.Name) && (p.Id != accountToCompare.Id))) > 0); }
public NewOrEditAccountItemPage() { System.Action<IApplicationBar> ifTrue = null; System.Action<IApplicationBar> ifFalse = null; this.accountItemViewModel = ViewModelLocator.AccountItemViewModel; this.actionType = PageActionType.Add; this.totalDaysOfThisMonth = 30; this.InitializeComponent(); base.ApplicationBar.Opacity = 1.0; TiltEffect.SetIsTiltEnabled(this, true); this.categoryViewModel = ViewModelLocator.CategoryViewModel; base.Loaded += new RoutedEventHandler(this.NewOrEditAccountItemPage_Loaded); this.goToPriceInputBoxButton = new ApplicationBarIconButton(IconUirs.CalcutorIconButton); this.goToPriceInputBoxButton.Text = AppResources.Calcutor; this.goToPriceInputBoxButton.Click += new System.EventHandler(this.goToPriceInputBoxButton_Click); this.editingApplicationBarManager = new ApplicationBarHelper(this); this.editingApplicationBarManager.SelectContentWhenFocus = true; this.editingApplicationBarManager.AddTextBox(new TextBox[] { this.TotalMoneyBox, this.DescriptionTextBox }); if (ifTrue == null) { ifTrue = delegate(IApplicationBar p) { p.Buttons.Add(this.goToPriceInputBoxButton); }; } if (ifFalse == null) { ifFalse = delegate(IApplicationBar p) { p.Buttons.Remove(this.goToPriceInputBoxButton); }; } this.editingApplicationBarManager.If(p => p.Name == "TotalMoneyBox", ifTrue, ifFalse); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.NavigationMode != NavigationMode.Back) { this.pageAction = this.GetNavigatingParameter("pageAction", null).ToEnum<PageActionType>(PageActionType.Add); this.CategoryClassType = this.GetNavigatingParameter("CategoryClassType", null).ToEnum<ItemType>(ItemType.Expense); string source = e.GetNavigatingParameter("id", null); if (this.pageAction == PageActionType.Edit) { this.LoadEditingObject(source.ToGuid()); } else { this.LoadAddingObject(source.ToGuid()); } } }
public override void OnBeginPageAction(int actionID, int?actionIndentation, PageActionType actionType) => InvokeCBreezeParser.OnBeginPageAction?.Invoke(actionID, actionIndentation, actionType);
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.NavigationMode != NavigationMode.Back) { string id = e.GetNavigatingParameter("id", null); this.pageAction = e.GetNavigatingParameter("action", null).ToEnum<PageActionType>(); if (this.pageAction == PageActionType.Add) { this.Current = new Account(); this.CategoryManagementPageTitle.Text = LocalizedStrings.GetCombinedText(AppResources.Create, AppResources.AccountName, false).ToUpperInvariant(); } else { this.Current = this.accountViewModel.Accounts.FirstOrDefault<Account>(p => p.Id == id.ToGuid()); this.CategoryManagementPageTitle.Text = LocalizedStrings.GetCombinedText(AppResources.Edit, AppResources.AccountInfo, false).ToUpperInvariant(); this.LoadEditing(); } this.DataContext = this; } }
protected override void OnNavigatedTo(NavigationEventArgs e) { this.EnsureEnablePinToStart(); MainPage.ShowOpactityZeroTrayBlack(); base.OnNavigatedTo(e); if (!this.isDataNavigated) { this.totalDaysOfThisMonth = System.DateTime.Now.GetCountDaysOfMonth(); this.SetControlLocalizedString(); this.AccountName.ItemsSource = ViewModelLocator.AccountViewModel.Accounts; if (base.NavigationContext.QueryString.ContainsKey("action")) { string str = base.NavigationContext.QueryString["action"]; if (!ViewModelLocator.AccountViewModel.IsDataLoaded) { ViewModelLocator.AccountViewModel.QuickLoadData(); } if (!this.hasNavied) { if ((str == "Edit") || (IsSelectionMode && (accountItemForSchedule != null))) { this.actionType = PageActionType.Edit; this.CategoryType.BorderThickness = new Thickness(0.0, 0.0, 0.0, 0.0); this.initializeEditingMode(); base.DataContext = currentEditObject; } else { if (base.NavigationContext.QueryString.ContainsKey("categoryType")) { int num = int.Parse(base.NavigationContext.QueryString["categoryType"]); this.CategoryType.SelectedIndex = num; } this.actionType = PageActionType.Add; if (str != "preEdit") { currentEditObject = new AccountItem(); } base.DataContext = currentEditObject; this.InitializeAddData(); if (str == "preEdit") { this.BindData(currentEditObject); } } if (str == "selection") { string source = e.GetNavigatingParameter("title", null); this.NewOrEditPage.Text = source.IsNullOrEmpty() ? AppResources.CreateAccountItemForSchedule.ToUpperInvariant() : source; } this.SetControls(); this.hasNavied = true; } } this.isFromList = this.GetNavigatingParameter("isFromList", null).ToBoolean(false); this.fromMainPage = this.GetNavigatingParameter("FromMainPlus", null).ToBoolean(false); if (this.FromStartScreen) { ApplicationBarMenuItem item = new ApplicationBarMenuItem { Text = LocalizedStrings.GetLanguageInfoByKey("GoToMainPage") }; this.toMainPageButton = item; this.toMainPageButton.Click += new System.EventHandler(this.toMainPageButton_Click); base.ApplicationBar.MenuItems.Add(this.toMainPageButton); } } }
public static void NavigateTo(PhoneApplicationPage fromPage, TallySchedule template, PageActionType pageAction) { EditingItemGetter = () => template; fromPage.NavigateTo("/Pages/CustomizedTally/CustomizedTallyItemEditorPage.xaml?action={0}", new object[] { pageAction }); }
public static void Go(PhoneApplicationPage fromPage, Guid id, PageActionType action) { fromPage.NavigateTo("/Pages/NotificationCenter/NotificationEditor.xaml?id={0}&action={1}", id, action); }
/// <summary> /// Called when a page becomes the active page in a frame. /// </summary> /// <param name="e">An object that contains the event data.</param> protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.NavigationMode != System.Windows.Navigation.NavigationMode.Back) { if (!ViewModelLocator.AccountViewModel.IsDataLoaded) { ViewModelLocator.AccountViewModel.QuickLoadData(); } var action = this.GetNavigatingParameter("action", PageActionType.Add); actionMode = (PageActionType)(Enum.Parse(typeof(PageActionType), action, true)); Repayment editObject = GetEditObject == null ? null : GetEditObject(); var actionForTitle = string.Empty; if (actionMode == PageActionType.Add) { actionForTitle = AppResources.Add; deleteButton.IsEnabled = false; } else { actionForTitle = AppResources.Edit; oldAmountValue = editObject.Amount; } repayOrReceieveEditor.CurrentObject = editObject; var actionName = editObject.BorrowLoanTypeName; PageTitle.Text = "{0} {1}".FormatWith(actionForTitle, actionName) .ToUpperInvariant(); scheduledRepayOrReceiveButton.Text = AppResources.ScheduledRepayOrReceive.FormatWith(actionName); this.ContentPanel.Children.Add(repayOrReceieveEditor); } }
public NewOrEditAccountItemPage() { this.accountItemViewModel = ViewModelLocator.AccountItemViewModel; this.actionType = PageActionType.Add; this.totalDaysOfThisMonth = 30; this.InitializeComponent(); base.ApplicationBar.Opacity = 1.0; TiltEffect.SetIsTiltEnabled(this, true); this.categoryViewModel = ViewModelLocator.CategoryViewModel; base.Loaded += new RoutedEventHandler(this.NewOrEditAccountItemPage_Loaded); this.goToPriceInputBoxButton = new ApplicationBarIconButton(IconUirs.CalcutorIconButton); this.goToPriceInputBoxButton.Text = AppResources.Calcutor; this.goToPriceInputBoxButton.Click += new System.EventHandler(this.goToPriceInputBoxButton_Click); this.editingApplicationBarManager = new ApplicationBarHelper(this); this.editingApplicationBarManager.SelectContentWhenFocus = true; this.editingApplicationBarManager.AddTextBox(new TextBox[] { this.TotalMoneyBox, this.DescriptionTextBox }); ViewModelLocator.AccountViewModel.DisableControl = () => { this.ApplicationBar.IsMenuEnabled = false; if (saveAndContinue != null) { this.saveAndContinue.IsEnabled = false; } if (SaveAndStay != null) { this.SaveAndStay.IsEnabled = false; } if (SaveAndClose != null) { this.SaveAndClose.IsEnabled = false; } }; AccountName.SelectionChanged += AccountName_SelectionChanged; this.editingApplicationBarManager.If(p => p.Name == "TotalMoneyBox", p => { goToPriceInputBoxButton.Click -= goToBuildAmountBoxButton_Click; goToPriceInputBoxButton.Click += goToPriceInputBoxButton_Click; p.Buttons.Add(this.goToPriceInputBoxButton); }, p => { goToPriceInputBoxButton.Click -= goToPriceInputBoxButton_Click; p.Buttons.Remove(this.goToPriceInputBoxButton); }) .If(p => p.Name == DescriptionTextBox.Name, p => { goToPriceInputBoxButton.Click -= goToPriceInputBoxButton_Click; goToPriceInputBoxButton.Click += goToBuildAmountBoxButton_Click; p.Buttons.Add(this.goToPriceInputBoxButton); }, p => { goToPriceInputBoxButton.Click -= goToBuildAmountBoxButton_Click; p.Buttons.Remove(this.goToPriceInputBoxButton); }); }
protected override void OnNavigatedTo(NavigationEventArgs e) { if (e.NavigationMode != NavigationMode.Back) { this._id = e.GetNavigatingParameter("id").ToGuid(); this._action = e.GetNavigatingParameter("action").ToEnum<PageActionType>(); System.Threading.ThreadPool.QueueUserWorkItem((o) => { if (_action == PageActionType.Edit) { var item = ViewModelLocator.NotificationsViewModel.Notifications.FirstOrDefault(p => p.Id == _id); if (item != null) { Current = item; } } this.Dispatcher.BeginInvoke(() => { if (_action == PageActionType.Add) { Current = new TallySchedule(); Current.StartTime = DateTime.Now.AddSeconds(20); Current.EndTime = DateTime.Now.AddYears(1); } else { this.EnableAlarmNotification.IsEnabled = false; this.PageTitle.Text = AppResources.Edit.ToLower(); } this.DataContext = Current; }); }); } base.OnNavigatedTo(e); }
private void NewOrEditAccountItemPage_Loaded(object sender, RoutedEventArgs e) { if (!this.isDataNavigated) { if (!ViewModelLocator.AccountViewModel.IsDataLoaded) { ViewModelLocator.AccountViewModel.QuickLoadData(); } this.totalDaysOfThisMonth = System.DateTime.Now.GetCountDaysOfMonth(); this.SetControlLocalizedString(); this.AccountName.ItemsSource = ViewModelLocator.AccountViewModel.Accounts; if (base.NavigationContext.QueryString.ContainsKey("action")) { string str = base.NavigationContext.QueryString["action"]; if (!this.hasNavied) { if ((str == "Edit") || (IsSelectionMode && (accountItemForSchedule != null))) { this.actionType = PageActionType.Edit; //this.CategoryType.BorderThickness = new Thickness(0.0, 0.0, 0.0, 0.0); this.initializeEditingMode(); this.DataContext = currentEditObject; } else { var defaultAccount = ViewModelLocator.AccountViewModel.DefaultAccountForEditing; if (this._specifiedAccountId != Guid.Empty) { defaultAccount = ViewModelLocator.AccountViewModel.Accounts.FirstOrDefault(p => p.Id == _specifiedAccountId); } if (defaultAccount == null) { defaultAccount = ViewModelLocator.AccountViewModel.Accounts.FirstOrDefault(); } if (defaultAccount != null) { this.AccountName.SelectedItem = defaultAccount; } if (base.NavigationContext.QueryString.ContainsKey("categoryType")) { int num = int.Parse(base.NavigationContext.QueryString["categoryType"]); this.CategoryType.SelectedIndex = num; } this.actionType = PageActionType.Add; if (str != "preEdit") { currentEditObject = new AccountItem(); } base.DataContext = currentEditObject; this.InitializeAddData(); if (str == "preEdit") { this.BindData(currentEditObject); } } if (str == "selection") { string source = this.GetNavigatingParameter("title", null); this.NewOrEditPage.Text = source.IsNullOrEmpty() ? AppResources.CreateAccountItemForSchedule.ToUpperInvariant() : source; } this.SetControls(); this.hasNavied = true; } } this.isFromList = this.GetNavigatingParameter("isFromList", null).ToBoolean(false); this.fromMainPage = this.GetNavigatingParameter("FromMainPlus", null).ToBoolean(false); if (this.FromStartScreen) { ApplicationBarMenuItem item = new ApplicationBarMenuItem { Text = LocalizedStrings.GetLanguageInfoByKey("GoToMainPage") }; this.toMainPageButton = item; this.toMainPageButton.Click += new System.EventHandler(this.toMainPageButton_Click); base.ApplicationBar.MenuItems.Add(this.toMainPageButton); } } if (!this.hasLoaded) { if (this.hasLoaded) { this.hasLoaded = true; } else { bool fromStartScreen = this.FromStartScreen; if (!this.isDataNavigated) { this.CategoryType.SelectionChanged += new SelectionChangedEventHandler(this.CategoryType_SelectionChanged); this.isDataNavigated = true; } this.hasLoaded = true; } } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedTo(e); PageAction = (PageActionType)this.GetNavigatingParameter("action").ToInt32(); if (e.NavigationMode == System.Windows.Navigation.NavigationMode.Back) { Binding b = new Binding("Name"); b.Source = budgetProjectInfoViewModel.CurrentEditOrViewProject; NameBlock.SetBinding(TextBlock.TextProperty, b); Binding bNotes = new Binding("Notes"); bNotes.Source = budgetProjectInfoViewModel.CurrentEditOrViewProject; NotesBlock.SetBinding(TextBlock.TextProperty, bNotes); Binding bAmountInfo = new Binding("AmountInfo"); bAmountInfo.Source = budgetProjectInfoViewModel.CurrentEditOrViewProject; AmountInfoTextBlock.SetBinding(TextBlock.TextProperty, bAmountInfo); InitializeText(); return; } InitializeText(); InitializeApplicationBar(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.NavigationMode != NavigationMode.Back) { this.pageAction = e.GetNavigatingParameter("action", null).ToEnum<PageActionType>(); if (this.pageAction == PageActionType.Add) { this.DataEditing = new TallySchedule(); } else if (EditingItemGetter != null) { this.DataEditing = EditingItemGetter(); this.associatedAccountItem = this.DataEditing.ReBuildAccountItem(); this.BindingDataToEdit(); } this.title = LocalizedStrings.GetCombinedText((this.pageAction == PageActionType.Add) ? AppResources.Create : AppResources.Edit, AppResources.TallyTemplate, false).ToLowerInvariant(); this.PageTitle.Text = this.title; } }
public static void Go(PhoneApplicationPage fromPage, Category category, ItemType categoryType, PageActionType pageAction = PageActionType.Add) { System.Guid guid = (category == null) ? System.Guid.Empty : category.Id; fromPage.NavigateTo("/Pages/CategoryManager/CategoryInfoEditor.xaml?id={0}&pageAction={1}&CategoryClassType={2}", new object[] { guid, pageAction, categoryType }); }
/// <summary> /// Goes the specified repayment. /// </summary> /// <param name="repayment">The repayment.</param> public static void Go(Repayment repayment, PhoneApplicationPage pageFrom, PageActionType action) { var warpped = repayment; if (action == PageActionType.Add) { warpped = ViewModelLocator.BorrowLeanViewModel.CreateRepayOrReceieveEntry(repayment); warpped.RepayToOrGetBackFrom = repayment; } GetEditObject = () => warpped; pageFrom.NavigateTo("/Pages/BorrowAndLean/RepayOrReceiveEditorPage.xaml?action={0}", action); }
public void OnBeginPageAction(int actionID, int?actionIndentation, PageActionType actionType) { }
public void AddOrRemoveFavouriteItem(PageActionType addOrRemove, Category category) { if (addOrRemove == PageActionType.Delete) this.Items.Remove(category); if (addOrRemove == PageActionType.Add) this.Items.Add(category); }