public EditExpenseOrIncomeSchedule()
 {
     this.InitializeComponent();
     this.manager = new SecondSchedulePlanningManager(ViewModelLocator.AccountBookDataContext);
     TiltEffect.SetIsTiltEnabled(this, true);
     base.ApplicationBar.GetIconButtonFrom(0).Text = AppResources.Save;
     base.ApplicationBar.GetIconButtonFrom(1).Text = AppResources.Cancel;
     this.SetExampleName();
     this.scheduleManagerViewModel = ViewModelLocator.ScheduleManagerViewModel;
     this.scheduleDataInfo = new TallySchedule();
     this.manager = this.scheduleManagerViewModel.ScheduleManager;
     this.InitializedFrequencySelector();
     base.DataContext = this.scheduleManagerViewModel;
     this.taskType = RecordActionType.CreateTranscationRecord;
     this.Loaded += EditExpenseOrIncomeSchedule_Loaded;
 }
        public static SchedulePlanningHandler CreatePlanningHandler(RecordActionType recordType, TinyMoneyDataContext db)
        {
            SchedulePlanningHandler handler = null;
            switch (recordType)
            {
                case RecordActionType.CrateExpenseRecord:
                case RecordActionType.CreateIncomeRecord:
                    return new ExpenseOrIncomeScheduleHanlder(db);

                case RecordActionType.CreateTransferingRecord:
                    return new TransferingItemTaskHandler(db);
                case RecordActionType.CreateBorrowRecord:
                case RecordActionType.CreateLeanRecord:
                    return handler;
            }
            return handler;
        }
        void EditExpenseOrIncomeSchedule_Loaded(object sender, RoutedEventArgs e)
        {
            if (!this.hasInitializedBinding)
            {
                this.action = this.GetNavigatingParameter("action", null);
                this.InitializedApplicationBar();
                if (ViewModelLocator.AccountViewModel.Accounts.Count == 0)
                {
                    ViewModelLocator.AccountViewModel.QuickLoadData();
                }

                hasInitializedBinding = true;

                if (this.action == "edit")
                {
                    System.Guid id = this.GetNavigatingParameter("id", null).ToGuid();
                    this.scheduleDataInfo = this.scheduleManagerViewModel.Tasks.FirstOrDefault<TallySchedule>(p => p.Id == id);
                    this.scheduleManagerViewModel.Current = this.scheduleDataInfo;

                    this.taskType = this.scheduleDataInfo.ActionHandlerType;

                    if (this.taskType == RecordActionType.CreateTranscationRecord)
                    {
                        this.associatedAccountItem = this.scheduleManagerViewModel.ReBuildAccountItem(this.scheduleDataInfo);

                        if (this.associatedAccountItem != null)
                        {
                            this.associatedAccountItem.PropertyChanged += associatedAccountItem_PropertyChanged;
                        }
                    }
                    else
                    {
                        this.assoicatedTransferingItem = this.scheduleManagerViewModel.ReBuildTransferingItem(this.scheduleDataInfo);
                    }

                    this.BindingDataToEdit();
                }
                else
                {
                    this.scheduleDataInfo = new TallySchedule();
                }
            }
        }
        /// <summary>
        /// Gets the handler.
        /// </summary>
        /// <param name="recordActionType">Type of the record action.</param>
        /// <returns></returns>
        protected virtual SchedulePlanningHandler GetHandler(RecordActionType recordActionType)
        {
            SchedulePlanningHandler handler = null;
            this.ScheduleHanlderCache.TryGetValue(recordActionType, out handler);
            if (handler == null)
            {
                handler = SchedulePlanningHandler.CreatePlanningHandler(recordActionType, this.dataContext);
                this.ScheduleHanlderCache[recordActionType] = handler;
            }

            if (handler.HandlerDataParsed == null)
            {
                handler.HandlerDataParsed = this.HandlerDataParsed;
            }

            return handler;
        }
        private void ItemSelector_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count > 0)
            {
                var indexOfSelectedItem = ItemSelector.SelectedIndex;

                if (indexOfSelectedItem == 0)
                {
                    this.taskType = RecordActionType.CreateTranscationRecord;
                }
                else
                {
                    this.taskType = RecordActionType.CreateTransferingRecord;
                }
            }
        }
Exemple #6
0
 protected RecordAction(RecordActionType type)
 {
     this.type = type;
 }
		protected RecordAction ( RecordActionType type )
		{ this.type = type; }