Beispiel #1
0
 public static ScanningView Start(UIView View, RectangleF frame)
 {
     var _scanner = new ScanningView (frame);
     _scanner.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
     _scanner.Alpha = 0;
     _scanner.StartScanning ();
     View.AddSubview (_scanner);
     UIView.BeginAnimations ("RetFadeIn");
     _scanner.Alpha = 1;
     UIView.CommitAnimations ();
     return _scanner;
 }
Beispiel #2
0
        public static ScanningView Start(UIView View, RectangleF frame)
        {
            var _scanner = new ScanningView(frame);

            _scanner.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            _scanner.Alpha            = 0;
            _scanner.StartScanning();
            View.AddSubview(_scanner);
            UIView.BeginAnimations("RetFadeIn");
            _scanner.Alpha = 1;
            UIView.CommitAnimations();
            return(_scanner);
        }
Beispiel #3
0
        void RefreshMessagesInBackground()
        {
            var messages = new MessageRef[0];

            using (var repo = new Repo()) {
                if (QuerySources != null && QuerySources.Length > 0)
                {
                    var ms = new List <MessageRef> ();
                    foreach (var src in QuerySources)
                    {
                        SourceType = src.GetType();
                        ms.AddRange(repo.GetRecentMessages(src));
                    }
                    ms.Sort((a, b) => b.PublishTime.CompareTo(a.PublishTime));
                    messages = ms.ToArray();
                    if (App.Inst.IsSimulator)
                    {
                        Thread.Sleep(TimeSpan.FromSeconds(new Random().NextDouble() * 2));
                    }
                }
            }

            App.RunUI(delegate {
                var ms      = TheMessages;
                TheMessages = messages;

                var changed = ms == null || (ms.Length != messages.Length);

                if (_scanner != null)
                {
                    _scanner.StopScanning();

                    UIView.BeginAnimations("RetFadeIn");
                    _scanner.Alpha = 0;
                    UIView.CommitAnimations();

                    NSTimer.CreateScheduledTimer(TimeSpan.FromMilliseconds(30), delegate { Sounds.PlayDataFound(); });
                    NSTimer.CreateScheduledTimer(TimeSpan.FromMilliseconds(250), delegate {
                        if (_scanner != null)
                        {
                            _scanner.RemoveFromSuperview();
                            _scanner = null;
                        }
                    });
                }

                RefreshMessagesUI(changed);
            });
        }
Beispiel #4
0
        public FacebookAddUI()
        {
            _s   = null;
            _web = new UIWebView();

            KillCookies();

            Frame                 = new RectangleF(PointF.Empty, new SizeF(200, 200));
            _web.Frame            = new RectangleF(PointF.Empty, Frame.Size);
            _web.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            //_web.ScalesPageToFit = true;
            _web.Delegate = new Del(this);
            ClipsToBounds = true;
            _web.Hidden   = true;

            Theme.MakeBlack(_web);

            _scanner = ScanningView.Start(this, _web.Frame);

            AddSubview(_web);
        }
Beispiel #5
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();
        }
Beispiel #6
0
        public TwitterAddUI()
        {
            _s = null;
            _web = new UIWebView ();

            KillCookies ();

            Frame = new RectangleF (PointF.Empty, new SizeF (200, 200));
            _web.Frame = new RectangleF (PointF.Empty, Frame.Size);
            _web.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            _web.ScalesPageToFit = true;
            _web.Delegate = new Del (this);
            _web.MultipleTouchEnabled = true;
            ClipsToBounds = true;
            _web.Hidden = true;

            Theme.MakeBlack (_web);

            _scanner = ScanningView.Start (this, _web.Frame);

            AddSubview (_web);
        }