Exemple #1
0
        private void save()
        {
            if (!unit.Validate())
            {
                return;
            }

            ShowBusyIndicator();

            unit.TransferId = Guid.NewGuid();
            if (actionType == ActionType.AddUnit)
            {
                unitService.AddUnit((res, exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    HideBusyIndicator();
                    if (exp != null)
                    {
                        appController.HandleException(exp);
                    }
                    else
                    {
                        FinalizeAction();
                    }
                }), unit);
            }
            else if (actionType == ActionType.ModifyUnit)
            {
                unitService.UpdateUnit((res, exp) => appController.BeginInvokeOnDispatcher(() =>
                {
                    HideBusyIndicator();
                    if (exp != null)
                    {
                        appController.HandleException(exp);
                    }
                    else
                    {
                        FinalizeAction();
                    }
                }), unit);
            }
        }