public override bool ShouldStartLoad(WKWebView webView, WKNavigationAction navigationAction)
        {
            var url = navigationAction.Request.Url;

            if (url != null && url.Scheme.Equals("app"))
            {
                var func = url.Host;

                if (func.Equals("comment"))
                {
                    var q            = System.Web.HttpUtility.ParseQueryString(url.Query);
                    var commentModel = new JavascriptCommentModel
                    {
                        LineFrom = ToNullableInt(q["lineFrom"]),
                        LineTo   = ToNullableInt(q["lineTo"])
                    };

                    PromptForComment(commentModel);
                }

                return(false);
            }

            return(base.ShouldStartLoad(webView, navigationAction));
        }
Example #2
0
        private void PromptForComment(JavascriptCommentModel model)
        {
            string title = "Line ".t() + (model.LineFrom ?? model.LineTo);

            var sheet        = MonoTouch.Utilities.GetSheet(title);
            var addButton    = sheet.AddButton("Add Comment".t());
            var cancelButton = sheet.AddButton("Cancel".t());

            sheet.CancelButtonIndex = cancelButton;
            sheet.DismissWithClickedButtonIndex(cancelButton, true);
            sheet.Clicked += (sender, e) => {
                if (e.ButtonIndex == addButton)
                {
                    ShowCommentComposer(model.LineFrom, model.LineTo);
                }
            };

            sheet.ShowInView(this.View);
        }
Example #3
0
        private void PromptForComment(JavascriptCommentModel model)
        {
            string title = string.Empty;

            title = "Line " + model.FileLine;

            var sheet        = _actionSheet = new UIActionSheet(title);
            var addButton    = sheet.AddButton("Add Comment");
            var cancelButton = sheet.AddButton("Cancel");

            sheet.CancelButtonIndex = cancelButton;
            sheet.DismissWithClickedButtonIndex(cancelButton, true);
            sheet.Clicked += (sender, e) => {
                if (e.ButtonIndex == addButton)
                {
                    ShowCommentComposer(model.PatchLine);
                }
                _actionSheet = null;
            };

            sheet.ShowInView(this.View);
        }
Example #4
0
        private void PromptForComment(JavascriptCommentModel model)
        {
            var title        = "Line " + model.FileLine;
            var sheet        = new UIActionSheet(title);
            var addButton    = sheet.AddButton("Add Comment");
            var cancelButton = sheet.AddButton("Cancel");

            sheet.CancelButtonIndex = cancelButton;
            sheet.Dismissed        += (sender, e) =>
            {
                BeginInvokeOnMainThread(() =>
                {
                    if (e.ButtonIndex == addButton)
                    {
                        ShowCommentComposer(model.PatchLine);
                    }
                });

                sheet.Dispose();
            };

            sheet.ShowInView(this.View);
        }
        private void PromptForComment(JavascriptCommentModel model)
        {
            string title = "Line " + (model.LineFrom ?? model.LineTo);

            var sheet        = new UIActionSheet(title);
            var addButton    = sheet.AddButton("Add Comment");
            var cancelButton = sheet.AddButton("Cancel");

            sheet.CancelButtonIndex = cancelButton;
            sheet.DismissWithClickedButtonIndex(cancelButton, true);
            sheet.Dismissed += (sender, e) => {
                BeginInvokeOnMainThread(() =>
                {
                    if (e.ButtonIndex == addButton)
                    {
                        ShowCommentComposer(model.LineFrom, model.LineTo);
                    }
                });

                sheet.Dispose();
            };

            sheet.ShowInView(this.View);
        }
Example #6
0
        private void PromptForComment(JavascriptCommentModel model)
        {
			string title = "Line " + (model.LineFrom ?? model.LineTo);

            var sheet = new UIActionSheet(title);
            var addButton = sheet.AddButton("Add Comment");
            var cancelButton = sheet.AddButton("Cancel");
            sheet.CancelButtonIndex = cancelButton;
            sheet.DismissWithClickedButtonIndex(cancelButton, true);
            sheet.Dismissed += (sender, e) => {
                BeginInvokeOnMainThread(() =>
                {
                    if (e.ButtonIndex == addButton)
    					ShowCommentComposer(model.LineFrom, model.LineTo);
                });

                sheet.Dispose();
            };

            sheet.ShowInView(this.View);
        }
Example #7
0
        private void PromptForComment(JavascriptCommentModel model)
        {
            var title = "Line " + model.FileLine;
            var sheet = new UIActionSheet(title);
            var addButton = sheet.AddButton("Add Comment");
            var cancelButton = sheet.AddButton("Cancel");
            sheet.CancelButtonIndex = cancelButton;
            sheet.Dismissed += (sender, e) =>
            {
                BeginInvokeOnMainThread(() =>
                {
                    if (e.ButtonIndex == addButton)
                        ShowCommentComposer(model.PatchLine);
                });

                sheet.Dispose();
            };

            sheet.ShowInView(this.View);
        }
Example #8
0
        private void PromptForComment(JavascriptCommentModel model)
        {
			string title = "Line ".t() + (model.LineFrom ?? model.LineTo);

            var sheet = MonoTouch.Utilities.GetSheet(title);
            var addButton = sheet.AddButton("Add Comment".t());
            var cancelButton = sheet.AddButton("Cancel".t());
            sheet.CancelButtonIndex = cancelButton;
            sheet.DismissWithClickedButtonIndex(cancelButton, true);
            sheet.Clicked += (sender, e) => {
                if (e.ButtonIndex == addButton)
					ShowCommentComposer(model.LineFrom, model.LineTo);
            };

            sheet.ShowInView(this.View);
        }