예제 #1
0
        protected override void OnShown(EventArgs e)
        {
            _loadingOverlay = LoadingOverlay.PutOn(this);
            _loadingOverlay.CancelRequested += LoadingOverlay_CancelRequested;

            _overlays = new Dictionary <OverlayState, Control>();
            _overlays[OverlayState.Empty]   = EmptyOverlay.PutOn(this);
            _overlays[OverlayState.Loading] = _loadingOverlay;
            var recordingOverlay = RecordingOverlay.PutOn(this);

            recordingOverlay.StopRequested   += btnRecord_Click;
            _overlays[OverlayState.Recording] = recordingOverlay;

            _overlays[OverlayState.Empty].SendToBack();
            _overlays[OverlayState.Loading].BringToFront();
            _overlays[OverlayState.Recording].BringToFront();

            _updateTimer = new System.Threading.Timer(async state => await CheckForUpdatesAsync(), null, 5000, Timeout.Infinite);

            _parser = new LogFileParser(new LogItemParser(), new FileReader(), null)
            {
                Progress = (current, total) => _loadingOverlay.SetProgress(current, total)
            };

            Text = GetAppNameWithVersion();

            base.OnShown(e);

            SetControlVisiblityByContext();
            SetOverlayState(OverlayState.Empty);

            ShowSocialFlyout();
        }
예제 #2
0
        protected override void OnShown(EventArgs e)
        {
            _loadingOverlay = LoadingOverlay.PutOn(this);
            _loadingOverlay.CancelRequested += LoadingOverlay_CancelRequested;

            _overlays = new Dictionary <OverlayState, Control>();
            _overlays[OverlayState.Empty]   = EmptyOverlay.PutOn(this);
            _overlays[OverlayState.Loading] = _loadingOverlay;
            var recordingOverlay = RecordingOverlay.PutOn(this);

            recordingOverlay.StopRequested   += btnRecord_Click;
            _overlays[OverlayState.Recording] = recordingOverlay;

            _overlays[OverlayState.Empty].SendToBack();
            _overlays[OverlayState.Loading].BringToFront();
            _overlays[OverlayState.Recording].BringToFront();

            _updateTimer = new System.Threading.Timer(async state => await CheckForUpdatesAsync(), null, 5000, Timeout.Infinite);

            _parser = new LogFileParser(new LogItemParser(), new FileReader(), null)
            {
                Progress = (current, total) => _loadingOverlay.SetProgress(current, total)
            };

            var name = this.GetType().Assembly.GetName();

            Text = $"{name.Name} {name.Version.Major}.{name.Version.Minor}" + (name.Version.Build == 0 ? "" : $".{name.Version.Build}");

            base.OnShown(e);

            SetControlVisiblityByContext();
            SetOverlayState(OverlayState.Empty);
        }
예제 #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (EmptyOverlay.ShowIfRequired(ref emptyOverlay, newsEntry, View, "No news selected", EmptyOverlayType.News))
            {
                return;
            }

            webView.ShouldStartLoad =
                delegate(UIWebView webViewParam, NSUrlRequest request, UIWebViewNavigationType navigationType) {
                // view links in a new 'webbrowser' window like about, session & twitter
                if (navigationType == UIWebViewNavigationType.LinkClicked)
                {
                    if (AppDelegate.IsPhone)
                    {
                        this.NavigationController.PushViewController(new WebViewController(request), true);
                    }
                    else
                    {
                        this.PresentModalViewController(new WebViewController(request), true);
                    }
                    return(false);
                }
                return(true);
            };
        }
예제 #4
0
        public override void LayoutSubviews()
        {
            if (EmptyOverlay.ShowIfRequired(ref emptyOverlay, showSpeaker, this, "No speaker info", EmptyOverlayType.Speaker))
            {
                return;
            }

            var full     = Bounds;
            var bigFrame = full;

            bigFrame.X      = ImageSpace + 13 + 17;
            bigFrame.Y      = y + 27;        // 15 -> 13
            bigFrame.Height = 26;
            bigFrame.Width -= (ImageSpace + 13 + 17);
            nameLabel.Frame = bigFrame;

            var smallFrame = full;

            smallFrame.X      = ImageSpace + 13 + 17;
            smallFrame.Y      = y + 27 + 26;
            smallFrame.Height = 15;             // 12 -> 15
            smallFrame.Width -= (ImageSpace + 13 + 17);
            titleLabel.Frame  = smallFrame;

            smallFrame.Y      += y + 17;
            companyLabel.Frame = smallFrame;

            image.Frame = new CGRect(13, y + 15, 80, 80);

            if (!String.IsNullOrEmpty(showSpeaker.Bio))
            {
                if (AppDelegate.IsPhone)
                {
                    // for now, hardcode iPhone dimensions to reduce regressions
                    CGSize size = UIStringDrawing.StringSize(showSpeaker.Bio
                                                             , bioTextView.Font
                                                             , new SizeF(310, 580)
                                                             , UILineBreakMode.WordWrap);
                    bioTextView.Frame = new CGRect(5, y + 115, 310, size.Height);
                }
                else
                {
                    var f = new CGSize(full.Width - 13 * 2, full.Height - (image.Frame.Y + 80 + 20));
//					SizeF size = bioTextView.StringSize (showSpeaker.Bio
//										, bioTextView.Font
//										, f
//										, UILineBreakMode.WordWrap);
                    bioTextView.Frame = new CGRect(5, image.Frame.Y + 80 + 10
                                                   , f.Width
                                                   , f.Height);
                }
            }
            else
            {
                bioTextView.Frame = new CGRect(5, y + 115, 310, 30);
            }
        }
예제 #5
0
        public override void LayoutSubviews()
        {
            if (EmptyOverlay.ShowIfRequired(ref this.emptyOverlay, this.patient, this, "No Patient info", EmptyOverlayType.Speaker))
            {
                return;
            }

            this.LayoutImage();
            this.LayoutNameLabel();
            this.LayoutDateOfBirth();
        }
        void LayoutSubviews()
        {
            if (EmptyOverlay.ShowIfRequired(ref emptyOverlay, tweet, this.View
                                            , "No tweet selected", EmptyOverlayType.Twitter))
            {
                return;
            }

            image.Frame        = new CGRect(8, 8, 48, 48);
            user.Frame         = new CGRect(69, 14, 239, 24);
            handle.Frame       = new CGRect(69, 39, 239, 20);        //14
            handleButton.Frame = new CGRect(69, 14, 239, 40);        // over the two display fields
            date.Frame         = new CGRect(69, 55, 80, 15);
            webView.Frame      = new CGRect(0, 75, 320, 440 - 75);
        }
        void LayoutSubviews()
        {
            if (EmptyOverlay.ShowIfRequired(ref emptyOverlay, userGroup, View, "No exhibitor selected", EmptyOverlayType.Exhibitor))
            {
                return;
            }
//			if (exhibitor == null) {
//				if (emptyOverlay == null) {
//					emptyOverlay = new EmptyOverlay(View.Bounds, "No exhibitor selected");
//					View.AddSubview (emptyOverlay);
//				}
//				return;
//			} else{
//				if (emptyOverlay != null) {
//					emptyOverlay.RemoveFromSuperview ();
//					emptyOverlay = null;
//				}
//			}
            var full     = View.Bounds;
            var bigFrame = full;

            bigFrame.X      = imageSpace + 13 + 17;
            bigFrame.Y      = 27;        // 15 -> 13
            bigFrame.Height = 26;
            bigFrame.Width -= (imageSpace + 13 + 17);
            nameLabel.Frame = bigFrame;

            var smallFrame = full;

            smallFrame.X      = imageSpace + 13 + 17;
            smallFrame.Y      = 27 + 26;
            smallFrame.Height = 15;             // 12 -> 15
            smallFrame.Width -= (imageSpace + 13 + 17);
            //addressLabel.Frame = smallFrame;

            smallFrame.Y += 17;
            //locationLabel.Frame = smallFrame;

            image.Frame = new RectangleF(13, 15, 80, 80);

            if (AppDelegate.IsPhone)
            {
                scrollView.Frame = full;


                var   f    = new SizeF(full.Width - 13 * 2, 4000);
                SizeF size = descriptionTextView.StringSize(userGroup.Overview
                                                            , descriptionTextView.Font
                                                            , f);
                descriptionTextView.Frame = new RectangleF(5
                                                           , 115
                                                           , f.Width
                                                           , size.Height + 20);                      // doesn't seem to measure properly... CR/LF issues?

                descriptionTextView.ScrollEnabled = true;

                scrollView.ContentSize = new SizeF(320, descriptionTextView.Frame.Y + descriptionTextView.Frame.Height + 10);


                descriptionTextView.Frame = new RectangleF(10, 115, 300, f.Height);
            }
            else
            {
                // IsPad
                descriptionTextView.Frame = new RectangleF(10, 115, 400, 900);
                //_descriptionTextView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            }
        }
예제 #8
0
        public override void LayoutSubviews()
        {
            if (EmptyOverlay.ShowIfRequired(ref emptyOverlay, showSession, this, "No session info", EmptyOverlayType.Session))
            {
                return;
            }

            var full = Bounds;

            if (AppDelegate.IsPad)
            {
                toolbar.Frame = new CGRect(0, 0, this.Bounds.Width, 40);
            }

            int    sideMargin = 13, topMargin = 10;
            CGSize titleSize = UIStringDrawing.StringSize(showSession.Title
                                                          , UIFont.FromName("Helvetica-Light", AppDelegate.Font16pt)
                                                          , new CGSize(full.Width - sideMargin, 400), UILineBreakMode.WordWrap);
            // Session.Title
            var titleFrame = full;

            titleFrame.X      = sideMargin;
            titleFrame.Y      = y + topMargin;
            titleFrame.Height = titleSize.Height;
            titleFrame.Width -= (sideMargin * 2);
            titleLabel.Frame  = titleFrame;
            // Session.StartTime, EndTime
            var timeFrame = full;

            timeFrame.X      = sideMargin;
            timeFrame.Y      = y + 15 + titleFrame.Height;
            timeFrame.Height = 15;
            timeFrame.Width -= (sideMargin * 2);
            timeLabel.Frame  = timeFrame;
            // Session.Room
            timeFrame.Y         = timeLabel.Frame.Y + timeLabel.Frame.Height + 10;
            locationLabel.Frame = timeFrame;
            // Session.IsFavorite ~ star (favorites) button
            button.Frame = new CGRect(full.Width - buttonSpace - 15
                                      , y + topMargin + titleLabel.Frame.Height
                                      , buttonSpace
                                      , buttonSpace); // just under the title, right of the small text
            // Session.Overview
            // Now determine how big the Overview text is, and adjust sizes accordingly
            // iPad requires scrolling of the TextView
            // iPhone requires the TextView to be expanded to encompass all text
            if (!String.IsNullOrEmpty(showSession.Overview))
            {
                if (AppDelegate.IsPad)
                {
                    var f = new CGSize(full.Width - sideMargin * 2, full.Height - (locationLabel.Frame.Y + 20));
                    descriptionTextView.Frame         = new CGRect(5, locationLabel.Frame.Y + 15, f.Width, f.Height);
                    descriptionTextView.ScrollEnabled = true;
                }
                else
                {
                    var    f    = new CGSize(290, 4000);
                    CGSize size = UIStringDrawing.StringSize(showSession.Overview
                                                             , descriptionTextView.Font
                                                             , f);                    //, UILineBreakMode.WordWrap);
                    descriptionTextView.Frame = new CGRect(5
                                                           , locationLabel.Frame.Y + 15
                                                           , size.Width + 10                      // hack: measure seems to underestimate
                                                           , size.Height + 50);
                    // going to scroll the whole thing!
                    descriptionTextView.ScrollEnabled = false;
                }
            }
            else
            {
                descriptionTextView.Frame = new CGRect(5, locationLabel.Frame.Y + 15, full.Width - sideMargin * 2, 30);
            }

            nfloat bottomOfTheseControls = descriptionTextView.Frame.Y + descriptionTextView.Frame.Height;

            // now add the Session.Speakers table underneath (if there _are_ speakers)
            // iPad fixes it to the bottom, and makes the Overview TextView smaller (View height is constant)
            // iPhone adds it to the bottom, and makes the View itself longer to fit
            if (shouldShowSpeakers && showSession.Speakers != null && showSession.Speakers.Count > 0)
            {
                CGRect frame;
                if (AppDelegate.IsPhone)
                {
                    frame = new CGRect(5
                                       , bottomOfTheseControls
                                       , 310
                                       , showSession.Speakers.Count * 40 + 60); // plus 40 for header
                }
                else                                                            // IsPad, fixed height
                {
                    frame = new CGRect(5
                                       , full.Height - 40 - (showSession.Speakers.Count * 40) - 5                // 5 is for margin
                                       , 310
                                       , showSession.Speakers.Count * 40 + 60);                                  // plus 40 for header
                }

                if (speakerTable == null)
                {
                    speakerTable = new UITableView(frame, UITableViewStyle.Grouped);
                    speakerTable.BackgroundColor = UIColor.White;
                    var whiteView = new UIView();
                    whiteView.BackgroundColor   = UIColor.White;
                    speakerTable.BackgroundView = whiteView;
                    speakerTable.ScrollEnabled  = false;
                    AddSubview(speakerTable);
                }
                speakerTable.Frame  = frame;
                speakerTable.Source = new SpeakersTableSource(showSession.Speakers, this);

                if (AppDelegate.IsPad)                   // shrink the overview to accomodate speakers
                {
                    var df = descriptionTextView.Frame;
                    df.Height = df.Height - 40 - (showSession.Speakers.Count * 40) - 5;                     // 5 is for margin
                    descriptionTextView.Frame = df;

                    // set the highlight for whatever speaker is showing in the other column (only iPad, obviously)
                    if (speakerTable.IndexPathForSelectedRow == null)
                    {
                        speakerTable.SelectRow(NSIndexPath.FromRowSection(0, 0), true, UITableViewScrollPosition.Top);
                    }
                    else
                    {
                        speakerTable.SelectRow(speakerTable.IndexPathForSelectedRow, true, UITableViewScrollPosition.Top);
                    }
                }
                else                                                                                       // extend the Frame to encompass the speakers table
                {
                    Frame = new CGRect(0, 0, 320, bottomOfTheseControls + speakerTable.Frame.Height + 20); // 10 margin top & bottom
                }
            }
            else                 // there are NO speakers, remove the table if it exists
            {
                if (speakerTable != null)
                {
                    speakerTable.RemoveFromSuperview();
                    speakerTable.Dispose();
                    speakerTable = null;
                }
                if (AppDelegate.IsPhone)
                {
                    Frame = new CGRect(0, 0, 320, bottomOfTheseControls);
                }
            }

            if (AppDelegate.IsPhone && Bounds.Size.Height < 370)
            {
                // if the view is smaller than the display area, enlarge it to fit snugly
                Frame = new CGRect(0, 0, 320, 370);
            }
        }