Esempio n. 1
0
        public override void ViewDidLoad()
        {
            try {
                Info = new UIInfo();

                TextBox.MultipleTouchEnabled = true;

                CompWidth = CloseBtn.Frame.Width;
                if (!App.Inst.IsIPad)
                {
                    CompWidth *= 0.75f;
                }

                wdel                         = new MessageReader.WDel(this);
                TextBox.Delegate             = wdel;
                TextBox.MultipleTouchEnabled = true;

                OriginalBtn.Def.Caption          = "ORIGINAL";
                OriginalBtn.Def.ComponentType    = LcarsComponentType.NavigationFunction;
                OriginalBtn.Def.PlayCommandSound = delegate {
                    if (Message != null && !string.IsNullOrEmpty(Message.Url))
                    {
                        Sounds.PlayDataRetrieval();
                    }
                    else
                    {
                        Sounds.PlayNotAllowed();
                    }
                };
                OriginalBtn.Def.Command = delegate { ToggleOriginal(); };

                ShareBtn.Def.ComponentType = LcarsComponentType.PrimaryFunction;
                ShareBtn.Def.Caption       = "SHARE";
                ShareBtn.Def.Command       = delegate {
                    if (Message == null)
                    {
                        return;
                    }
                    var s = new ShareView();
                    s.Message = Message;
                    App.Inst.ShowDialog(s);
                };

                Filler                   = new LcarsComp();
                Filler.Frame             = new RectangleF(ShareBtn.Frame.Left, ShareBtn.Frame.Bottom, ShareBtn.Frame.Width, 0);
                Filler.Def.ComponentType = LcarsComponentType.Static;
                Filler.Hidden            = true;
                View.AddSubview(Filler);

                TextBox.Layer.CornerRadius = 10;


                CloseBtn.Def.Caption       = "CLOSE";
                CloseBtn.Def.ComponentType = LcarsComponentType.DisplayFunction;
                CloseBtn.Def.Command       = delegate { App.Inst.CloseSubView(true); };

                RelativeComp.Def.ComponentType = LcarsComponentType.SystemFunction;
                RelativeComp.Width             = CloseBtn.Width;
                RelativeComp.Shape             = LcarsShape.TopRight;
                RelativeComp.Height            = Theme.HorizontalBarHeight;
                RelativeComp.Def.Command       = delegate {
                    var full = App.Inst.ToggleSubViewFullScreen(true);
                    RelativeComp.Def.Caption = full ? "MIN" : "MAX";
                    DoLayout(full);
                    RelativeComp.SetNeedsDisplay();
                };
                RelativeComp.Def.Caption = "MAX";

                TopBtn.Def.ComponentType = LcarsComponentType.MiscFunction;
                TopBtn.Def.Caption       = "PREV";
                TopBtn.Def.Command       = delegate { App.Inst.GotoNextMessage(Message, -1); };

                BottomBtn.Def.ComponentType = LcarsComponentType.MiscFunction;
                BottomBtn.Def.Caption       = "NEXT";
                BottomBtn.Def.Command       = delegate { App.Inst.GotoNextMessage(Message, 1); };

                Theme.MakeBlack(TextBox);
                TextBox.Hidden = true;
                SetHtml("", "");

                DoLayout();
            } catch (Exception error) {
                Log.Error(error);
            }
        }
Esempio n. 2
0
        public override void ViewDidLoad()
        {
            try {
                Info = new UIInfo ();

                TextBox.MultipleTouchEnabled = true;

                CompWidth = CloseBtn.Frame.Width;
                if (!App.Inst.IsIPad) {
                    CompWidth *= 0.75f;
                }

                wdel = new MessageReader.WDel (this);
                TextBox.Delegate = wdel;
                TextBox.MultipleTouchEnabled = true;

                OriginalBtn.Def.Caption = "ORIGINAL";
                OriginalBtn.Def.ComponentType = LcarsComponentType.NavigationFunction;
                OriginalBtn.Def.PlayCommandSound = delegate {
                    if (Message != null && !string.IsNullOrEmpty (Message.Url)) {
                        Sounds.PlayDataRetrieval ();
                    } else {
                        Sounds.PlayNotAllowed ();
                    }
                };
                OriginalBtn.Def.Command = delegate { ToggleOriginal (); };

                ShareBtn.Def.ComponentType = LcarsComponentType.PrimaryFunction;
                ShareBtn.Def.Caption = "SHARE";
                ShareBtn.Def.Command = delegate {
                    if (Message == null)
                        return;
                    var s = new ShareView ();
                    s.Message = Message;
                    App.Inst.ShowDialog (s);
                };

                Filler = new LcarsComp ();
                Filler.Frame = new RectangleF (ShareBtn.Frame.Left, ShareBtn.Frame.Bottom, ShareBtn.Frame.Width, 0);
                Filler.Def.ComponentType = LcarsComponentType.Static;
                Filler.Hidden = true;
                View.AddSubview (Filler);

                TextBox.Layer.CornerRadius = 10;

                CloseBtn.Def.Caption = "CLOSE";
                CloseBtn.Def.ComponentType = LcarsComponentType.DisplayFunction;
                CloseBtn.Def.Command = delegate { App.Inst.CloseSubView (true); };

                RelativeComp.Def.ComponentType = LcarsComponentType.SystemFunction;
                RelativeComp.Width = CloseBtn.Width;
                RelativeComp.Shape = LcarsShape.TopRight;
                RelativeComp.Height = Theme.HorizontalBarHeight;
                RelativeComp.Def.Command = delegate {
                    var full = App.Inst.ToggleSubViewFullScreen (true);
                    RelativeComp.Def.Caption = full ? "MIN" : "MAX";
                    DoLayout (full);
                    RelativeComp.SetNeedsDisplay ();
                };
                RelativeComp.Def.Caption = "MAX";

                TopBtn.Def.ComponentType = LcarsComponentType.MiscFunction;
                TopBtn.Def.Caption = "PREV";
                TopBtn.Def.Command = delegate { App.Inst.GotoNextMessage (Message, -1); };

                BottomBtn.Def.ComponentType = LcarsComponentType.MiscFunction;
                BottomBtn.Def.Caption = "NEXT";
                BottomBtn.Def.Command = delegate { App.Inst.GotoNextMessage (Message, 1); };

                Theme.MakeBlack (TextBox);
                TextBox.Hidden = true;
                SetHtml ("", "");

                DoLayout ();
            } catch (Exception error) {
                Log.Error (error);
            }
        }