Exemple #1
0
        public override void ViewDidLoad()
        {
            try {
                TitleLabel.Text = "CHOOSE EMAIL";
                TitleLabel.Font = Theme.HugeFont;

                //View.BackgroundColor = UIColor.Yellow;

                var items = new List <LcarsDef> ();

                var a      = new MonoTouch.AddressBook.ABAddressBook();
                var people = a.GetPeople();
                foreach (var p in people)
                {
                    var emails = p.GetEmails();

                    foreach (var e in emails)
                    {
                        var def = new LcarsDef();

                        var addr = e.Value;

                        def.Caption = addr;
                        def.Command = delegate { Choose(addr); };
                        items.Add(def);
                    }
                }

                var y = TitleLabel.Frame.Bottom + App.Inst.LabelGap;
                _select = new SelectItem(items, new RectangleF(TitleLabel.Frame.Left, y, View.Frame.Width, View.Frame.Height - y));
                View.AddSubview(_select);
            } catch (Exception error) {
                Log.Error(error);
            }
        }
Exemple #2
0
        public override void ViewDidLoad()
        {
            try {
                TitleLabel.Text = "CHOOSE EMAIL";
                TitleLabel.Font = Theme.HugeFont;

                //View.BackgroundColor = UIColor.Yellow;

                var items = new List<LcarsDef> ();

                var a = new MonoTouch.AddressBook.ABAddressBook ();
                var people = a.GetPeople ();
                foreach (var p in people) {

                    var emails = p.GetEmails ();

                    foreach (var e in emails) {
                        var def = new LcarsDef ();

                        var addr = e.Value;

                        def.Caption = addr;
                        def.Command = delegate { Choose (addr); };
                        items.Add (def);
                    }
                }

                var y = TitleLabel.Frame.Bottom + App.Inst.LabelGap;
                _select = new SelectItem (items, new RectangleF (TitleLabel.Frame.Left, y, View.Frame.Width, View.Frame.Height - y));
                View.AddSubview (_select);
            } catch (Exception error) {
                Log.Error (error);
            }
        }
Exemple #3
0
 public void Initialize()
 {
     Def             = new LcarsDef();
     Width           = Frame.Width;
     Height          = Frame.Height;
     Shape           = LcarsShape.Left;
     Padding         = 1;
     Font            = Theme.ComponentFont;
     ContentMode     = UIViewContentMode.Redraw;
     BackgroundColor = UIColor.Clear;
 }
Exemple #4
0
 public void UpdateWith(LcarsDef other)
 {
     if (other == null)
     {
         return;
     }
     Caption        = other.Caption;
     ComponentType  = other.ComponentType;
     NeedsDoubleTap = other.NeedsDoubleTap;
     IsCommandable  = other.IsCommandable;
     Command        = other.Command;
 }
Exemple #5
0
        public void UpdateWith(UIInfo other)
        {
            ScreenTitle = other.ScreenTitle;

            Up(other, i => i.BottomLeft, d => { this.BottomLeft = d; });
            Up(other, i => i.MainRel, d => { this.MainRel = d; });
            Up(other, i => i.MainTop, d => { this.MainTop = d; });
            Up(other, i => i.MainFill, d => { this.MainFill = d; });
            Up(other, i => i.TopLeft, d => { this.TopLeft = d; });
            Up(other, i => i.TopMisc, d => { this.TopMisc = d; });
            Up(other, i => i.MiscBtn, d => { this.MiscBtn = d; });
            Up(other, i => i.MainSec, d => { this.MainSec = d; });

            if (other.CommandButtons != null)
            {
                CommandButtons = other.CommandButtons;
            }
        }
Exemple #6
0
        public override void ViewDidLoad()
        {
            try {
                TitleLabel.Font = Theme.HugeFont;
                sourceTypes = SourceTypes.All;

                var items = new List<LcarsDef> ();
                foreach (var sourceType in sourceTypes) {
                    var t = sourceType;
                    var def = new LcarsDef ();

                    def.Caption = SourceTypes.GetTitle (t);
                    def.Command = delegate { Choose (t); };
                    items.Add (def);
                }

                var y = TitleLabel.Frame.Bottom + App.Inst.LabelGap;
                _select = new SelectItem (items, new RectangleF (TitleLabel.Frame.Left, y, View.Frame.Width, View.Frame.Height - y));
                View.AddSubview (_select);
            } catch (Exception error) {
                Log.Error (error);
            }
        }
Exemple #7
0
        public override void ViewDidLoad()
        {
            try {
                TitleLabel.Font = Theme.HugeFont;
                sourceTypes     = SourceTypes.All;

                var items = new List <LcarsDef> ();
                foreach (var sourceType in sourceTypes)
                {
                    var t   = sourceType;
                    var def = new LcarsDef();

                    def.Caption = SourceTypes.GetTitle(t);
                    def.Command = delegate { Choose(t); };
                    items.Add(def);
                }

                var y = TitleLabel.Frame.Bottom + App.Inst.LabelGap;
                _select = new SelectItem(items, new RectangleF(TitleLabel.Frame.Left, y, View.Frame.Width, View.Frame.Height - y));
                View.AddSubview(_select);
            } catch (Exception error) {
                Log.Error(error);
            }
        }
Exemple #8
0
 public void UpdateWith(LcarsDef other)
 {
     if (other == null)
         return;
     Caption = other.Caption;
     ComponentType = other.ComponentType;
     NeedsDoubleTap = other.NeedsDoubleTap;
     IsCommandable = other.IsCommandable;
     Command = other.Command;
 }
Exemple #9
0
 public void Initialize()
 {
     Def = new LcarsDef ();
     Width = Frame.Width;
     Height = Frame.Height;
     Shape = LcarsShape.Left;
     Padding = 1;
     Font = Theme.ComponentFont;
     ContentMode = UIViewContentMode.Redraw;
     BackgroundColor = UIColor.Clear;
 }
Exemple #10
0
        public void SetSources(params Source[] sources)
        {
            QuerySources = sources;

            SourceType = QuerySources.Length > 0 ? QuerySources[0].GetType() : typeof(News);

            //
            // Buttons to get to related sources
            //
            var allSources = new Source[0];

            if (QuerySources != null && QuerySources.Length > 0)
            {
                allSources = Repo.Foreground.GetActiveSources(SourceType).OrderBy(s => s.GetDistinguisher()).ToArray();
            }
            var n       = allSources.Length;
            var buttons = new LcarsDef[n];

            for (int i = 0; i < n; i++)
            {
                var s = allSources[i];
                var b = new LcarsDef();
                b.Caption = s.GetShortDistinguisher().ToUpperInvariant();

                b.ComponentType = PossibleTypes[s.Id % PossibleTypes.Length];

                b.Command = delegate { App.Inst.ShowSourceMessages(s); };

                buttons[i] = b;
            }

            Info.CommandButtons = buttons;

            Info.MainTop.Caption = "ADD " + SourceTypes.GetTitle(SourceType);
            if (sources.Length == 1)
            {
                Info.MiscBtn.ComponentType = LcarsComponentType.DisplayFunction;
                if (App.Inst.IsIPad)
                {
                    Info.MiscBtn.Caption = "REMOVE " + sources[0].GetShortDistinguisher().TruncateWords(15).ToUpperInvariant();
                }
                else
                {
                    Info.MiscBtn.Caption = "REMOVE";
                }
                Info.MiscBtn.IsCommandable = true;
            }
            else
            {
                Info.MiscBtn.ComponentType = LcarsComponentType.Static;
                Info.MiscBtn.Caption       = "";
                Info.MiscBtn.IsCommandable = false;
            }

            UpdateTitle();

            if (!_showingData && QuerySources.Length > 1 && PlayAnimation)
            {
                _scanner = new ScanningView(new RectangleF(0, 20, View.Frame.Width, View.Frame.Height - 20));
                _scanner.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
                _scanner.Alpha            = 0;
                _scanner.StartScanning();
                View.AddSubview(_scanner);
                UIView.BeginAnimations("RetFadeIn");
                _scanner.Alpha = 1;
                UIView.CommitAnimations();

                _showingData = true;
            }

            RefreshMessages();
        }