private async void InvalidatePlaceholderPosition(bool withAnimation)
 {
     if (string.IsNullOrEmpty(Text) && EntryView.IsFocused == false)
     {
         if (PlaceholderView.Y != 0)
         {
             PlaceholderView.FontSize = 16;
             if (withAnimation)
             {
                 await ViewExtensions.TranslateTo(PlaceholderView, 0, 0, 250U, Easing.CubicOut);
             }
             else
             {
                 PlaceholderView.TranslationY = 0;
             }
         }
     }
     else
     {
         PlaceholderView.FontSize = 10;
         if (PlaceholderView.Y != -20)
         {
             if (withAnimation)
             {
                 await ViewExtensions.TranslateTo(PlaceholderView, 0, -20, 250U, Easing.CubicOut);
             }
             else
             {
                 PlaceholderView.TranslationY = -20;
             }
         }
     }
 }
Esempio n. 2
0
        public void StartProgressToAnimation()
        {
            ViewExtensions.CancelAnimations(this);
            var length = base.GetValue(AnimationLengthProperty);

            ProgressTo(AnimatedProgress, AnimationLength, AnimationEasing);
        }
Esempio n. 3
0
        public async Task When_VisualState_Setter_Value()
        {
            var page = new ThemeResource_When_VisualState_Setter_Value_Page();
            var app  = UnitTestsApp.App.EnsureApplication();

            app.HostView.Children.Add(page);

            var tb = ViewExtensions.FindFirstChild <TextBlock>(page.SubjectToggleButton);

            AssertEx.AssertHasColor(tb.Foreground, Colors.Black);
            Assert.AreEqual(DependencyPropertyValuePrecedences.Animations, tb.GetCurrentHighestValuePrecedence(TextBlock.ForegroundProperty));

            await SwapSystemTheme();

            AssertEx.AssertHasColor(tb.Foreground, Colors.White);
            Assert.AreEqual(DependencyPropertyValuePrecedences.Animations, tb.GetCurrentHighestValuePrecedence(TextBlock.ForegroundProperty));


            await SwapSystemTheme();

            AssertEx.AssertHasColor(tb.Foreground, Colors.Black);
            Assert.AreEqual(DependencyPropertyValuePrecedences.Animations, tb.GetCurrentHighestValuePrecedence(TextBlock.ForegroundProperty));

            await SwapSystemTheme();

            AssertEx.AssertHasColor(tb.Foreground, Colors.White);
            Assert.AreEqual(DependencyPropertyValuePrecedences.Animations, tb.GetCurrentHighestValuePrecedence(TextBlock.ForegroundProperty));


            await SwapSystemTheme();

            AssertEx.AssertHasColor(tb.Foreground, Colors.Black);
            Assert.AreEqual(DependencyPropertyValuePrecedences.Animations, tb.GetCurrentHighestValuePrecedence(TextBlock.ForegroundProperty));
        }
Esempio n. 4
0
        private async void AppLaunchStatusChanged(AppLaunchStatus status)
        {
            Color fromColor;

            switch (status)
            {
            default:
            case AppLaunchStatus.None:
                fromColor = Color.White;
                break;

            case AppLaunchStatus.CommandSent:
                fromColor = Color.Yellow;
                break;

            case AppLaunchStatus.Failed:
                fromColor = Color.Red;
                break;

            case AppLaunchStatus.Succeeded:
                fromColor = Color.Green;
                break;
            }

            ViewExtensions.CancelAnimations(this.AppLaunchFrame);
            await ColorAnimation.ColorTo(this.AppLaunchFrame, fromColor, Color.White, (color) => this.AppLaunchFrame.BackgroundColor = color, 500);
        }
        public void TestReadAggregatorWithOneMaster()
        {
            ActODataService(args =>
            {
                var author = new Автор {
                    Имя = "TestAuthor"
                };
                var magazine = new Журнал {
                    Название = "TestMagazine", Номер = 30, Автор2 = author
                };
                var book = new Книга {
                    Название = "TestBook", Автор1 = author
                };
                var library = new Библиотека {
                    Адрес = "TestStreet"
                };

                var dMagazines = new DetailArrayOfЖурнал(library);
                dMagazines.Add(magazine);

                var dBooks = new DetailArrayOfКнига(library);
                dBooks.Add(book);

                library.Книга  = dBooks;
                library.Журнал = dMagazines;

                var objs = new DataObject[]
                {
                    library, author,
                    magazine, book
                };
                args.DataService.UpdateObjects(ref objs);

                var view       = Библиотека.Views.Eview;
                string viewUrl = ViewExtensions.ToODataQuery(view);

                string requestUrl = string.Format("http://localhost/odata/{0}?{1}", args.Token.Model.GetEdmEntitySet(typeof(Библиотека)).Name, viewUrl);

                using (HttpResponseMessage response = args.HttpClient.GetAsync(requestUrl).Result)
                {
                    Assert.Equal(HttpStatusCode.OK, response.StatusCode);

                    string receivedStr = response.Content.ReadAsStringAsync().Result.Beautify();
                    Dictionary <string, object> receivedDict =
                        new JavaScriptSerializer().Deserialize <Dictionary <string, object> >(receivedStr);
                    Assert.Equal(1, ((ArrayList)receivedDict["value"]).Count);

                    var value          = ((ArrayList)receivedDict["value"])[0];
                    var журнал         = ((ArrayList)((Dictionary <string, object>)value)["Журнал"])[0];
                    var авторЖурнала   = ((Dictionary <string, object>)журнал)["Автор2"];
                    var авторЖурналаPK = (string)((Dictionary <string, object>)авторЖурнала)["__PrimaryKey"];

                    var книга        = ((ArrayList)((Dictionary <string, object>)value)["Книга"])[0];
                    var авторКниги   = ((Dictionary <string, object>)книга)["Автор1"];
                    var авторКнигиPK = (string)((Dictionary <string, object>)авторКниги)["__PrimaryKey"];

                    Assert.Equal(авторЖурналаPK, авторКнигиPK);
                }
            });
        }
        async public Task Hide()
        {
            ViewExtensions.CancelAnimations(borderDetail);
            await borderDetail.ScaleTo(0, 100, Easing.CubicOut);

            IsVisible = false;
        }
Esempio n. 7
0
        void DisplayFadedContainer()
        {
            ViewExtensions.CancelAnimations(clickContainer);
            ViewExtensions.CancelAnimations(progressBar);
            ViewExtensions.CancelAnimations(playButton);

            ViewModel.UpdateButtonSource();

            Device.BeginInvokeOnMainThread(async() =>
            {
                {
                    progressBar.Opacity = 1;
                    playButton.Opacity  = 1;

                    if (CrossMediaManager.Current.VideoPlayer.Status != MediaPlayerStatus.Playing)
                    {
                        clickContainer.Opacity         = 0;
                        clickContainer.BackgroundColor = Color.Black;
                    }

                    await Task.WhenAll(
                        playButton.FadeTo(1, fadeDuration),
                        progressBar.FadeTo(1, fadeDuration),
                        clickContainer.FadeTo(fadedOpacity, fadeDuration));
                }
            });
        }
Esempio n. 8
0
        private async void RefreshConnectionStatus()
        {
            void UpdateConnectionString(string text, Color color) => Device.InvokeOnMainThreadAsync(() => { LblConnectionStatus.Text = text; LblConnectionStatus.TextColor = color; });

            _ = Task.Run(() => ViewExtensions.RelRotateTo(ImgRefreshConnection, 2800, 10000));

            UpdateConnectionString("Připojování...", Color.Gray);

            await Task.Run(() =>
            {
                switch (BluetoothController.ConnectToRPi())
                {
                case ConnectionState.BluetoothOFF:
                    UpdateConnectionString("Bluetooth je vypnuto!", Color.Gray);
                    break;

                case ConnectionState.Failed:
                    UpdateConnectionString("Připojení s RPi selhalo.", Color.Red);
                    break;

                case ConnectionState.Connected:
                    UpdateConnectionString("Připojení s RPi navázano.", Color.Green);
                    break;
                }
            });

            ViewExtensions.CancelAnimations(ImgRefreshConnection);
        }
Esempio n. 9
0
        private static async Task ToggleVisibility(SimpleFilePicker filePicker)
        {
            try
            {
                ViewExtensions.CancelAnimations(filePicker);

                await ToggleVisibilityAnimationSemaphoreSlim.WaitAsync();

                if (filePicker.IsOpen)
                {
                    filePicker.IsVisible = true;
                    await filePicker.FadeTo(FullyOpaque, TogglingVisibilityAnimationDuration, Easing.CubicInOut);
                }
                else
                {
                    await filePicker.FadeTo(FullyTransparent, TogglingVisibilityAnimationDuration, Easing.CubicInOut);

                    filePicker.IsVisible = false;
                }
            }
            finally
            {
                ToggleVisibilityAnimationSemaphoreSlim.Release();
            }
        }
Esempio n. 10
0
 private void CancelAllAnimations()
 {
     foreach (var a in this.Layout.Children)
     {
         ViewExtensions.CancelAnimations(a);
     }
 }
Esempio n. 11
0
        static void HandleIsLoadingChanged(BindableObject bindable, object oldValue, object newValue)
        {
            var control = (LoadingControl)bindable;

            if ((bool)newValue)
            {
                Device.BeginInvokeOnMainThread(async() =>
                {
                    if (control._stopAnimation == null)
                    {
                        control._stopAnimation = new CancellationTokenSource();
                    }
                    int index       = 0;
                    string[] suffix = { ".", "..", "..." };
                    while (control._stopAnimation != null && !control._stopAnimation.IsCancellationRequested)
                    {
                        await control._loadingIcon.RelRotateTo(360, 800, Easing.Linear);
                        control._infoLabel.Text = control.InfoText + suffix[index % 3];
                        index++;
                    }
                    ViewExtensions.CancelAnimations(control._loadingIcon);
                });
            }
            else
            {
                control._stopAnimation.Cancel();
                control._stopAnimation = null;
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Override this method to apply custom logic when the keyboard is shown/hidden
        /// </summary>
        /// <param name='visible'>
        /// If the keyboard is visible
        /// </param>
        /// <param name='keyboardHeight'>
        /// Calculated height of the keyboard (width not generally needed here)
        /// </param>
        protected virtual void OnKeyboardChanged(bool visible, nfloat keyboardHeight)
        {
            var activeView = ViewToCenterOnKeyboardShown = KeyboardGetActiveView();

            if (activeView == null)
            {
                return;
            }

            var scrollView = ViewExtensions.FindSuperviewOfType(activeView, View, KeyboardElementType) as UIScrollView;

            if (scrollView == null)
            {
                return;
            }

            if (!visible)
            {
                RestoreScrollPosition(scrollView);
            }
            else
            {
                CenterViewInScroll(activeView, scrollView, keyboardHeight);
            }
        }
Esempio n. 13
0
        public ViewResult ViewFromContentId(int id)
        {
            var result      = Umbraco.ContentQuery.TypedContent(id);
            var renderModel = ViewExtensions.CreateRenderModel(result, RouteData);

            return(View(renderModel.Content.GetTemplateAlias(), renderModel));
        }
        public void TestNotStoredMaster()
        {
            ActODataService(args =>
            {
                var library = new Библиотека {
                    Адрес = "TestStreet", __PrimaryKey = new Guid("8dcd3aa3-11c2-456d-902c-03323e1ae635")
                };
                var booksSupplier = new ПоставщикКниг {
                    Ссылка = new Guid("8dcd3aa3-11c2-456d-902c-03323e1ae635")
                };
                var objs = new DataObject[]
                {
                    library, booksSupplier
                };
                args.DataService.UpdateObjects(ref objs);

                var view       = ПоставщикКниг.Views.ViewFull;
                string viewUrl = ViewExtensions.ToODataQuery(view);

                string requestUrl = string.Format("http://localhost/odata/{0}?{1}", args.Token.Model.GetEdmEntitySet(typeof(ПоставщикКниг)).Name, viewUrl);

                using (HttpResponseMessage response = args.HttpClient.GetAsync(requestUrl).Result)
                {
                    Assert.Equal(HttpStatusCode.OK, response.StatusCode);

                    string receivedStr = response.Content.ReadAsStringAsync().Result.Beautify();
                    Dictionary <string, object> receivedDict =
                        new JavaScriptSerializer().Deserialize <Dictionary <string, object> >(receivedStr);
                    Assert.Equal(1, ((ArrayList)receivedDict["value"]).Count);
                }
            });
        }
Esempio n. 15
0
        private async Task RefreshPrinterFormatListAsync()
        {
            await Task.Factory.StartNew(() => {
                try {
                    ViewModel.PrinterFormatList.Clear();
                } catch (NotImplementedException) {
                    ViewModel.PrinterFormatList.Clear(); // Workaround for Xamarin.Forms.Platform.WPF issue: https://github.com/xamarin/Xamarin.Forms/issues/3648
                }
            });

            if (ViewModel.SelectedPrinter != null)
            {
                await Task.Factory.StartNew(() => {
                    ViewModel.IsPrinterFormatListRefreshing = true;
                });

                Device.BeginInvokeOnMainThread(async() => {
                    await AnimatePrinterFormatsRefreshIconAsync();
                });

                await AddPrinterFormatsToFormatListAsync();

                await Task.Factory.StartNew(() => {
                    ViewModel.IsPrinterFormatListRefreshing = false;
                });

                ViewExtensions.CancelAnimations(PrinterFormatsRefreshIcon);
            }
        }
Esempio n. 16
0
        private async Task RefreshStoredFormatListAsync()
        {
            await Task.Factory.StartNew(() => {
                try {
                    ViewModel.StoredFormatList.Clear();
                } catch (NotImplementedException) {
                    ViewModel.StoredFormatList.Clear(); // Workaround for Xamarin.Forms.Platform.WPF issue: https://github.com/xamarin/Xamarin.Forms/issues/3648
                }
            });

            if (ViewModel.SelectedPrinter != null)
            {
                await Task.Factory.StartNew(() => {
                    ViewModel.IsStoredFormatListRefreshing = true;
                });

                Device.BeginInvokeOnMainThread(async() => {
                    await AnimateStoredFormatsRefreshIconAsync();
                });

                await Task.Factory.StartNew(() => {
                    Thread.Sleep(1000); // Give the user some time to read the progress message to confirm that refresh is occurring
                });

                await AddStoredFormatsToFormatListAsync();

                await Task.Factory.StartNew(() => {
                    ViewModel.IsStoredFormatListRefreshing = false;
                });

                ViewExtensions.CancelAnimations(StoredFormatsRefreshIcon);
            }
        }
Esempio n. 17
0
        async void StartStopAnimation_Clicked(System.Object sender, System.EventArgs e)
        {
            if (!_isAnimating)
            {
                _isAnimating = true;
                status.Text  = "RUNNING";

                await pancake.ColorTo(Color.FromHex("#8845b8"), Color.FromHex("#c23569"), c => pancake.BackgroundGradientStartColor = c, 5000, Easing.Linear);

                await pancake.ColorTo(Color.FromHex("#f52e33"), Color.FromHex("#ff9e4f"), c => pancake.BackgroundGradientEndColor = c, 5000, Easing.Linear);

                await pancake.ColorTo(Color.FromHex("#c23569"), Color.FromHex("#8845b8"), c => pancake.BackgroundGradientStartColor = c, 5000, Easing.Linear);

                await pancake.ColorTo(Color.FromHex("#ff9e4f"), Color.FromHex("#f52e33"), c => pancake.BackgroundGradientEndColor = c, 5000, Easing.Linear);

                status.Text  = "DONE";
                _isAnimating = false;
            }
            else
            {
                _isAnimating = false;
                status.Text  = string.Empty;
                ViewExtensions.CancelAnimations(pancake);
            }
        }
Esempio n. 18
0
        internal override Task ResolveView(ResolveViewArgs resolveViewArgs)
        {
            if (resolveViewArgs.Success == true)
            {
                return(Task.CompletedTask);
            }

            var path = new[] { resolveViewArgs.Name }
            .SelectMany(pattern => ViewExtensions.Select(ext => $"{pattern}{ext}"))
            .SelectMany(pattern => SearchPaths.Select(searchPath => CombineAndRestrictPath(searchPath, pattern)))
            .Where(_ => File.Exists(_))
            .FirstOrDefault();

            if (path == null)
            {
                return(Task.CompletedTask);
            }

            if (RoutableOptions.TryGetMimeType(Path.GetExtension(path), out var mimeType) == false)
            {
                mimeType = DefaultMimeType;
            }
            resolveViewArgs.MimeType     = mimeType;
            resolveViewArgs.LastModified = File.GetLastWriteTimeUtc(path);
            resolveViewArgs.GetStream    = () => Task.FromResult <Stream>(File.OpenRead(path));
            resolveViewArgs.Success      = true;

            return(Task.CompletedTask);
        }
Esempio n. 19
0
        public InfiniteAnimation()
        {
            tapRegonizer         = new TapGestureRecognizer();
            tapRegonizer.Tapped += async(o, args) => {
                isInfinite = !isInfinite;
                RotateLabel.BackgroundColor = Color.FromHex("#dd0000");
                await Task.WhenAny(
                    RotaeElement()
                    );

                if (!isInfinite)
                {
                    ViewExtensions.CancelAnimations(RotateLabel);
                }
            };

            RotateLabel = new Label
            {
                Text = "Infinite animation",
                HorizontalTextAlignment = TextAlignment.Center,
                BackgroundColor         = Color.FromHex("#ccc"),
                GestureRecognizers      = { tapRegonizer }
            };
            Content = new FlexLayout
            {
                Direction      = FlexDirection.Column,
                JustifyContent = FlexJustify.Center,
                AlignContent   = FlexAlignContent.Center,
                Children       =
                {
                    RotateLabel
                }
            };
        }
Esempio n. 20
0
        public async Task When_VisualState_Setter_Value_Complex_Path()
        {
            var page = new ThemeResource_When_VisualState_Setter_Value_Complex_Path_Page();
            var app  = UnitTestsApp.App.EnsureApplication();

            app.HostView.Children.Add(page);

            var ellipse = ViewExtensions.FindFirstChild <Ellipse>(page.SubjectToggleButton);

            AssertEx.AssertHasColor(ellipse.Stroke, Colors.DarkGreen);

            await SwapSystemTheme();

            AssertEx.AssertHasColor(ellipse.Stroke, Colors.LightGreen);

            await SwapSystemTheme();

            AssertEx.AssertHasColor(ellipse.Stroke, Colors.DarkGreen);

            await SwapSystemTheme();

            AssertEx.AssertHasColor(ellipse.Stroke, Colors.LightGreen);

            await SwapSystemTheme();

            AssertEx.AssertHasColor(ellipse.Stroke, Colors.DarkGreen);
        }
        internal void Cleanup()
        {
            DispatcherHelpers.AssertOnDispatcher(this);

            Children.Clear();
            ViewExtensions.ClearData(this);
        }
Esempio n. 22
0
        /// <summary>
        /// Attach given <paramref name="rootView"/> to a React instance
        /// manager and start the JavaScript application using the JavaScript
        /// module provided by the <see cref="ReactRootView.JavaScriptModuleName"/>. If
        /// the React context is currently being (re-)created, or if the react
        /// context has not been created yet, the JavaScript application
        /// associated with the provided root view will be started
        /// asynchronously. This view will then be tracked by this manager and
        /// in case of React instance restart, it will be re-attached.
        /// WARNING! Has to be called by the thread associated with the view.
        /// </summary>
        /// <param name="rootView">The root view.</param>
        public async Task AttachMeasuredRootViewAsync(ReactRootView rootView)
        {
            if (rootView == null)
            {
                throw new ArgumentNullException(nameof(rootView));
            }

            DispatcherHelpers.AssertOnDispatcher(rootView);
            rootView.Children.Clear();
            ViewExtensions.ClearData(rootView);

            await DispatcherHelpers.CallOnDispatcher(() =>
            {
                _attachedRootViews.Add(rootView);

                // If the React context is being created in the background, the
                // JavaScript application will be started automatically when
                // creation completes, as root view is part of the attached root
                // view list.
                var currentReactContext = _currentReactContext;
                if (currentReactContext != null)
                {
                    AttachMeasuredRootViewToInstance(rootView, currentReactContext.ReactInstance);
                }

                return(true);
            }, true); // inlining allowed
        }
        private static async Task ToggleVisibility(ProgressRing progressRing)
        {
            try
            {
                ViewExtensions.CancelAnimations(progressRing);

                await ToggleVisibilityAnimationSemaphoreSlim.WaitAsync();

                if (progressRing.IsLoading)
                {
                    progressRing.ActivityIndicator.IsRunning = true;
                    progressRing.IsVisible = true;
                    await progressRing.FadeTo(FullyOpaque, TogglingVisibilityAnimationDuration, Easing.CubicInOut);
                }
                else
                {
                    await progressRing.FadeTo(FullyTransparent, TogglingVisibilityAnimationDuration, Easing.CubicInOut);

                    progressRing.ActivityIndicator.IsRunning = false;
                    progressRing.IsVisible = false;
                }
            }
            finally
            {
                ToggleVisibilityAnimationSemaphoreSlim.Release();
            }
        }
Esempio n. 24
0
        public TestRun()
        {
            InitializeComponent();

            //macOS workaround, Rotation property on Element is not working
            if (Device.RuntimePlatform == Device.macOS)
            {
                stLabel.RotateTo(-90);
                mtLabel.RotateTo(-90);
            }

            try
            {
                if ((bool)App.Current.Resources["Rose"])
                {
                    var img = new Image
                    {
                        Source = ImageSource.FromResource(
                            "Saplin.xOPS.UI.Misc.rose.png",
                            typeof(TestRun).GetTypeInfo().Assembly
                            )
                    };

                    img.Margin = new Thickness(-10, -10, -10, -10);

                    placeholder.Children.Add(img);
                }
            }
            catch { }

            VmLocator.TestRun.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == nameof(VmLocator.TestRun.TestStarted))
                {
                    if (VmLocator.TestRun.TestStarted)
                    {
                        ViewExtensions.CancelAnimations(fltStSmall);
                        ViewExtensions.CancelAnimations(fltMtSmall);
                        ViewExtensions.CancelAnimations(intStSmall);
                        ViewExtensions.CancelAnimations(intMtSmall);
                        fltStSmall.Opacity             = fltMtSmall.Opacity
                                                       = intStSmall.Opacity = intMtSmall.Opacity = 1;
                    }
                }
            };

            VmLocator.QuickComparison.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == nameof(VmLocator.QuickComparison.ComparedValue))
                {
                    fltStSmall.Opacity             = fltMtSmall.Opacity
                                                   = intStSmall.Opacity = intMtSmall.Opacity = 1;
                    fltStSmall.FadeTo(0, 5000, Easing.SpringIn);
                    fltMtSmall.FadeTo(0, 5000, Easing.SpringIn);
                    intStSmall.FadeTo(0, 5000, Easing.SpringIn);
                    intMtSmall.FadeTo(0, 5000, Easing.SpringIn);
                }
            };
        }
Esempio n. 25
0
        public async Task <ActionResult> SubmitAnswers(TrialExamAnswersResourceCollection questWithAnswers)
        {
            var examResultResource = new List <ExamResultResource>();

            if (questWithAnswers.ExamAnswersResourceList.Any())
            {
                var questions = await _questionService.GetAllAsync(0, int.MaxValue, x => x.Question, x => x.QuestionTypeId == questWithAnswers.QuestionType, OrderBy.Ascending, x => x.QuestionsLocalized);

                foreach (var eq in questions)
                {
                    var currentQuestionExistInTheExam = questWithAnswers.ExamAnswersResourceList.FirstOrDefault(x => x.QuestionId == eq.Id);
                    if (eq != null && currentQuestionExistInTheExam != null)
                    {
                        examResultResource.Add(
                            new ExamResultResource()
                        {
                            QuestionsResource = Mapper.Map <Questions, QuestionsResource>(eq),
                            SeletecdAnswer    = currentQuestionExistInTheExam != null ? currentQuestionExistInTheExam.Answer : 0
                        }
                            );
                    }
                }

                var TotalQuestions         = examResultResource.Count;
                var TotalQuestionsAttended = examResultResource.Count(x => x.SeletecdAnswer != 0);
                var TotalCorrectAnswered   = 0;
                var TotalInCorrectAnswers  = 0;
                //Status of Exam
                foreach (var result in examResultResource)
                {
                    if (result.QuestionsResource.Answer == result.SeletecdAnswer)
                    {
                        TotalCorrectAnswered++;
                    }
                    else
                    {
                        TotalInCorrectAnswers++;
                    }
                }

                ViewBag.TotalQuestions           = TotalQuestions;
                ViewBag.TotalQuestionsAttended   = TotalQuestionsAttended;
                ViewBag.TotalQuestionsUnAttended = TotalQuestions - TotalQuestionsAttended;
                ViewBag.TotalCorrectAnswered     = TotalCorrectAnswered;
                ViewBag.TotalInCorrectAnswers    = TotalInCorrectAnswers - (TotalQuestions - TotalQuestionsAttended);

                return(Json(new
                {
                    success = true,
                    result = ViewExtensions.RenderToString(PartialView("_ViewResults", examResultResource))
                }));
            }


            return(Json(new
            {
                success = false
            }));
        }
Esempio n. 26
0
        private async Task <bool> BackToFrontRotate()
        {
            ViewExtensions.CancelAnimations(this);
            this.RotationY = 90;
            await this.RotateYTo(0, 500, Easing.Linear);

            return(true);
        }
Esempio n. 27
0
        protected override void OnDisappearing()
        {
            base.OnDisappearing();

            ViewExtensions.CancelAnimations(cogBig);
            ViewExtensions.CancelAnimations(cogLil);
            IsAnimationEnabled = false;
        }
Esempio n. 28
0
        public void End()
        {
            ViewExtensions.CancelAnimations(Target);

            if (_animateTimerCancellationTokenSource != null)
            {
                _animateTimerCancellationTokenSource.Cancel();
            }
        }
Esempio n. 29
0
        public void GetViewModelTest()
        {
            MockView      view      = new MockView();
            MockViewModel viewModel = new MockViewModel(view);

            Assert.AreEqual(viewModel, view.GetViewModel <MockViewModel>());

            AssertHelper.ExpectedException <ArgumentNullException>(() => ViewExtensions.GetViewModel(null));
        }
Esempio n. 30
0
        public async Task Animate()
        {
            while (true)
            {
                await ViewExtensions.RotateTo(image, 360, 2000);

                image.Rotation = 0;
            }
        }