예제 #1
0
        public NoteView(RectangleF rectangle, UIInterfaceOrientation orientation) : base(rectangle)
        {
            this.BackgroundColor = UIColor.Clear;
            this.AutoresizingMask = UIViewAutoresizing.FlexibleHeight;
            this.orientation = orientation;

            // pullTab
            pullTab = new UIImageView(UIImage.FromBundle("Assets/Buttons/pull_tab.png"));
            pullTab.Frame = new RectangleF(0, rectangle.Height / 2 - 25, ARROW_WIDTH, ARROW_HEIGHT);
            this.AddSubview(pullTab);

            // barView
            barView = new UIImageView();
            barView.Image = UIImage.FromBundle("Assets/Backgrounds/vertical_bar.png").CreateResizableImage(new UIEdgeInsets(10, 0, 10, 0));
            barView.Frame = new RectangleF(pullTab.Frame.Right, 0, barView.Image.Size.Width, rectangle.Height);
            this.AddSubview(barView);

            // scrollView
            scrollView = new UIScrollView();
            scrollView.Frame = new RectangleF(barView.Frame.Right, 0, rectangle.Width - barView.Frame.Right, rectangle.Height);
            scrollView.ContentSize = new SizeF(scrollView.Frame.Width, scrollView.Frame.Height);
            scrollView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight;
            scrollView.BackgroundColor = eBriefingAppearance.Color(44, 44, 44);
            this.AddSubview(scrollView);

            // textView
            textView = new CustomTextView();
            textView.Frame = new RectangleF(0, 0, scrollView.Frame.Width, scrollView.Frame.Height);
            textView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight;
            textView.BackgroundColor = eBriefingAppearance.Color(44, 44, 44);
            textView.TextColor = UIColor.White;
            textView.Font = UIFont.SystemFontOfSize(17f);
            textView.SpellCheckingType = UITextSpellCheckingType.No;
            textView.AutocorrectionType = UITextAutocorrectionType.Yes;

            scrollView.AddSubview(textView);

            // placeholder
            placeholder = new UILabel();
            placeholder.Frame = new RectangleF(barView.Frame.Right + 10, textView.Center.Y, textView.Frame.Width - 20, 42);
            placeholder.Font = UIFont.BoldSystemFontOfSize(17f);
            placeholder.TextAlignment = UITextAlignment.Center;
            placeholder.BackgroundColor = UIColor.Clear;
            placeholder.TextColor = UIColor.White;
            placeholder.Lines = 0;
            placeholder.LineBreakMode = UILineBreakMode.WordWrap;
            placeholder.Text = "Tap to enter notes for the current page";
            placeholder.SizeToFit();
            placeholder.Alpha = 0f;
            this.AddSubview(placeholder);

            RegisterTextViewEvents();

            // Register tableView Keyboard Notification for auto scroll
            autoScroll = new KeyboardAutoScroll();
            autoScroll.RegisterForKeyboardNotifications(textView, KeyboardAutoScroll.ScrollType.TEXTVIEW);

            leftLimitX = rectangle.X - rectangle.Width;
            rightLimitX = rectangle.X - ARROW_WIDTH;
        }
        private void InitializeControls()
        {
            this.View.BackgroundColor = UIColor.White;
            this.NavigationItem.Title = "Connect to Enterprise Library";

            // scrollView
            scrollView = new UIScrollView();
            scrollView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
            scrollView.Frame            = new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height);
            this.View.AddSubview(scrollView);

            // licenseLabel
//			licenseLabel = eBriefingAppearance.GenerateLabel(17);
//			licenseLabel.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin;
//			licenseLabel.Text = "NEED ENTERPRISE LICENSE?";
//			licenseLabel.Frame = new CGRect(scrollView.Frame.Right - 280, 50, 240, 21);
//			scrollView.AddSubview(licenseLabel);

            // noticeLabel
            UILabel noticeLabel = eBriefingAppearance.GenerateLabel(21);

            noticeLabel.Frame         = new CGRect(40, 50, 400, 42);
            noticeLabel.Lines         = 2;
            noticeLabel.LineBreakMode = UILineBreakMode.WordWrap;
            noticeLabel.Text          = "*Requires web front end for your SharePoint Environment to continue setup";
            noticeLabel.SizeToFit();
            scrollView.AddSubview(noticeLabel);

            // learnButton
//			learnButton = UIButton.FromType(UIButtonType.Custom);
//			learnButton.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin;
//			learnButton.Frame = new CGRect(licenseLabel.Frame.X, licenseLabel.Frame.Bottom + 20, licenseLabel.Frame.Width, 44);
//			learnButton.Font = eBriefingAppearance.ThemeBoldFont(21);
//			learnButton.SetTitle("Learn More", UIControlState.Normal);
//			learnButton.SetTitleColor(eBriefingAppearance.Gray1, UIControlState.Normal);
//			learnButton.SetTitleColor(UIColor.White, UIControlState.Highlighted);
//			learnButton.SetBackgroundImage(UIImage.FromBundle("Assets/Buttons/green_unfilled.png").CreateResizableImage(new UIEdgeInsets(15f, 14f, 15f, 14f)), UIControlState.Normal);
//			learnButton.SetBackgroundImage(UIImage.FromBundle("Assets/Buttons/green_filled.png").CreateResizableImage(new UIEdgeInsets(15f, 14f, 15f, 14f)), UIControlState.Highlighted);
//			learnButton.TouchUpInside += HandleLearnButtonTouchUpInside;
//			scrollView.AddSubview(learnButton);

            // formsLabel
            UILabel formsLabel = eBriefingAppearance.GenerateLabel(21);

            formsLabel.Text  = "Use Forms Authentication";
            formsLabel.Frame = new CGRect(noticeLabel.Frame.X, noticeLabel.Frame.Bottom + 20, this.View.Frame.Width - 80, 21);
            scrollView.AddSubview(formsLabel);

            // formSwitch
            formSwitch               = new UISwitch();
            formSwitch.Frame         = new CGRect(300, formsLabel.Center.Y - (formSwitch.Frame.Height / 2), formSwitch.Frame.Width, formSwitch.Frame.Height);
            formSwitch.ValueChanged += HandleFormSwitchValueChanged;
            formSwitch.SetState(Settings.UseFormsAuth, true);
            scrollView.AddSubview(formSwitch);

            // urlLabel
            UILabel urlLabel = eBriefingAppearance.GenerateLabel(21);

            urlLabel.Text  = "Library URL";
            urlLabel.Frame = new CGRect(noticeLabel.Frame.X, formSwitch.Frame.Bottom + 40, 130, 21);
            scrollView.AddSubview(urlLabel);

            // urlField
            urlField = GenerateTextField("  Type library URL here", new CGPoint(178, formSwitch.Frame.Bottom + 30), 0);

            // idLabel
            UILabel idLabel = eBriefingAppearance.GenerateLabel(21);

            idLabel.Text  = "User ID";
            idLabel.Frame = new CGRect(noticeLabel.Frame.X, urlLabel.Frame.Bottom + 40, 130, 21);
            scrollView.AddSubview(idLabel);

            // idField
            idField = GenerateTextField("  Type user ID here", new CGPoint(178, urlLabel.Frame.Bottom + 30), 1);

            // passwordLabel
            passwordLabel       = eBriefingAppearance.GenerateLabel(21);
            passwordLabel.Text  = "Password";
            passwordLabel.Frame = new CGRect(noticeLabel.Frame.X, idLabel.Frame.Bottom + 40, 130, 21);
            scrollView.AddSubview(passwordLabel);

            // passwordField
            passwordField = GenerateTextField("  Type password here", new CGPoint(178, idLabel.Frame.Bottom + 30), 2);
            passwordField.SecureTextEntry = true;

            // domainLabel
            domainLabel       = eBriefingAppearance.GenerateLabel(21);
            domainLabel.Text  = "Domain";
            domainLabel.Frame = new CGRect(noticeLabel.Frame.X, passwordLabel.Frame.Bottom + 40, 130, 21);
            scrollView.AddSubview(domainLabel);

            // domainField
            domainField = GenerateTextField("  Type domain here", new CGPoint(178, passwordLabel.Frame.Bottom + 30), 3);
            domainField.ReturnKeyType = UIReturnKeyType.Go;

            // connectButton
            connectButton       = UIButton.FromType(UIButtonType.Custom);
            connectButton.Frame = new CGRect(scrollView.Frame.Width - 247, domainField.Frame.Bottom + 60, 207, 44);
            connectButton.Font  = eBriefingAppearance.ThemeBoldFont(21);
            connectButton.SetTitle("Connect", UIControlState.Normal);
            connectButton.SetTitleColor(eBriefingAppearance.Gray1, UIControlState.Normal);
            connectButton.SetTitleColor(UIColor.White, UIControlState.Highlighted);
            connectButton.SetTitleColor(UIColor.LightGray, UIControlState.Disabled);
            connectButton.SetBackgroundImage(UIImage.FromBundle("Assets/Buttons/green_unfilled.png").CreateResizableImage(new UIEdgeInsets(15f, 14f, 15f, 14f)), UIControlState.Normal);
            connectButton.SetBackgroundImage(UIImage.FromBundle("Assets/Buttons/gray_unfilled.png").CreateResizableImage(new UIEdgeInsets(0f, 22f, 0f, 22f)), UIControlState.Disabled);
            connectButton.SetBackgroundImage(UIImage.FromBundle("Assets/Buttons/green_filled.png").CreateResizableImage(new UIEdgeInsets(15f, 14f, 15f, 14f)), UIControlState.Highlighted);
            connectButton.TouchUpInside   += HandleConnectButtonTouchUpInside;
            connectButton.Enabled          = false;
            connectButton.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleBottomMargin;
            scrollView.AddSubview(connectButton);

            // Register tableView Keyboard Notification for auto scroll
            autoScroll = new KeyboardAutoScroll();
            autoScroll.RegisterForKeyboardNotifications(this.View, KeyboardAutoScroll.ScrollType.SCROLLVIEW);
        }