Example #1
0
        private void PresentPage()
        {
            if (_hasFinishedAnimation)
            {
                return;
            }

            var animationController = new Animation();

            var fadeAnimation = new Animation(v => GridContainer.Opacity = v, 0, 1, Easing.CubicIn);

            var startOffset   = GridContainer.Height * 0.10;
            var containerMove = new Animation(
                v => GridContainer.TranslationY = Lerp(startOffset, 0, v),
                0, 1,
                Easing.CubicInOut);

            animationController.Add(0, 0.65, fadeAnimation);
            animationController.Add(0, 1, containerMove);

            animationController.Commit(this, AnimationEnter,
                                       16, 500, null,
                                       async(d, b) =>
            {
                await Task.Delay(500);
                CodeEntry.Focus();
                _hasFinishedAnimation = true;
            });
        }
Example #2
0
        private async void JoinStudy()
        {
            CodeEntry code = await Utils.InputBox(Navigation, AppResources.StudyListPage_codeTitle, AppResources.StudyListPage_codeMessage);

            if (code.Cancelled || string.IsNullOrWhiteSpace(code.Entered))
            {
                return;
            }

            UserDialogs.Instance.ShowLoading(AppResources.Dialog_loading);
            ServerResponse <StudyEnrolment> photoResp =
                await NetworkUtils.PostRequest <StudyEnrolment>("api/studies/enrol?code=" + code.Entered, "");

            UserDialogs.Instance.HideLoading();

            if (photoResp.Response.StatusCode == HttpStatusCode.NotFound)
            {
                await UserDialogs.Instance.AlertAsync(AppResources.StudyListPage_codeInvalid);

                return;
            }
            else if (!photoResp.Response.IsSuccessStatusCode)
            {
                await UserDialogs.Instance.AlertAsync(AppResources.Main_connectionErr);

                return;
            }
            else
            {
                await UserDialogs.Instance.AlertAsync(AppResources.StudyListPage_codeSuccess);

                LoadData();
            }
        }
 protected override void OnAppearing()
 {
     base.OnAppearing();
     Device.BeginInvokeOnMainThread(async() =>
     {
         await System.Threading.Tasks.Task.Delay(150);
         CodeEntry.Focus();
     });
 }
            private void ParseCodeEntry(XmlNode root)
            {
                CodeEntry Entry = new CodeEntry();

                foreach (XmlNode xnode in root.ChildNodes)
                {
                    switch (xnode.NodeType)
                    {
                    case XmlNodeType.Element:
                    {
                        switch (xnode.Name)
                        {
                        case "Description":
                            Entry.Description = xnode.InnerText;
                            break;

                        case "Address":
                            Entry.Address = GetHexNumber(xnode.InnerText);
                            break;

                        case "ModuleName":
                            Entry.ModuleName = xnode.InnerText;
                            break;

                        case "ModuleNameOffset":
                            Entry.ModuleNameOffset = GetHexNumber(xnode.InnerText);
                            break;

                        case "Before":
                            Entry.Before = ParseBytes(xnode);
                            break;

                        case "Actual":
                            Entry.Actual = ParseBytes(xnode);
                            break;

                        case "After":
                            Entry.After = ParseBytes(xnode);
                            break;
                        }

                        break;
                    }
                    }
                }

                CTRef.CodeEntires.Add(Entry);
            }
Example #5
0
 public virtual void Remove(CodeEntry entry)
 {
     this.List.Remove(entry);
 }
Example #6
0
 public virtual void Add(CodeEntry entry)
 {
     this.List.Add(entry);
 }
Example #7
0
 public void FocusEntry()
 {
     CodeEntry.Focus();
 }
Example #8
0
        public static Task <CodeEntry> InputBox(INavigation navigation, string title, string message)
        {
            // wait in this proc, until user did his input
            var tcs = new TaskCompletionSource <CodeEntry>();

            var lblTitle = new Label {
                Text = title, HorizontalOptions = LayoutOptions.Center, FontAttributes = FontAttributes.Bold
            };
            var lblMessage = new Label {
                Text = message
            };
            var txtInput = new Entry {
                Text = ""
            };

            var btnOk = new Button
            {
                Text = AppResources.Dialog_confirm,
                HorizontalOptions = LayoutOptions.Fill,
                BackgroundColor   = Color.FromRgb(0.8, 0.8, 0.8),
            };

            btnOk.Clicked += async(s, e) =>
            {
                // close page
                var result = new CodeEntry {
                    Entered = txtInput.Text, Cancelled = false
                };
                await navigation.PopModalAsync();

                // pass result
                tcs.SetResult(result);
            };

            var btnCancel = new Button
            {
                Text = AppResources.Dialog_cancel,
                HorizontalOptions = LayoutOptions.Fill,
                BackgroundColor   = Color.FromRgb(0.8, 0.8, 0.8)
            };

            btnCancel.Clicked += async(s, e) =>
            {
                // close page
                var result = new CodeEntry {
                    Entered = null, Cancelled = true
                };
                await navigation.PopModalAsync();

                // pass result
                tcs.SetResult(result);
            };

            var slButtons = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          = { btnOk, btnCancel },
            };

            var layout = new StackLayout
            {
                Padding           = new Thickness(0, 40, 0, 0),
                VerticalOptions   = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Orientation       = StackOrientation.Vertical,
                Children          = { lblTitle, lblMessage, txtInput, slButtons },
            };

            // create and show page
            var page = new ContentPage();

            page.Content = layout;
            navigation.PushModalAsync(page);
            // open keyboard
            txtInput.Focus();

            // code is waiting her, until result is passed with tcs.SetResult() in btn-Clicked
            // then proc returns the result
            return(tcs.Task);
        }
Example #9
0
 public virtual void Remove(CodeEntry entry)
 {
     this.List.Remove(entry);
 }
Example #10
0
 public virtual void Add(CodeEntry entry)
 {
     this.List.Add(entry);
 }