Exemplo n.º 1
0
        public void GoAway()
        {
            if (isOpen)
            {
                Close();
            }
            clickedOn = false;

            try
            {
                if (launcherButton != null && ApplicationLauncher.Instance != null)
                {
                    ApplicationLauncher launcher = ApplicationLauncher.Instance;

                    launcher.DisableMutuallyExclusive(launcherButton);
                    launcher.RemoveOnRepositionCallback(CallbackOnShow);
                    launcher.RemoveOnHideCallback(CallbackOnHide);
                    launcher.RemoveOnShowCallback(CallbackOnShow);
                    launcher.RemoveModApplication(launcherButton);
                    launcherButton = null;
                }
            }
            catch (Exception e)
            {
                SafeHouse.Logger.SuperVerbose("[kOSToolBarWindow] Failed unregistering AppLauncher handlers," + e.Message);
            }

            // force close the font picker window if it was still open:
            if (fontPicker != null)
            {
                fontPicker.Close();
                Destroy(fontPicker);
                fontPicker = null;
            }
        }
Exemplo n.º 2
0
        private void DrawIPAddrField(ConfigKey key)
        {
            bool clicked = GUILayout.Button(key.Value.ToString(), panelSkin.button);

            if (clicked)
            {
                // Make a new picker if it's closed, or close it if it's already open.
                if (ipAddrPicker == null)
                {
                    ipAddrPicker = this.gameObject.AddComponent <ListPickerDialog>();
                    kOS.Screen.ListPickerDialog.ChangeAction onChange = delegate(String s)
                    {
                        bool ok = TelnetMainServer.Instance.SetBindAddrFromString(s);
                        if (ok)
                        {
                            key.Value = s;
                        }
                        return(ok);
                    };

                    kOS.Screen.ListPickerDialog.CloseAction onClose = delegate() { ipAddrPicker = null; };

                    ipAddrPicker.Summon(windowRect.x, windowRect.y + windowRect.height, 300,
                                        "Telnet address (restart telnet to take effect)\n", null,
                                        "current: " + key.Value.ToString(), TelnetMainServer.GetAllAddresses(), onChange, onClose
                                        );
                }
                else
                {
                    ipAddrPicker.Close();
                    ipAddrPicker = null;
                }
            }
        }