예제 #1
0
        public async void retrieveMemeList()
        {
            indicator.IsRunning = true;

            List <MemeCaptions> captionsList = await AzureManager.AzureManagerInstance.GetCaptionList();

            foreach (MemeCaptions meme in captionsList)
            {
                meme.computeFullCaption();
            }
            model                   = new MemeListViewModel(captionsList);
            BindingContext          = model;
            addMemeButton.IsEnabled = true;

            indicator.IsRunning       = false;
            memeList.IsVisible        = true;
            indicatorLayout.IsVisible = false;
        }
예제 #2
0
        public MemeEdit(MemeCaptions meme, bool isAdd, MemeListViewModel memeList)
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);
            IsAdd    = isAdd;
            MemeList = memeList;

            if (isAdd)
            {
                // this is work around for slider bug in Xamarin, valueChanged not firing on first time tap
                neutralSlider.Value   = 0.01;
                happinessSlider.Value = 0.01;
                sadnessSlider.Value   = 0.01;
                angerSlider.Value     = 0.01;
                fearSlider.Value      = 0.01;
                contemptSlider.Value  = 0.01;
                disgustSlider.Value   = 0.01;
                surpriseSlider.Value  = 0.01;
            }
            else
            {
                CurrentlyEditingMeme = meme;

                lowerCaptionEditor.Text = meme.LowerCaption;
                upperCaptionEditor.Text = meme.UpperCaption;

                neutralSlider.Value   = meme.NeutralVal;
                happinessSlider.Value = meme.HappinessVal;
                sadnessSlider.Value   = meme.SadnessVal;
                angerSlider.Value     = meme.AngerVal;
                fearSlider.Value      = meme.FearVal;
                contemptSlider.Value  = meme.ContemptVal;
                disgustSlider.Value   = meme.DisgustVal;
                surpriseSlider.Value  = meme.SurpriseVal;

                // this is work around for slider bug in Xamarin, valueChanged not firing on first time tap
                if (neutralSlider.Value == 0)
                {
                    neutralSlider.Value = 0.01;
                }
                if (happinessSlider.Value == 0)
                {
                    happinessSlider.Value = 0.01;
                }
                if (sadnessSlider.Value == 0)
                {
                    sadnessSlider.Value = 0.01;
                }
                if (angerSlider.Value == 0)
                {
                    angerSlider.Value = 0.01;
                }
                if (fearSlider.Value == 0)
                {
                    fearSlider.Value = 0.01;
                }
                if (contemptSlider.Value == 0)
                {
                    contemptSlider.Value = 0.01;
                }
                if (disgustSlider.Value == 0)
                {
                    disgustSlider.Value = 0.01;
                }
                if (surpriseSlider.Value == 0)
                {
                    surpriseSlider.Value = 0.01;
                }

                deleteButton.IsEnabled = true;
            }
        }