示例#1
0
        public UIInfo GetDefaultUI()
        {
            var i = new UIInfo();

            i.ScreenTitle = UIInfo.DefaultScreenTitle;

            i.MainFill = new LcarsDef();
            i.MainFill.ComponentType = LcarsComponentType.Static;

            i.MiscBtn = new LcarsDef {
                ComponentType = LcarsComponentType.Static
            };

            i.MainTop = new LcarsDef {
                ComponentType = LcarsComponentType.Static
            };

            i.TopLeft = new LcarsDef {
                ComponentType = LcarsComponentType.MiscFunction, Caption = "REFRESH", Command = delegate {
                    SourceRef r = null;
                    if (MVC.SubView is MessageReader)
                    {
                        var m = ((MessageReader)MVC.SubView).MessageRef;
                        if (m != null)
                        {
                            r = m.GetSourceReference();
                        }
                    }
                    else if (MVC.MainView is SourceTypeMessages)
                    {
                        var ms = (SourceTypeMessages)MVC.MainView;
                        var s  = ms.QuerySources.FirstOrDefault();
                        if (s != null)
                        {
                            r = s.Reference;
                        }
                    }
                    SourceUpdater.ForceRefresh(r);
                }
            };

            i.TopMisc = new LcarsDef {
                ComponentType = LcarsComponentType.SystemFunction, Caption = Sounds.IsMuted ? "UNMUTE" : "MUTE", Command = delegate {
                    Sounds.ToggleMute();
                    var a = AudioPlayerController.Inst;
                    if (Sounds.IsMuted && a != null && a.IsPlaying)
                    {
                        ResumeAudioOnNextUnmute = true;
                        a.Pause();
                    }
                    else if (!Sounds.IsMuted && ResumeAudioOnNextUnmute && a != null)
                    {
                        a.Play();
                        ResumeAudioOnNextUnmute = false;
                    }

                    RefreshInfo();
                }
            };

            i.MainSec = new LcarsDef {
                ComponentType = LcarsComponentType.MiscFunction, Caption = "SETTINGS", Command = delegate {
                    var c = new UserSettings();
                    ShowMain(c);
                }
            };

            i.MainRel = new LcarsDef {
                ComponentType = LcarsComponentType.DisplayFunction
            };
            if (!IsIPad)
            {
                i.MainRel.Command = delegate { MVC.ToggleMainFullScreen(true); };
            }

            i.BottomLeft = new LcarsDef {
                ComponentType = LcarsComponentType.SystemFunction, Caption = App.Inst.IsIPad ? "ADD SOURCE" : "ADD", Command = delegate {
                    var c = new ChooseSource();
                    ShowMain(c);
                }
            };

            return(i);
        }