Example #1
0
        public void RefreshInfo(UIInfo info)
        {
            Comp7.Def        = info.BottomLeft;
            RelativeComp.Def = info.MainRel;
            Comp1.Def        = info.MainTop;
            Comp2.Def        = info.MainFill;
            MiscComp.Def     = info.MiscBtn;
            Comp6.Def        = info.MainSec;
            Comp6.Hidden     = true;

            var activeTypes = Repo.Foreground.GetActiveSourceTypes();

            foreach (var c in sourceComps)
            {
                c.RemoveFromSuperview();
            }
            sourceComps.Clear();
            if (activeTypes.Length != 0)
            {
                sourceComps = new List <LcarsComp> ();
                foreach (var t in activeTypes)
                {
                    var tt = t;
                    var c  = new LcarsComp();

                    var cap = SourceTypes.GetTitle(t);

                    if (!App.Inst.IsIPad && cap.Length > 8)
                    {
                        var parts = cap.Split(' ');
                        for (var j = 0; j < parts.Length; j++)
                        {
                            parts[j] = parts[j].TruncateChars(3);
                        }

                        cap = string.Join(" ", parts);
                    }

                    c.Def.Caption       = cap;
                    c.Def.ComponentType = LcarsComponentType.NavigationFunction;
                    c.Def.Command       = delegate { App.Inst.ShowSourceTypeMessages(tt, true); };
                    View.AddSubview(c);
                    sourceComps.Add(c);
                }
            }
            DoLayout();
        }
Example #2
0
        void Initialize()
        {
            AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

            UIColor[] comps = new UIColor[] { Rgb(254, 233, 66), Rgb(208, 151, 254), Rgb(220, 183, 250), Rgb(251, 228, 117), Rgb(251, 218, 69), Rgb(226, 191, 255), Rgb(254, 191, 108), Rgb(255, 198, 120), Rgb(204, 141, 255), Rgb(177, 113, 252),
                                              Rgb(253, 219, 58), Rgb(230, 189, 255), Rgb(253, 228, 105), Rgb(145, 72, 255), Rgb(171, 115, 254), Rgb(252, 219, 62), Rgb(255, 206, 144), Rgb(211, 182, 249), Rgb(231, 201, 255), Rgb(148, 97, 250),
                                              Rgb(249, 228, 122), Rgb(226, 191, 254), Rgb(255, 207, 144), Rgb(204, 141, 255), Rgb(254, 230, 34) };

            var w = MinWidth;

            foreach (var def in Defs)
            {
                var sz = StringSize(def.Caption, Theme.ComponentFont);
                var dw = sz.Width + ButtonHeight;
                if (dw > w)
                {
                    w = dw;
                }
            }

            _btnWidth = w;

            int numCols = (int)(Frame.Width / _btnWidth + 0.5f);
            var numRows = (Defs.Length / numCols) + 1;

            _buttons = new UIView(new RectangleF(0, 0, Frame.Width, numRows * 57));

            ContentSize = _buttons.Frame.Size;
            AddSubview(_buttons);

            // Create buttons
            foreach (var def in Defs)
            {
                var btn = new LcarsComp {
                    Shape = LcarsShape.Button
                };

                btn.Def = def;
                //btn.Def.ComponentType = LcarsComponentType.NavigationFunction;
                btn.Def.Color = comps[(uint)(def.Caption.GetHashCode()) % comps.Length];

                _buttons.AddSubview(btn);
                Comps.Add(def, btn);
            }
        }
Example #3
0
 public Reticle(RectangleF frame) : base(frame)
 {
     TL                   = new LcarsComp();
     TL.Shape             = LcarsShape.TopLeft;
     BR                   = new LcarsComp();
     BR.Shape             = LcarsShape.BottomRight;
     TR                   = new LcarsComp();
     TR.Shape             = LcarsShape.TopRight;
     BL                   = new LcarsComp();
     BL.Shape             = LcarsShape.BottomLeft;
     TL.Def.ComponentType = TR.Def.ComponentType = BL.Def.ComponentType = BR.Def.ComponentType = LcarsComponentType.SystemFunction;
     TL.OuterCorner       = BL.OuterCorner = TR.OuterCorner = BR.OuterCorner = 0.75f;
     TL.InnerCorner       = BL.InnerCorner = TR.InnerCorner = BR.InnerCorner = 3.5f;
     AddSubview(TL);
     AddSubview(BL);
     AddSubview(TR);
     AddSubview(BR);
     LayoutSubviews();
 }
Example #4
0
        public void RefreshInfo(UIInfo info)
        {
            Comp7.Def = info.BottomLeft;
            RelativeComp.Def = info.MainRel;
            Comp1.Def = info.MainTop;
            Comp2.Def = info.MainFill;
            MiscComp.Def = info.MiscBtn;
            Comp6.Def = info.MainSec;
            Comp6.Hidden = true;

            var activeTypes = Repo.Foreground.GetActiveSourceTypes ();

            foreach (var c in sourceComps) {
                c.RemoveFromSuperview ();
            }
            sourceComps.Clear ();
            if (activeTypes.Length != 0) {
                sourceComps = new List<LcarsComp> ();
                foreach (var t in activeTypes) {
                    var tt = t;
                    var c = new LcarsComp ();

                    var cap = SourceTypes.GetTitle (t);

                    if (!App.Inst.IsIPad && cap.Length > 8) {

                        var parts = cap.Split (' ');
                        for (var j = 0; j < parts.Length; j++) {
                            parts[j] = parts[j].TruncateChars (3);
                        }

                        cap = string.Join (" ", parts);
                    }

                    c.Def.Caption = cap;
                    c.Def.ComponentType = LcarsComponentType.NavigationFunction;
                    c.Def.Command = delegate { App.Inst.ShowSourceTypeMessages (tt, true); };
                    View.AddSubview (c);
                    sourceComps.Add (c);
                }
            }
            DoLayout ();
        }
Example #5
0
 void SetWidth(LcarsComp c, float w)
 {
     c.Frame = new RectangleF (c.Frame.Left, c.Frame.Top, w, c.Frame.Height);
     c.Width = w;
 }
Example #6
0
 public Reticle(RectangleF frame)
     : base(frame)
 {
     TL = new LcarsComp ();
     TL.Shape = LcarsShape.TopLeft;
     BR = new LcarsComp ();
     BR.Shape = LcarsShape.BottomRight;
     TR = new LcarsComp ();
     TR.Shape = LcarsShape.TopRight;
     BL = new LcarsComp ();
     BL.Shape = LcarsShape.BottomLeft;
     TL.Def.ComponentType = TR.Def.ComponentType = BL.Def.ComponentType = BR.Def.ComponentType = LcarsComponentType.SystemFunction;
     TL.OuterCorner = BL.OuterCorner = TR.OuterCorner = BR.OuterCorner = 0.75f;
     TL.InnerCorner = BL.InnerCorner = TR.InnerCorner = BR.InnerCorner = 3.5f;
     AddSubview (TL);
     AddSubview (BL);
     AddSubview (TR);
     AddSubview (BR);
     LayoutSubviews ();
 }
Example #7
0
 void SetWidth(LcarsComp c, float w)
 {
     c.Frame = new RectangleF(c.Frame.Left, c.Frame.Top, w, c.Frame.Height);
     c.Width = w;
 }
Example #8
0
        void Initialize()
        {
            AutoresizingMask       = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            DirectionalLockEnabled = true;

            var helpText = "";

            var vs = SourceType.GetCustomAttributes(typeof(CustomUIAttribute), true);

            IsCustomUI = vs.Length > 0;

            if (IsCustomUI)
            {
                CustomUIType = ((CustomUIAttribute)vs[0]).UIType;
                CustomUI     = Activator.CreateInstance(CustomUIType) as ICustomUI;
                CustomUI.SetModel(Source);
                CustomUI.OnOK += delegate {
                    try {
                        if (OnOK != null)
                        {
                            OnOK();
                        }
                    } catch (Exception error) {
                        Log.Error(error);
                    }
                };
                AddSubview(CustomUI as UIView);
                this.ExclusiveTouch          = false;
                this.CanCancelContentTouches = false;
                this.DelaysContentTouches    = false;
            }
            else
            {
                AlwaysBounceVertical   = true;
                AlwaysBounceHorizontal = false;
                helpText = InitializePropsUI();
            }

            ConfirmButton = new LcarsComp {
                Shape = LcarsShape.Button
            };
            ConfirmButton.Def.Caption        = "ADD";
            ConfirmButton.Def.NeedsDoubleTap = false;
            ConfirmButton.Def.IsCommandable  = false;
            ConfirmButton.Def.Command        = delegate {
                HideKeyBoard(this);
                if (OnOK != null)
                {
                    OnOK();
                }
            };

            CancelButton = new LcarsComp {
                Shape = LcarsShape.Button, Hidden = true
            };
            CancelButton.Def.Caption        = "CANCEL";
            CancelButton.Def.NeedsDoubleTap = false;
            CancelButton.Def.IsCommandable  = true;
            CancelButton.Def.Command        = delegate {
                HideKeyBoard(this);
                if (OnCancel != null)
                {
                    OnCancel();
                }
            };

            if (IsCustomUI)
            {
                ConfirmButton.Hidden = true;
                CancelButton.Hidden  = true;
            }

            GeneralHelp = new UITextView();
            GeneralHelp.BackgroundColor = UIColor.Black;
            GeneralHelp.TextColor       = Theme.TitleColor;
            GeneralHelp.Font            = Theme.TextFont;
            GeneralHelp.Editable        = false;
            GeneralHelp.Text            = helpText;

            AddSubview(CancelButton);
            AddSubview(ConfirmButton);
            AddSubview(GeneralHelp);
        }
Example #9
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);
            }
        }
Example #10
0
        void Initialize()
        {
            AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            DirectionalLockEnabled = true;

            var helpText = "";

            var vs = SourceType.GetCustomAttributes (typeof(CustomUIAttribute), true);
            IsCustomUI = vs.Length > 0;

            if (IsCustomUI) {
                CustomUIType = ((CustomUIAttribute)vs[0]).UIType;
                CustomUI = Activator.CreateInstance (CustomUIType) as ICustomUI;
                CustomUI.SetModel (Source);
                CustomUI.OnOK += delegate {
                    try {
                        if (OnOK != null) {
                            OnOK ();
                        }
                    } catch (Exception error) {
                        Log.Error (error);
                    }
                };
                AddSubview (CustomUI as UIView);
                this.ExclusiveTouch = false;
                this.CanCancelContentTouches = false;
                this.DelaysContentTouches = false;

            } else {
                AlwaysBounceVertical = true;
                AlwaysBounceHorizontal = false;
                helpText = InitializePropsUI ();
            }

            ConfirmButton = new LcarsComp { Shape = LcarsShape.Button };
            ConfirmButton.Def.Caption = "ADD";
            ConfirmButton.Def.NeedsDoubleTap = false;
            ConfirmButton.Def.IsCommandable = false;
            ConfirmButton.Def.Command = delegate {
                HideKeyBoard (this);
                if (OnOK != null) {
                    OnOK ();
                }
            };

            CancelButton = new LcarsComp { Shape = LcarsShape.Button, Hidden = true };
            CancelButton.Def.Caption = "CANCEL";
            CancelButton.Def.NeedsDoubleTap = false;
            CancelButton.Def.IsCommandable = true;
            CancelButton.Def.Command = delegate {
                HideKeyBoard (this);
                if (OnCancel != null) {
                    OnCancel ();
                }
            };

            if (IsCustomUI) {
                ConfirmButton.Hidden = true;
                CancelButton.Hidden = true;
            }

            GeneralHelp = new UITextView ();
            GeneralHelp.BackgroundColor = UIColor.Black;
            GeneralHelp.TextColor = Theme.TitleColor;
            GeneralHelp.Font = Theme.TextFont;
            GeneralHelp.Editable = false;
            GeneralHelp.Text = helpText;

            AddSubview (CancelButton);
            AddSubview (ConfirmButton);
            AddSubview (GeneralHelp);
        }
Example #11
0
        void Initialize()
        {
            AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

            UIColor[] comps = new UIColor[] { Rgb (254, 233, 66), Rgb (208, 151, 254), Rgb (220, 183, 250), Rgb (251, 228, 117), Rgb (251, 218, 69), Rgb (226, 191, 255), Rgb (254, 191, 108), Rgb (255, 198, 120), Rgb (204, 141, 255), Rgb (177, 113, 252),
            Rgb (253, 219, 58), Rgb (230, 189, 255), Rgb (253, 228, 105), Rgb (145, 72, 255), Rgb (171, 115, 254), Rgb (252, 219, 62), Rgb (255, 206, 144), Rgb (211, 182, 249), Rgb (231, 201, 255), Rgb (148, 97, 250),
            Rgb (249, 228, 122), Rgb (226, 191, 254), Rgb (255, 207, 144), Rgb (204, 141, 255), Rgb (254, 230, 34) };

            var w = MinWidth;

            foreach (var def in Defs) {
                var sz = StringSize (def.Caption, Theme.ComponentFont);
                var dw = sz.Width + ButtonHeight;
                if (dw > w) {
                    w = dw;
                }
            }

            _btnWidth = w;

            int numCols = (int)(Frame.Width / _btnWidth + 0.5f);
            var numRows = (Defs.Length / numCols) + 1;

            _buttons = new UIView (new RectangleF (0, 0, Frame.Width, numRows * 57));

            ContentSize = _buttons.Frame.Size;
            AddSubview (_buttons);

            // Create buttons
            foreach (var def in Defs) {

                var btn = new LcarsComp { Shape = LcarsShape.Button };

                btn.Def = def;
                //btn.Def.ComponentType = LcarsComponentType.NavigationFunction;
                btn.Def.Color = comps[(uint)(def.Caption.GetHashCode ()) % comps.Length];

                _buttons.AddSubview (btn);
                Comps.Add (def, btn);
            }
        }
Example #12
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);
            }
        }