コード例 #1
0
        private void ShowOverlay(bool reminderSet)
        {
            string posButtonTxt = WizardActivity.GetString(Resource.String.add_new_prospect);
            string message      = WizardActivity.GetString(Resource.String.successful_registration_message_prospect);

            if (reminderSet)
            {
                message = WizardActivity.GetString(Resource.String.prospect_followup_reminder_set);
            }

            _registrationFinishedFragment = new RegistrationFinishedFragment();
            Bundle arguments = new Bundle();

            arguments.PutBoolean(RegistrationFinishedFragment.WasRegistrationKey, false);
            arguments.PutBoolean(RegistrationFinishedFragment.SuccessKey, true);
            arguments.PutString(RegistrationFinishedFragment.MessageKey, message);
            arguments.PutString(RegistrationFinishedFragment.BtnPositiveKey, posButtonTxt);
            arguments.PutString(RegistrationFinishedFragment.BtnNegativeKey, this.OverlayNegativeButtonText);
            arguments.PutString(RegistrationFinishedFragment.IntentStartPointKey, WizardActivity.StartPoint.ToString());
            arguments.PutInt(RegistrationFinishedFragment.TitleResKey, Resource.String.prospect_registered_title);

            _registrationFinishedFragment.Arguments = arguments;

            WizardActivity.ShowOverlay(_registrationFinishedFragment, true);
        }
コード例 #2
0
        public async Task <bool> ShowOverlayIfOffline(SalesApp.Core.BL.Models.People.Customer customer)
        {
            this._fragmentInfo = new FragmentInfo();
            this._fragmentInfo.SetArgument(FragmentInfo.ResourceIdBundleKey, Resource.Layout.fragment_choose_registration_type);

            this._fragmentInfo.ViewCreated += (sender, args) =>
            {
                ViewsHelper <Person> viewsHelper = new ViewsHelper <Person>(Activity as ActivityBase,
                                                                            _fragmentInfo.InflatedView);

                viewsHelper.BindEvent
                (
                    BindableEvents.OnClick
                    , Resource.Id.linFirstTimeProduct
                    , linFirstTimeProduct =>
                {
                    WizardActivity.HideOverlay(false);
                    IsAdditionalProduct              = false;
                    customer.IsAdditionalProduct     = IsAdditionalProduct;
                    WizardActivity.ButtonNextEnabled = true;

                    string serializedData = JsonConvert.SerializeObject(customer);
                    WizardActivity.CurrentFragment.SetData(serializedData);
                    WizardActivity.Go(true);
                });

                viewsHelper.BindEvent(
                    BindableEvents.OnClick,
                    Resource.Id.linAddProduct,
                    linAddProduct =>
                {
                    WizardActivity.HideOverlay(false);
                    IsAdditionalProduct              = true;
                    customer.IsAdditionalProduct     = IsAdditionalProduct;
                    WizardActivity.ButtonNextEnabled = true;

                    string serializedData = JsonConvert.SerializeObject(customer);
                    WizardActivity.CurrentFragment.SetData(serializedData);
                    WizardActivity.Go(true);
                });

                viewsHelper.Write(Resource.Id.tvPersonName, customer.FullName);
                viewsHelper.Write(Resource.Id.tvPhone, customer.Phone);
                viewsHelper.WriteBoundViews(customer);
            };

            WizardActivity.ShowOverlay(_fragmentInfo, false);
            return(false);
        }
コード例 #3
0
ファイル: WizardGuy.cs プロジェクト: DariusMiu/Irbis
 public void Dying()
 {
     activity         = WizardActivity.Dying;
     previousActivity = activity;
     SetAnimation(Animation.Dying, true);
 }
コード例 #4
0
ファイル: WizardGuy.cs プロジェクト: DariusMiu/Irbis
    public void Animate()
    {
        timeSinceLastFrame += Irbis.Irbis.DeltaTime;
        if (timeSinceLastFrame >= animationSpeed[currentAnimation])
        {
            if (currentAnimation == 1)
            {
                previousHands = castingHands[currentFrame];
            }

            currentFrame++;
            timeSinceLastFrame -= animationSpeed[currentAnimation];

            if (currentFrame > animationFrames[currentAnimation])
            {
                if (animationNoLoop)
                {
                    switch (currentAnimation)
                    {
                    case 2:
                        int nextTeleport = Irbis.Irbis.RandomInt(teleportPoints.Length);
                        while (previousTeleport == nextTeleport)
                        {
                            nextTeleport = Irbis.Irbis.RandomInt(teleportPoints.Length);
                        }
                        previousTeleport = nextTeleport;
                        Explode();
                        TrueCenter = teleportPoints[previousTeleport];
                        goto default;

                    case 3:     // Cast - do nothing, use ResetCast();
                        SetAnimation(Animation.Idle, false);
                        break;

                    default:
                        ResetCast();
                        break;
                    }
                }
                else
                {
                    currentFrame = 0;
                }
            }
        }

        if (previousActivity != activity)
        {
            SetAnimation();
        }

        if (previousAnimation != currentAnimation)
        {
            timeSinceLastFrame = 0;
            currentFrame       = 0;
        }

        animationSourceRect.X = 128 * currentFrame;
        animationSourceRect.Y = 128 * currentAnimation;


        if (exploding)
        {
            timeSinceLastExplosionFrame += Irbis.Irbis.DeltaTime;
            if (timeSinceLastExplosionFrame >= explosionAnimationSpeed)
            {
                timeSinceLastExplosionFrame -= explosionAnimationSpeed;
                currentExplosionFrame++;
            }
            if (currentExplosionFrame * Irbis.Irbis.explosiontex.Height >= Irbis.Irbis.explosiontex.Width)
            {
                currentExplosionFrame       = 0;
                timeSinceLastExplosionFrame = 0;
                exploding = false;
            }
            explosionSourceRect.X = currentExplosionFrame * Irbis.Irbis.explosiontex.Height;
        }


        previousAnimation = currentAnimation;
        previousActivity  = activity;
    }
コード例 #5
0
        public async Task <bool> ShowOverlayIfPhoneNumberDuplicate(string phone, string nationalId = null)
        {
            ErrorFilterFlags flag = ErrorFilterFlags.DisableErrorHandling;
            Person           person;

            SalesApp.Core.BL.Models.People.Customer customer = await new CustomersController().GetPersonIfExists(phone, nationalId, filterFlags: flag, checkDuplicate: false);
            SalesApp.Core.BL.Models.People.Prospect prospect = null;

            if (customer == null)
            {
                prospect = await new ProspectsController().GetPersonIfExists(phone, filterFlags: flag, checkDuplicate: false);
                person   = JsonConvert.DeserializeObject <Person>(JsonConvert.SerializeObject(prospect));
            }
            else
            {
                if (customer.PersonType == PersonTypeEnum.Prospect)
                {
                    prospect =
                        JsonConvert.DeserializeObject <SalesApp.Core.BL.Models.People.Prospect>(
                            JsonConvert.SerializeObject(customer));
                }
                else
                {
                    string         urlParam       = customer.Phone + "&foradditionalproduct=true";
                    CustomerStatus customerStatus = await new CustomerStatusApi().GetAsync(urlParam);

                    if (customerStatus != null)
                    {
                        customer.AccountStatus = customerStatus.AccountStatus;
                    }
                }

                person = JsonConvert.DeserializeObject <Person>(JsonConvert.SerializeObject(customer));
            }

            if (person == null)
            {
                return(false);
            }

            this._fragmentInfo = new FragmentInfo();
            this._fragmentInfo.SetArgument(FragmentInfo.ResourceIdBundleKey, Resource.Layout.fragment_unified_existing_person);

            this._fragmentInfo.ViewCreated += (sender, args) =>
            {
                ViewsHelper <Person> viewsHelper = new ViewsHelper <Person>(Activity as ActivityBase,
                                                                            _fragmentInfo.InflatedView);

                viewsHelper.BindEvent
                (
                    BindableEvents.OnClick
                    , Resource.Id.linEditCustomer
                    , linEditCustomer =>
                {
                    WizardActivity.HideOverlay(true);
                });

                viewsHelper.BindEvent(
                    BindableEvents.OnClick,
                    Resource.Id.linAddProduct,
                    linAddProduct =>
                {
                    // if doing prospect registration, do conversion to customer
                    if (WizardActivity.WizardType == WizardTypes.ProspectRegistration)
                    {
                        // do conversion to customer
                        if (person.PersonType == PersonTypeEnum.Prospect)
                        {
                            ProspectSearchResult psr = JsonConvert.DeserializeObject <ProspectSearchResult>(JsonConvert.SerializeObject(prospect));
                            Dictionary <string, object> bundledItems = new Dictionary <string, object>();
                            bundledItems.Add(KeyProspectIdBundled, psr);

                            WizardLauncher.Launch(Activity, WizardTypes.CustomerRegistration, WizardActivity.StartPoint, bundledItems);
                        }
                        else
                        {
                            // posible additional product
                            if (customer != null)
                            {
                                WizardActivity.HideOverlay(true);
                                IsAdditionalProduct = true;
                                WizardActivity.IsProspectConversion      = true;
                                CustomerSearchResult csr                 = JsonConvert.DeserializeObject <CustomerSearchResult>(JsonConvert.SerializeObject(customer));
                                Dictionary <string, object> bundledItems = new Dictionary <string, object>();
                                bundledItems.Add(KeyCustomerIdBundled, csr);

                                WizardLauncher.Launch(Activity, WizardTypes.CustomerRegistration, WizardActivity.StartPoint, bundledItems);
                            }
                        }
                    }
                    else
                    {
                        // customer registration
                        if (person.PersonType == PersonTypeEnum.Prospect)
                        {
                            // auto fill the details
                            FillFromExistingRecord(prospect);
                            WizardActivity.IsProspectConversion = true;
                        }
                        else
                        {
                            // auto fill the details
                            FillFromExistingRecord(customer);
                        }

                        WizardActivity.HideOverlay(true);
                        IsAdditionalProduct = true; // though this may be cheating ;)
                        WizardActivity.GoNext();
                    }
                });

                viewsHelper.Write(Resource.Id.tvPersonName, person.FullName);
                viewsHelper.Write(Resource.Id.tvPhone, person.Phone);
                viewsHelper.WriteBoundViews(customer);

                if (customer != null && customer.AccountStatus != null && !customer.AccountStatus.Equals("Active"))
                {
                    ShowConversionButton(_fragmentInfo.InflatedView, ViewStates.Gone);
                    ShowPersonStatus(_fragmentInfo.InflatedView);
                }

                if (person.PersonType == PersonTypeEnum.Prospect)
                {
                    // show conversion button
                    ShowConversionButton(_fragmentInfo.InflatedView, ViewStates.Visible);
                }
            };

            WizardActivity.ShowOverlay(_fragmentInfo, false);
            return(true);
        }