コード例 #1
0
        private void InitializeControls()
        {
            this.View.BackgroundColor             = eBriefingAppearance.BlueColor;
            this.NavigationItem.BackBarButtonItem = new UIBarButtonItem(String.Empty, UIBarButtonItemStyle.Plain, null);

            if (showVersion)
            {
                this.NavigationItem.Title = "About";
                this.NavigationController.NavigationBar.SetBackgroundImage(UIImage.FromBundle("Assets/Backgrounds/navbar.png").CreateResizableImage(new UIEdgeInsets(0, 1, 0, 1)), UIBarMetrics.Default);
                this.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, HandleDoneButtonTouchUpInside);
            }
            else
            {
                // Initialize credential
                KeychainAccessor.ClearCredential();
            }

            nfloat bottom = this.View.Frame.Bottom - 44;

            if (!showVersion)
            {
                // startButton
                startButton                  = UIButton.FromType(UIButtonType.Custom);
                startButton.Frame            = new CGRect(this.View.Center.X - (207 / 2), bottom - 44, 207, 44);
                startButton.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
                startButton.Font             = eBriefingAppearance.ThemeBoldFont(21);
                startButton.SetTitle("Get Started", UIControlState.Normal);
                startButton.SetTitleColor(UIColor.White, UIControlState.Normal);
                startButton.SetBackgroundImage(UIImage.FromBundle("Assets/Buttons/green_unfilled.png").CreateResizableImage(new UIEdgeInsets(15f, 14f, 15f, 14f)), UIControlState.Normal);
                startButton.SetBackgroundImage(UIImage.FromBundle("Assets/Buttons/white_unfilled.png").CreateResizableImage(new UIEdgeInsets(0f, 22f, 0f, 22f)), UIControlState.Highlighted);
                startButton.TouchUpInside += HandleStartButtonTouchUpInside;
                this.View.AddSubview(startButton);

                bottom = startButton.Frame.Y - 30;
            }

            // pageControl
            pageControl                  = new UIPageControl();
            pageControl.Frame            = new CGRect(this.View.Center.X - (300 / 2), bottom - 36, 300, 36);
            pageControl.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
            pageControl.ValueChanged    += HandlePageControlValueChanged;
            pageControl.Pages            = 4;
            this.View.AddSubview(pageControl);

            bottom = pageControl.Frame.Y - 20;

            // scrollView
            scrollView                 = new UIScrollView();
            scrollView.Frame           = new CGRect(0, 20, this.View.Frame.Width, bottom - 20);
            scrollView.BackgroundColor = UIColor.Clear;
            scrollView.PagingEnabled   = true;
            scrollView.ShowsHorizontalScrollIndicator = false;
            scrollView.AutoresizingMask   = UIViewAutoresizing.FlexibleDimensions;
            scrollView.DraggingStarted   += HandleScrollViewDraggingStarted;
            scrollView.DecelerationEnded += HandleScrollViewDecelerationEnded;
            this.View.AddSubview(scrollView);
        }
コード例 #2
0
        async private void Connect()
        {
            if (!Reachability.IsDefaultNetworkAvailable())
            {
                AlertView.Show(StringRef.connectionFailure, StringRef.connectionRequired, StringRef.ok);
            }
            else
            {
                try
                {
                    bool notCompatible             = false;
                    WebExceptionStatus errorStatus = WebExceptionStatus.ConnectFailure;
                    cts = new CancellationTokenSource();

                    Settings.WriteUseFormsAuth(false);

                    LoadingView.Show("Connecting", "Please wait while we're connecting to Demo Library...");
                    await eBriefingService.Run(() => StartAuthenticate(out errorStatus, out notCompatible), cts.Token);

                    LoadingView.Hide();
                    cts.Token.ThrowIfCancellationRequested();

                    if (errorStatus == WebExceptionStatus.Success)
                    {
                        Settings.Authenticated      = true;
                        Settings.AvailableCheckTime = DateTime.MinValue;
                        Settings.WriteSyncOn(false);

                        CancelAllDownloads();

                        // Success
                        Dismiss(false);
                    }
                    else
                    {
                        Settings.Authenticated = false;

                        if (notCompatible)
                        {
                            AlertView.Show(StringRef.alert, StringRef.notCompatible, StringRef.ok);
                        }
                        else
                        {
                            WebExceptionAlertView.ShowAlert(errorStatus);
                        }
                    }
                }
                catch (OperationCanceledException)
                {
                    KeychainAccessor.ClearCredential();
                }
            }
        }
コード例 #3
0
        private static void Save2Keychain(String url, String id, String password, String domain)
        {
            URL.ServerURL = url;

            // Save server info to Settings
            Settings.WriteServerInfo(id, domain);

            KeychainAccessor.RemoveCredential();

            // Save password info to keychain
            KeychainAccessor.SaveCredential(password);
        }