/// <summary>
        /// Applies handling for subtitles to textview
        /// </summary>
        /// <param name="action">Action that should be started when the user interacts with the source.</param>
        /// <param name="sources">The parsed sources</param>
        /// <param name="textView">Textiew the SubtitleLinks should be attached to</param>
        /// <param name="text">Text representing the whole subtitle</param>
        public static void ApplySubtitlesLinks(this UITextView textView, IInteractiveSourceAction action, List <Source> sources, NSAttributedString text)
        {
            if (action == null)
            {
                return;
            }

            Dictionary <Source, FinalSourcePosition> sourcePositions = new Dictionary <Source, FinalSourcePosition>();
            var formattedTextWithSubstitutes = new NSMutableAttributedString(text);

            // get the textpositions of each source and mark them
            foreach (var source in sources)
            {
                if (source == null)
                {
                    continue;
                }

                int startIndex   = text.Value.IndexOf(source.SubstituteText, StringComparison.Ordinal);
                var finalPostion = new FinalSourcePosition
                {
                    Start = startIndex,
                    End   = startIndex + source.SubstituteText.Length - 1
                };
                sourcePositions.Add(source, finalPostion);

                var resources = IoCManager.Resolve <ApplicationResourcesProvider>();
                formattedTextWithSubstitutes.AddAttribute(UIStringAttributeKey.ForegroundColor, (resources.TryGetResourceColorvalue("SecondaryColor")).ToUIColor(),
                                                          new NSRange(finalPostion.Start, source.SubstituteText.Length));
            }
            textView.AttributedText = formattedTextWithSubstitutes;

            // make the source links clickable
            textView.AddGestureRecognizer(new UITapGestureRecognizer(x => HandleTap(x, textView, sourcePositions, action)));
        }
Exemplo n.º 2
0
        public UIView GetView(OutputFieldMetadata outputField,
                              object value,
                              MyFormHandler myFormHandler,
                              FormMetadata formMetadata,
                              List <FormInputManager> inputsManager,
                              int yAxis)
        {
            this.OutputView = new UIView();
            var labelSize = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, 30);

            this.OutputView.Frame = new CGRect(new CGPoint(20, yAxis), labelSize);

            var tabstrip   = value.CastTObject <Tabstrip>();
            var currentTab = tabstrip.Tabs.SingleOrDefault(a => a.Form == tabstrip.CurrentTab);

            var x     = 0;
            var width = UIScreen.MainScreen.Bounds.Width - 60;

            foreach (var tab in tabstrip.Tabs)
            {
                var size = new CGSize(width / tabstrip.Tabs.Count, 30);
                if (tab != null)
                {
                    var tv = new UITextView
                    {
                        Text      = tab.Label,
                        Frame     = new CGRect(new CGPoint(x, 0), size),
                        TextColor = UIColor.LightGray
                    };
                    nfloat borderWidth = 2;
                    var    border      = new CALayer
                    {
                        BorderColor = UIColor.LightGray.CGColor,
                        Frame       = new CGRect(0, tv.Frame.Size.Height - borderWidth, tv.Frame.Size.Width - 20, tv.Frame.Size.Height),
                        BorderWidth = width
                    };

                    x += (int)tv.Frame.Width;
                    UITapGestureRecognizer gesture = new UITapGestureRecognizer();
                    gesture.AddTarget(() =>
                    {
                        var metadata = myFormHandler.GetFormMetadataAsync(tab.Form);
                        myFormHandler.FormWrapper.UpdateView(myFormHandler, new FormParameter(metadata, tab.InputFieldValues));
                    });
                    tv.AddGestureRecognizer(gesture);
                    if (tab == currentTab)
                    {
                        tv.TextColor       = UIColor.Black;
                        border.BorderColor = UIColor.Black.CGColor;
                    }
                    tv.Layer.AddSublayer(border);
                    tv.Layer.MasksToBounds = true;
                    this.OutputView.AddSubview(tv);
                }
            }
            return(this.OutputView);
        }
Exemplo n.º 3
0
        public void UpdateCell(string title, UIImage image, NSIndexPath indexPath)
        {
            imageView.Image = image;
            textLabel.Text  = title;

            UITapGestureRecognizer tgrLabel = new UITapGestureRecognizer(() => {
                Selected = true;
                onClickCallback(indexPath);
            });

            textLabel.AddGestureRecognizer(tgrLabel);
        }
Exemplo n.º 4
0
        public void CreateUIView(Attachment attachment)
        {
            CGPoint centerPoint = new CGPoint();
            CGRect  CGRectFrame = new CGRect();

            centerPoint = new CGPoint(attachment.X, attachment.Y);
            CGRectFrame = new CGRect(attachment.X, attachment.Y, attachment.Width, attachment.Height);
            if (attachment.Type == AttachmentTypeEnum.Note)
            {
                UITextView textview = new UITextView();
                textview.Text = attachment.Note;
                textview.AccessibilityIdentifier = attachment.Name;
                textview.BackgroundColor         = UIColor.FromRGB(242, 255, 0);
                textview.Frame = CGRectFrame;
                textview.Font  = UIFont.FromName("Helvetica-Bold", 30f);
                UIPanGestureRecognizer panGesture = GetUIViewPanGesture(textview);
                textview.UserInteractionEnabled = true;
                textview.AddGestureRecognizer(panGesture);

                textview.Ended += delegate
                {
                    var editAttachment = Doc.Attachments.Where(x => x.Name == textview.AccessibilityIdentifier).SingleOrDefault();
                    editAttachment.Note = textview.Text;
                };

                scrollView.InsertSubview(textview, 1);
            }
            else
            {
                string systemPath = string.Empty;
                string filePath   = Path.Combine(DocumentPath, attachment.Path);
                var    imageView  = new UIImageView();
                imageView.BackgroundColor         = UIColor.Clear;
                imageView.Image                   = UIImage.FromBundle(filePath);
                imageView.AccessibilityIdentifier = attachment.Name;
                imageView.Frame                   = CGRectFrame;
                imageView.UserInteractionEnabled  = true;
                imageView.AddGestureRecognizer(GetUIViewPanGesture(imageView));
                scrollView.InsertSubview(imageView, 1);
            }
        }
        public async void createRssPopup(Update feed)
        {
            await Task.Delay(TimeSpan.FromSeconds(2));

            try{
                var window = UIApplication.SharedApplication.KeyWindow;
                var vc     = window.RootViewController;
                while (vc.PresentedViewController != null)
                {
                    vc = vc.PresentedViewController;
                }
                var rssView = new UIView(new CGRect(.05 * vc.View.Bounds.Width, .11 * vc.View.Bounds.Height, .9 * vc.View.Bounds.Width, .78 * vc.View.Bounds.Height));

                rssView.Layer.CornerRadius = 5f;
                rssView.ClipsToBounds      = true;
                rssView.Layer.BorderWidth  = 1f;

                //var rssHeader = new UILabel(new CGRect(0, 0, rssView.Bounds.Width, .1 * rssView.Bounds.Height));
                var rssHeader = new UILabel(new CGRect(0, 0, rssView.Bounds.Width, 70));
                rssHeader.BackgroundColor           = UIColor.FromRGB(9, 211, 255);
                rssHeader.ClipsToBounds             = true;
                rssHeader.Text                      = "Message from Appion";
                rssHeader.AdjustsFontSizeToFitWidth = true;
                rssHeader.TextAlignment             = UITextAlignment.Center;
                rssHeader.Font                      = UIFont.FromName("DroidSans", 20f);


                var linkTapGesture = new UITapGestureRecognizer(() => {
                    if (!String.IsNullOrEmpty(feed.link))
                    {
                        UIApplication.SharedApplication.OpenUrl(new NSUrl(feed.link));
                    }
                });

                var rssContent = new UITextView(new CGRect(0, .1 * rssView.Bounds.Height, rssView.Bounds.Width, rssView.Bounds.Height));
                rssContent.Font = UIFont.BoldSystemFontOfSize(18f);

                NSError error      = null;
                var     htmlString = new NSAttributedString(
                    NSData.FromString("<div style=\"font-size: 150%\">" + feed.title + "</br>" + feed.description + "</div>"),
                    new NSAttributedStringDocumentAttributes {
                    DocumentType = NSDocumentType.HTML, StringEncoding = NSStringEncoding.UTF8
                },
                    ref error
                    );

                rssContent.AttributedText = htmlString;

                rssContent.AddGestureRecognizer(linkTapGesture);

                //var closeButton = new UIButton(new CGRect(0, , rssView.Bounds.Width, .1 * rssView.Bounds.Height));
                var closeButton = new UIButton(new CGRect(0, .9 * rssView.Bounds.Height, rssView.Bounds.Width, 70));
                closeButton.BackgroundColor   = UIColor.White;
                closeButton.Layer.BorderWidth = 1f;
                closeButton.ClipsToBounds     = true;
                closeButton.SetTitle("Close", UIControlState.Normal);
                closeButton.SetTitleColor(UIColor.Black, UIControlState.Normal);

                //closeButton.TouchDown += (sender, e) => {closeButton.BackgroundColor = UIColor.Blue;};
                //closeButton.TouchUpOutside += (sender, e) => {closeButton.BackgroundColor = UIColor.White;};
                closeButton.TouchUpInside += (sender, e) => {
                    rssView.RemoveFromSuperview();
                };
                var newTime = DateTime.Now.ToLocalTime().ToString();

                NSUserDefaults.StandardUserDefaults.SetString(newTime, "rssCheck");
                NSUserDefaults.StandardUserDefaults.SetString(feed.title, "rssTitle");

                rssView.AddSubview(rssHeader);
                rssView.AddSubview(rssContent);
                rssView.AddSubview(closeButton);
                vc.View.AddSubview(rssView);
                vc.View.BringSubviewToFront(rssView);
            } catch (Exception e) {
                Console.WriteLine("Error: " + e);
            }
        }
Exemplo n.º 6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();


            var dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "taskListDB");
            var db     = new SQLiteConnection(dbPath);

            //Create table
            db.CreateTable <TaskObject> ();
            undoButtonCount = 0;


            t = new Timer(5000);


            exitTableView.SetTitle("Close", UIControlState.Normal);
            exitTableView.Frame = new RectangleF((float)UIScreen.MainScreen.Bounds.Width - 55, 17, 50, 30);
            exitTableView.Font  = UIFont.SystemFontOfSize(16);
            exitTableView.SetTitleColor(colorText, UIControlState.Normal);

            loadAllTasks.SetTitle("Show All", UIControlState.Normal);
            loadAllTasks.Frame = new RectangleF((float)UIScreen.MainScreen.Bounds.Width / 2 - 50,
                                                (float)UIScreen.MainScreen.Bounds.Height - 35, 100, 30);
            loadAllTasks.Font = UIFont.SystemFontOfSize(16);
            loadAllTasks.SetTitleColor(colorText, UIControlState.Normal);
            View.AddSubview(loadAllTasks);


            barText.Text          = "TaskList";
            barText.TextAlignment = UITextAlignment.Center;
            barText.Font          = UIFont.SystemFontOfSize(18);
            barText.TextColor     = UIColor.FromRGB(32, 132, 200);
            barText.Editable      = false;
            barText.Selectable    = false;
            View.AddSubview(bar);
            View.AddSubview(barText);


            //noTasks
            noTasks.Text               = "No Tasks";
            noTasks.TextAlignment      = UITextAlignment.Center;
            noTasks.Font               = UIFont.SystemFontOfSize(24);
            noTasks.Layer.BorderWidth  = 1;
            noTasks.Layer.CornerRadius = 5;
            noTasks.Layer.BorderColor  = colorOutline.CGColor;
            noTasks.TextColor          = colorText;
            noTasks.BackgroundColor    = UIColor.White;
            View.AddSubview(noTasks);

            //newTaskText
            newTaskText.BorderStyle        = UITextBorderStyle.RoundedRect;
            newTaskText.Placeholder        = "What is your new Task?";
            newTaskText.Layer.BorderWidth  = 1;
            newTaskText.Layer.CornerRadius = 5;
            newTaskText.Layer.BorderColor  = colorOutline.CGColor;
            newTaskText.BackgroundColor    = UIColor.White;
            View.AddSubview(newTaskText);

            //totalTask
            totalTasks.Font          = UIFont.SystemFontOfSize(13);
            totalTasks.Editable      = false;
            totalTasks.TextAlignment = UITextAlignment.Right;
            totalTasks.TextColor     = colorText;
            View.AddSubview(totalTasks);

            //addTaskButton
            addTaskButton.SetTitle("Add", UIControlState.Normal);
            addTaskButton.Frame              = new RectangleF((float)UIScreen.MainScreen.Bounds.Width - 67 + 2, 50, 59 + 6, 40);
            addTaskButton.Font               = UIFont.SystemFontOfSize(16);
            addTaskButton.Layer.BorderWidth  = 1;
            addTaskButton.Layer.CornerRadius = 5;
            addTaskButton.Layer.BorderColor  = colorOutline.CGColor;
            addTaskButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            addTaskButton.BackgroundColor = UIColor.FromRGB(52 + 10, 152 + 10, 220 + 10);
            View.AddSubview(addTaskButton);

            //deleteTask
            deleteTask.SetTitle("Next Task", UIControlState.Normal);
            deleteTask.Frame              = (new RectangleF((float)UIScreen.MainScreen.Bounds.Width - 140, 150, 135, 35));
            deleteTask.Font               = UIFont.SystemFontOfSize(18);
            deleteTask.Layer.BorderWidth  = 1;
            deleteTask.Layer.CornerRadius = 5;
            deleteTask.Layer.BorderColor  = colorOutline.CGColor;
            deleteTask.SetTitleColor(UIColor.White, UIControlState.Normal);
            deleteTask.BackgroundColor = UIColor.FromRGB(52 + 10, 152 + 10, 220 + 10);
            View.AddSubview(deleteTask);

            //belowTaskText
            belowTaskText.Font          = UIFont.SystemFontOfSize(12);
            belowTaskText.Editable      = false;
            belowTaskText.Hidden        = true;
            belowTaskText.TextAlignment = UITextAlignment.Center;
            View.AddSubview(belowTaskText);

            //undoButton
            undoButton.SetTitle("Undo", UIControlState.Normal);
            undoButton.Frame  = new RectangleF(0, 103 + 60, 65, 30);
            undoButton.Font   = UIFont.SystemFontOfSize(16);
            undoButton.Hidden = true;
            undoButton.SetTitleColor(colorText, UIControlState.Normal);
            View.AddSubview(undoButton);

            //lines
            lines.Editable           = false;
            lines.Selectable         = false;
            lines.Layer.BorderWidth  = 1;
            lines.Layer.CornerRadius = 1;
            lines.Layer.BorderColor  = colorText.CGColor;
            View.AddSubview(lines);

            lines1.Editable           = false;
            lines1.Selectable         = false;
            lines1.Layer.BorderWidth  = 1;
            lines1.Layer.CornerRadius = 1;
            lines1.Layer.BorderColor  = colorText.CGColor;


            //dateText
            dateText.Font          = UIFont.SystemFontOfSize(13);
            dateText.Editable      = false;
            dateText.TextAlignment = UITextAlignment.Right;
            dateText.TextColor     = colorText;
            View.AddSubview(dateText);


            //UpdateScreen ();


            //Code/visuals for one task
            textView = new UITextView(new RectangleF(5, 190, (float)UIScreen.MainScreen.Bounds.Width - 10,
                                                     (float)UIScreen.MainScreen.Bounds.Height - 195));
            textView.Text               = "";
            textView.TextAlignment      = UITextAlignment.Center;
            textView.Font               = UIFont.SystemFontOfSize(24);
            textView.Editable           = false;
            textView.Layer.BorderWidth  = 1;
            textView.Layer.CornerRadius = 5;
            textView.Layer.BorderColor  = colorOutline.CGColor;
            textView.TextColor          = colorText;
            textView.BackgroundColor    = UIColor.White;



            //Find database size
            var firstRow = db.Query <TaskObject> ("SELECT ID, isDeleted, Text FROM tasks WHERE NOT isDeleted ORDER BY ID ASC LIMIT 1");
            var lastRow  = db.Query <TaskObject> ("SELECT ID FROM tasks WHERE NOT isDeleted ORDER BY ID DESC LIMIT 1");

            firstID = 0;
            int lastID = -1;


            foreach (var a in firstRow)
            {
                firstID = a.ID;
            }
            foreach (var a in lastRow)
            {
                lastID = a.ID;
            }

            taskCount = lastID - firstID + 1;


            if (taskCount > 0)
            {
                textView.Text = db.Get <TaskObject> (firstID).Text;
                View.AddSubview(textView);
                dateText.Text = db.Get <TaskObject>(firstID).date.ToString();
                dateText.Text.Remove(dateText.Text.IndexOf(' '));
            }

            totalTasks.Text = "Tasks: " + taskCount;

            UpdateScreen();

            View.AddSubview(dateText);
            View.AddSubview(loadAllTasks);


            addTaskButton.TouchUpInside += async(sender, e) =>
            {
                if (newTaskText.Text != "" && taskCount < 15)
                {
                    string text = newTaskText.Text;
                    if (text.Length > 185)
                    {
                        text = text.Substring(0, 180) + "...";
                    }

                    db.Insert(new TaskObject("Current Task \n \n" + text));
                    if (taskCount == 0)
                    {
                        firstRow = db.Query <TaskObject> ("SELECT ID FROM tasks WHERE NOT isDeleted ORDER BY ID ASC LIMIT 1");                       // ORDER BY ID ASC LIMIT 1");
                        foreach (var a in firstRow)
                        {
                            Console.WriteLine("Data: " + a.ID + a.Text);
                            firstID       = a.ID;
                            textView.Text = db.Get <TaskObject> (firstID).Text;
                        }
                        dateText.Text = db.Get <TaskObject>(firstID).date.ToString();
                        dateText.Text.Remove(dateText.Text.IndexOf(' '));
                        View.AddSubview(dateText);
                    }

                    taskCount++;

                    if (firstID > 15)
                    {
                        db.Delete <TaskObject>(firstID - 15);
                    }

                    newTaskText.Text = "";
                    newTaskText.ResignFirstResponder();

                    UpdateScreen();
                    View.AddSubview(dateText);

                    belowTaskText.Text      = "Successfully added.";
                    belowTaskText.TextColor = UIColor.Black;
                    belowTaskText.Hidden    = false;

                    t.Start();
                }
                else if (newTaskText.Text == "")
                {
                    belowTaskText.Text      = "Please enter your task above.";
                    belowTaskText.TextColor = UIColor.Red;
                    belowTaskText.Hidden    = false;

                    t.Start();
                }
                else
                {
                    belowTaskText.Text      = "You already have 15 tasks. Please finish a few before adding more.";
                    belowTaskText.TextColor = UIColor.Red;
                    belowTaskText.Hidden    = false;

                    t.Start();
                }
            };


            //When return key is tapped, keyboard goes down
            newTaskText.ShouldReturn = (sender) =>
            {
                sender.ResignFirstResponder();
                return(false);
            };


            //Remaining views cause keyboard to go down when touched
            UITapGestureRecognizer tapGesture  = new UITapGestureRecognizer(TextViewTap);
            UITapGestureRecognizer tapGesture1 = new UITapGestureRecognizer(TextViewTap);

            textView.AddGestureRecognizer(tapGesture);
            noTasks.AddGestureRecognizer(tapGesture1);


            t.Elapsed += (sender, e) =>
            {
                InvokeOnMainThread(() => {
                    belowTaskText.Hidden    = true;
                    belowTaskText.TextColor = UIColor.Black;
                    t.Stop();
                });
            };


            deleteTask.TouchUpInside += async(sender, e) =>
            {
                if (taskCount > 0)
                {
                    db.Execute("UPDATE tasks SET isDeleted = 1 WHERE ID = " + firstID);

                    firstID++;
                    taskCount--;

                    if (taskCount > 0)
                    {
                        textView.Text = db.Get <TaskObject>(firstID).Text;
                        dateText.Text = db.Get <TaskObject>(firstID).date.ToString();
                        dateText.Text.Remove(dateText.Text.IndexOf(' '));
                    }

                    undoButtonCount   = Math.Min(undoButtonCount + 1, 15);
                    undoButton.Hidden = false;
                    View.AddSubview(dateText);
                    UpdateScreen();
                }
            };

            undoButton.TouchUpInside += async(sender, e) =>
            {
                if (taskCount < 15 && firstID > 1 && undoButtonCount > 0)
                {
                    firstID--;
                    db.Execute("UPDATE tasks SET isDeleted = 0 WHERE ID = " + firstID);
                    taskCount++;
                    undoButtonCount--;
                    textView.Text = db.Get <TaskObject>(firstID).Text;
                }
                if (undoButtonCount <= 0)
                {
                    undoButton.Hidden = true;
                }

                dateText.Text = db.Get <TaskObject>(firstID).date.ToString();
                dateText.Text.Remove(dateText.Text.IndexOf(' '));

                UpdateScreen();
                View.AddSubview(dateText);
            };

            loadAllTasks.TouchUpInside += async(sender, e) =>
            {
                taskTableView.Source             = new TableSource(db.Query <TaskObject>("SELECT Text, date FROM tasks WHERE NOT isDeleted"));
                taskTableView.RowHeight          = UITableView.AutomaticDimension;
                taskTableView.EstimatedRowHeight = 75;

                View.AddSubview(taskTableView);
                View.AddSubview(exitTableView);

                barText.Text = taskCount + " Tasks";
                View.AddSubview(lines1);
            };

            exitTableView.TouchUpInside += async(sender, e) =>
            {
                taskTableView.RemoveFromSuperview();
                exitTableView.RemoveFromSuperview();
                lines1.RemoveFromSuperview();
                barText.Text = "TaskList";
            };
        }
Exemplo n.º 7
0
        public override void ViewDidLoad()
        {
            try
            {
                base.ViewDidLoad();
                //LoggingClass.UploadLogs();
                CGSize sTemp = new CGSize(UIScreen.MainScreen.Bounds.Width, 100);
                LoggingClass.LogInfo("Entered into About View ", screen);
                nfloat ScreenHeight = UIScreen.MainScreen.Bounds.Height;
                nfloat Screenwidth  = UIScreen.MainScreen.Bounds.Width - 10;
                nfloat bckimgheight = (ScreenHeight - 100) / 3;
                bckimgheight = bckimgheight + 30;
                UIImageView backgroud = new UIImageView();
                backgroud.Frame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, bckimgheight);
                backgroud.Image = new UIImage("Images/aboutus.jpg");
                nfloat  y  = bckimgheight;
                UILabel T1 = new UILabel();
                T1.Frame         = new CGRect(0, y + 10, UIScreen.MainScreen.Bounds.Width - 20, 10);
                T1.Font          = UIFont.FromName("HelveticaNeue-Bold", 35f);
                T1.Text          = "Wine Outlet";
                T1.TextColor     = UIColor.Purple;
                T1.TextAlignment = UITextAlignment.Center;
                sTemp            = T1.SizeThatFits(sTemp);
                T1.Frame         = new CGRect(0, y + 10, Screenwidth, sTemp.Height);


                y = y + T1.Frame.Height + 20;
                //Console.WriteLine(y);

                UILabel H1 = new UILabel();
                H1.Frame         = new CGRect(5, y, Screenwidth, 10);
                H1.Text          = "Uncork the Merriment";
                H1.TextAlignment = UITextAlignment.Left;
                H1.TextColor     = UIColor.Black;
                H1.Font          = UIFont.FromName("Verdana-Bold", 20f);
                sTemp            = H1.SizeThatFits(sTemp);
                H1.Frame         = new CGRect(5, y, Screenwidth, sTemp.Height);

                y = y + sTemp.Height + 10;
                //Console.WriteLine(y);

                //UITextView Heading1 = new UITextView();
                //Heading1.Frame = new CGRect(5, y+10, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                //Heading1.Text = "Uncork the Merriment";
                //Heading1.TextAlignment = UITextAlignment.Left;
                ////Heading1.TextAlignment = UITextAlignment.Justified;
                //Heading1.TextColor = UIColor.Black;
                //Heading1.Font = UIFont.FromName("Verdana-Bold", 20f);
                //Heading1.Editable = false;

                UITextView p1 = new UITextView();
                p1.Frame         = new CGRect(5, y, Screenwidth, UIScreen.MainScreen.Bounds.Height);
                p1.Text          = "“Wine is inspiring and adds greatly to the joy of living”-Napoleon Bonaparte.\n\n The Wine Outlet app was developed to deliver the complete wine experience of internationally acclaimed wines while easing the pressure in choosing an exceptional wine. Wine Outlet has partnered with the world’s number 1 wine dispensing and preservation system Enomatic, a self-serve system that provides customers with a try before you buy experience.";
                p1.TextColor     = UIColor.Black;
                p1.TextAlignment = UITextAlignment.Justified;
                p1.Font          = UIFont.FromName("Verdana", 13f);
                p1.Editable      = false;
                sTemp            = p1.SizeThatFits(sTemp);
                p1.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);
                y = y + sTemp.Height - 40;

                UITextView Heading2 = new UITextView();
                Heading2.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, 10);
                Heading2.Text          = "WHO WE ARE";
                Heading2.TextColor     = UIColor.Black;
                Heading2.TextAlignment = UITextAlignment.Justified;
                Heading2.Font          = UIFont.FromName("Verdana-Bold", 20f);
                Heading2.Editable      = false;
                sTemp          = Heading2.SizeThatFits(sTemp);
                Heading2.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);
                y = y + sTemp.Height;

                UITextView p2 = new UITextView();
                p2.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, 10);
                p2.Text  = "With the wide variety of assorted wines to sample from, Wine Outlet presents the perfect backdrop connecting wine lovers with the opportunity to try new wines before they buy. Our enticing VIP program allows customers an exclusive opportunity to sample for FREE from personally selected wines. Stocked with one of the" +
                           " largest selections throughout New Jersey, each Wine Outlet will " +
                           "be the perfect spot for both the novice and connoisseur.";
                p2.TextColor     = UIColor.Black;
                p2.TextAlignment = UITextAlignment.Justified;
                p2.Font          = UIFont.FromName("Verdana", 13f);
                p2.Editable      = false;
                sTemp            = p2.SizeThatFits(sTemp);
                p2.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 180;
                UITextView Heading3 = new UITextView();
                Heading3.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                Heading3.Text          = "WHAT WE OFFER";
                Heading3.TextAlignment = UITextAlignment.Justified;
                Heading3.TextColor     = UIColor.Black;
                Heading3.Font          = UIFont.FromName("Verdana-Bold", 20f);
                Heading3.Editable      = false;
                Heading3.TextAlignment = UITextAlignment.Left;
                sTemp          = Heading3.SizeThatFits(sTemp);
                Heading3.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 30;
                UITextView p3 = new UITextView();
                p3.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                p3.Text          = "We offer an experience of enjoyment. Upon the authentication, our exciting mobile application, Wine Outlet, takes our privileged customers to the virtual vineyard of savors and flavors, through the following options:  \n\nPick the Choice: Guest users also can see all the available wines for tasting.\n\n My Tasting: See the list of wines you have tasted. \n\n My Reviews: View your ratings and reviews and let other wine lovers explore it along with you.\n\n My Favorites: Pick your favorites and we send you customized notifications when there are any discounts or available for wine tasting.\n\n My Profile: Protect your credentials and update it as and when you wish.";
                p3.TextColor     = UIColor.Black;
                p3.TextAlignment = UITextAlignment.Justified;
                p3.Font          = UIFont.FromName("Verdana", 13f);
                p3.Editable      = false;
                sTemp            = p3.SizeThatFits(sTemp);
                p3.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 450;
                UITextView p4 = new UITextView();
                p4.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                p4.Text          = "RATE AND REVIEW";
                p4.TextColor     = UIColor.Black;
                p4.TextAlignment = UITextAlignment.Justified;
                p4.Font          = UIFont.FromName("Verdana-Bold", 20f);
                p4.Editable      = false;
                p4.TextAlignment = UITextAlignment.Left;
                sTemp            = p4.SizeThatFits(sTemp);
                p4.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 20;
                UITextView p5 = new UITextView();
                p5.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                p5.Text          = "Please provide rating and review for your favorite wine. Wine Outlet app displays the average rating and the individual rating of the users.";
                p5.TextColor     = UIColor.Black;
                p5.TextAlignment = UITextAlignment.Justified;
                p5.Font          = UIFont.FromName("Verdana", 13f);
                p5.Editable      = false;
                sTemp            = p5.SizeThatFits(sTemp);
                p5.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                //y = y + sTemp.Height-10;
                //UITextView p6 = new UITextView();
                //p6.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                //p6.Text = "Rate and Review is the spot for rating your favorite wine and Wine outlet displays the average rating and the individual rating of the users.";
                //p5.TextColor = UIColor.Black;
                //p6.Font = UIFont.FromName("Verdana", 13f);
                //p6.Editable = false;
                //p6.TextAlignment = UITextAlignment.Justified;
                //sTemp = p6.SizeThatFits(sTemp);
                //p6.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 100;
                UITextView VersionText = new UITextView();
                VersionText.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                var ver = NSBundle.MainBundle.InfoDictionary["CFBundleVersion"];
                //MonoTouch.Constants.Version;
                //Console.WriteLine(ver);
                VersionText.Text          = "Version 1.4(" + ver + ").\nAll rights reserved.";
                VersionText.TextColor     = UIColor.Black;
                VersionText.Font          = UIFont.FromName("Verdana", 18f);
                VersionText.Editable      = false;
                VersionText.TextAlignment = UITextAlignment.Center;
                sTemp             = VersionText.SizeThatFits(sTemp);
                VersionText.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height;
                UITextView ContactUsText = new UITextView();
                ContactUsText.Frame         = new CGRect(5, y - 50, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                ContactUsText.Text          = "Click here to contact us";
                ContactUsText.TextColor     = UIColor.Purple;
                ContactUsText.Font          = UIFont.FromName("Verdana", 18f);
                ContactUsText.Editable      = false;
                ContactUsText.TextAlignment = UITextAlignment.Center;

                if (MFMailComposeViewController.CanSendMail)
                {
                    ContactUsText.UserInteractionEnabled = true;
                }
                else
                {
                    ContactUsText.UserInteractionEnabled = false;
                }

                //ContactUsText.ShouldInteractWithUrl += ContactUsText_ShouldInteractWithUrl;
                var tap = new UITapGestureRecognizer {
                    CancelsTouchesInView = false
                };
                tap.AddTarget(() =>
                {
                    mailController = new MFMailComposeViewController();
                    mailController.SetToRecipients(new string[] { "*****@*****.**" });
                    mailController.SetSubject("Feedback " + ver);
                    mailController.SetMessageBody("User info " + CurrentUser.RetreiveUserId().ToString(), true);
                    this.PresentViewController(mailController, true, null);
                    mailController.Finished += (object s, MFComposeResultEventArgs args) =>
                    {
                        args.Controller.DismissViewController(true, null);
                    };
                });
                //ContactUsText.UserInteractionEnabled = true;
                ContactUsText.AddGestureRecognizer(tap);

                nfloat h = 0;

                scrollView = new UIScrollView
                {
                    Frame            = new CGRect(0, 20, View.Frame.Width, View.Frame.Height),
                    ContentSize      = new CGSize(View.Frame.Width, View.Frame.Height),
                    BackgroundColor  = UIColor.White,
                    AutoresizingMask = UIViewAutoresizing.FlexibleHeight
                };


                scrollView.AddSubview(backgroud);
                //scrollView.AddSubview(Title1);
                scrollView.AddSubview(T1);
                scrollView.AddSubview(H1);
                //scrollView.AddSubview(Heading1);
                scrollView.AddSubview(p1);
                scrollView.AddSubview(Heading2);
                scrollView.AddSubview(p2);
                scrollView.AddSubview(Heading3);
                scrollView.AddSubview(p3);
                scrollView.AddSubview(p4);
                scrollView.AddSubview(p5);
                //scrollView.AddSubview(p6);
                scrollView.AddSubview(VersionText);
                scrollView.AddSubview(ContactUsText);

                //for (int i = 0; i < scrollView.Subviews.Length; i++)
                //{
                //	h = scrollView.Subviews[i].Frame.Size.Height + 370 + ScreenHeight;
                //}
                scrollView.ContentSize = new CGSize(UIScreen.MainScreen.Bounds.Width, y + 30);
                View = (scrollView);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
                //Console.WriteLine(ex.Message);
            }
        }
Exemplo n.º 8
0
        public override void ViewDidLoad()
        {
            try
            {
                base.ViewDidLoad();
                //LoggingClass.UploadLogs();
                CGSize sTemp = new CGSize(UIScreen.MainScreen.Bounds.Width, 100);
                LoggingClass.LogInfo("Entered into About View ", screen);
                nfloat ScreenHeight = UIScreen.MainScreen.Bounds.Height;
                nfloat Screenwidth  = UIScreen.MainScreen.Bounds.Width - 10;
                nfloat bckimgheight = (ScreenHeight - 100) / 3;
                bckimgheight = bckimgheight + 30;
                UIImageView backgroud = new UIImageView();
                backgroud.Frame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, bckimgheight);
                backgroud.Image = new UIImage("Images/aboutus.jpg");
                nfloat  y  = bckimgheight;
                UILabel T1 = new UILabel();
                T1.Frame         = new CGRect(0, y + 10, UIScreen.MainScreen.Bounds.Width - 20, 10);
                T1.Font          = UIFont.FromName("HelveticaNeue-Bold", 35f);
                T1.Text          = "Wine Hangouts";
                T1.TextColor     = UIColor.Purple;
                T1.TextAlignment = UITextAlignment.Center;
                sTemp            = T1.SizeThatFits(sTemp);
                T1.Frame         = new CGRect(0, y + 10, Screenwidth, sTemp.Height);


                y = y + T1.Frame.Height + 10;
                //Console.WriteLine(y);

                UILabel H1 = new UILabel();
                H1.Frame         = new CGRect(5, y, Screenwidth, 10);
                H1.Text          = "Uncork the Merriment";
                H1.TextAlignment = UITextAlignment.Left;
                H1.TextColor     = UIColor.Black;
                H1.Font          = UIFont.FromName("Verdana-Bold", 20f);
                sTemp            = H1.SizeThatFits(sTemp);
                H1.Frame         = new CGRect(5, y, Screenwidth, sTemp.Height);

                y = y + sTemp.Height + 10;
                //Console.WriteLine(y);

                //UITextView Heading1 = new UITextView();
                //Heading1.Frame = new CGRect(5, y+10, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                //Heading1.Text = "Uncork the Merriment";
                //Heading1.TextAlignment = UITextAlignment.Left;
                ////Heading1.TextAlignment = UITextAlignment.Justified;
                //Heading1.TextColor = UIColor.Black;
                //Heading1.Font = UIFont.FromName("Verdana-Bold", 20f);
                //Heading1.Editable = false;

                UITextView p1 = new UITextView();
                p1.Frame         = new CGRect(5, y, Screenwidth, UIScreen.MainScreen.Bounds.Height);
                p1.Text          = "A delicious bottled wine is the way to the perfect blend of joy. Wine Hangouts is thus,developed to facilitate the wine lovers to deliver a complete wine experience through the internationally acclaimed wines and beers. Sticking strict to the quality, Wine Hangouts brings in the best self-serve partners in the industry: Enomatic- The World’s #1Wine Dispenser and Wine Preservation System and iPoruIt – A revolutionary self-serve solution for beers, to elevate the merriment of our guests to the best.";
                p1.TextColor     = UIColor.Black;
                p1.TextAlignment = UITextAlignment.Justified;
                p1.Font          = UIFont.FromName("Verdana", 13f);
                p1.Editable      = false;
                sTemp            = p1.SizeThatFits(sTemp);
                p1.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);
                y = y + sTemp.Height - 40;

                UITextView Heading2 = new UITextView();
                Heading2.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, 10);
                Heading2.Text          = "WHO WE ARE";
                Heading2.TextColor     = UIColor.Black;
                Heading2.TextAlignment = UITextAlignment.Justified;
                Heading2.Font          = UIFont.FromName("Verdana-Bold", 20f);
                Heading2.Editable      = false;
                sTemp          = Heading2.SizeThatFits(sTemp);
                Heading2.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);
                y = y + sTemp.Height;

                UITextView p2 = new UITextView();
                p2.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, 10);
                p2.Text          = "Wine Hangouts ensures the perfect backdrop to relish and to hang out with the wine and beer lovers, through over 24 assorted wines from the world’s best wineries. Each of our wine outlets is assured with one of the largest inventories of wine you can experience in New Jersey. The exclusive opportunity for our privileged customers makes it more enticing by offering FREE tasting of the 24 wines out of our huge collection.So, isn’t it time for a Wine Dine?";
                p2.TextColor     = UIColor.Black;
                p2.TextAlignment = UITextAlignment.Justified;
                p2.Font          = UIFont.FromName("Verdana", 13f);
                p2.Editable      = false;
                sTemp            = p2.SizeThatFits(sTemp);
                p2.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 180;
                UITextView Heading3 = new UITextView();
                Heading3.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                Heading3.Text          = "WHAT WE OFFER";
                Heading3.TextAlignment = UITextAlignment.Justified;
                Heading3.TextColor     = UIColor.Black;
                Heading3.Font          = UIFont.FromName("Verdana-Bold", 20f);
                Heading3.Editable      = false;
                Heading3.TextAlignment = UITextAlignment.Left;
                sTemp          = Heading3.SizeThatFits(sTemp);
                Heading3.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 30;
                UITextView p3 = new UITextView();
                p3.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                p3.Text          = "We offer- not just the wines and beers, but an experience of enjoyment.Upon the credential authentication, the mobile application- Wine Hangout takes our privileged customers to the virtual vineyard of savors and flavors, through the following options:  \n\nPick the Choice: Guest is displayed with all the available wines for tasting.\n\n My Tasting: See the list of wines you have tasted and choose more from the remaining surprises.\n\n My Reviews: View your ratings and reviews and let other wine lovers explore it along with you.\n\n My Favorites: Pick your favorites and we save the list to send you customized notifications when there are any discounts or available for wine tasting.\n\n My Profile: Protect your credentials and update it as and when you wish.";
                p3.TextColor     = UIColor.Black;
                p3.TextAlignment = UITextAlignment.Justified;
                p3.Font          = UIFont.FromName("Verdana", 13f);
                p3.Editable      = false;
                sTemp            = p3.SizeThatFits(sTemp);
                p3.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 470;
                UITextView p4 = new UITextView();
                p4.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                p4.Text          = "RATE AND REVIEW";
                p4.TextColor     = UIColor.Black;
                p4.TextAlignment = UITextAlignment.Justified;
                p4.Font          = UIFont.FromName("Verdana-Bold", 20f);
                p4.Editable      = false;
                p4.TextAlignment = UITextAlignment.Left;
                sTemp            = p4.SizeThatFits(sTemp);
                p4.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 20;
                UITextView p5 = new UITextView();
                p5.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                p5.Text          = "Please provide rating and review for your favorite wine. Wine Hangouts app displays the average rating and the individual rating of the users.";
                p5.TextColor     = UIColor.Black;
                p5.TextAlignment = UITextAlignment.Justified;
                p5.Font          = UIFont.FromName("Verdana", 13f);
                p5.Editable      = false;
                sTemp            = p5.SizeThatFits(sTemp);
                p5.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                //y = y + sTemp.Height-10;
                //UITextView p6 = new UITextView();
                //p6.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                //p6.Text = "Rate and Review is the spot for rating your favorite wine and Wine Hangouts displays the average rating and the individual rating of the users.";
                //p5.TextColor = UIColor.Black;
                //p6.Font = UIFont.FromName("Verdana", 13f);
                //p6.Editable = false;
                //p6.TextAlignment = UITextAlignment.Justified;
                //sTemp = p6.SizeThatFits(sTemp);
                //p6.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 100;
                UITextView VersionText = new UITextView();
                VersionText.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                var ver = NSBundle.MainBundle.InfoDictionary["CFBundleVersion"];
                //MonoTouch.Constants.Version;
                //Console.WriteLine(ver);
                VersionText.Text          = "Version 1.17(" + ver + ").\nAll rights reserved.\n Reach us at";
                VersionText.TextColor     = UIColor.Black;
                VersionText.Font          = UIFont.FromName("Verdana", 18f);
                VersionText.Editable      = false;
                VersionText.TextAlignment = UITextAlignment.Center;
                sTemp             = VersionText.SizeThatFits(sTemp);
                VersionText.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height;
                UITextView ContactUsText = new UITextView();
                ContactUsText.Frame         = new CGRect(5, y - 50, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                ContactUsText.Text          = "*****@*****.**";
                ContactUsText.TextColor     = UIColor.Purple;
                ContactUsText.Font          = UIFont.FromName("Verdana", 18f);
                ContactUsText.Editable      = false;
                ContactUsText.TextAlignment = UITextAlignment.Center;

                if (MFMailComposeViewController.CanSendMail)
                {
                    ContactUsText.UserInteractionEnabled = true;
                }
                else
                {
                    ContactUsText.UserInteractionEnabled = false;
                }

                //ContactUsText.ShouldInteractWithUrl += ContactUsText_ShouldInteractWithUrl;
                var tap = new UITapGestureRecognizer {
                    CancelsTouchesInView = false
                };
                tap.AddTarget(() =>
                {
                    mailController = new MFMailComposeViewController();
                    mailController.SetToRecipients(new string[] { "*****@*****.**" });
                    mailController.SetSubject("Feedback " + ver);
                    mailController.SetMessageBody("User info " + CurrentUser.RetreiveUserId().ToString(), true);
                    this.PresentViewController(mailController, true, null);
                    mailController.Finished += (object s, MFComposeResultEventArgs args) =>
                    {
                        args.Controller.DismissViewController(true, null);
                    };
                });
                //ContactUsText.UserInteractionEnabled = true;
                ContactUsText.AddGestureRecognizer(tap);

                nfloat h = 0;

                scrollView = new UIScrollView
                {
                    Frame            = new CGRect(0, 20, View.Frame.Width, View.Frame.Height),
                    ContentSize      = new CGSize(View.Frame.Width, View.Frame.Height),
                    BackgroundColor  = UIColor.White,
                    AutoresizingMask = UIViewAutoresizing.FlexibleHeight
                };


                scrollView.AddSubview(backgroud);
                //scrollView.AddSubview(Title1);
                scrollView.AddSubview(T1);
                scrollView.AddSubview(H1);
                //scrollView.AddSubview(Heading1);
                scrollView.AddSubview(p1);
                scrollView.AddSubview(Heading2);
                scrollView.AddSubview(p2);
                scrollView.AddSubview(Heading3);
                scrollView.AddSubview(p3);
                scrollView.AddSubview(p4);
                scrollView.AddSubview(p5);
                //scrollView.AddSubview(p6);
                scrollView.AddSubview(VersionText);
                scrollView.AddSubview(ContactUsText);

                //for (int i = 0; i < scrollView.Subviews.Length; i++)
                //{
                //	h = scrollView.Subviews[i].Frame.Size.Height + 370 + ScreenHeight;
                //}
                scrollView.ContentSize = new CGSize(UIScreen.MainScreen.Bounds.Width, y + 30);
                View = (scrollView);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
                //Console.WriteLine(ex.Message);
            }
        }