Ejemplo n.º 1
0
        public LauncherConnectingGui(LauncherConnecting state)
        {
            _state = state;

            RobustXamlLoader.Load(this);

            LayoutContainer.SetAnchorPreset(this, LayoutContainer.LayoutPreset.Wide);

            Stylesheet = IoCManager.Resolve <IStylesheetManager>().SheetSpace;

            ReconnectButton.OnPressed += _ => _state.RetryConnect();
            RetryButton.OnPressed     += _ => _state.RetryConnect();
            ExitButton.OnPressed      += _ => _state.Exit();

            var addr = state.Address;

            if (addr != null)
            {
                ConnectingAddress.Text = addr;
            }

            state.PageChanged += OnPageChanged;
            state.ConnectFailReasonChanged += ConnectFailReasonChanged;
            state.ConnectionStateChanged   += ConnectionStateChanged;

            ConnectionStateChanged(state.ConnectionState);
        }
        public LauncherConnectingGui(LauncherConnecting state)
        {
            _state = state;

            RobustXamlLoader.Load(this);

            LayoutContainer.SetAnchorPreset(this, LayoutContainer.LayoutPreset.Wide);

            Stylesheet = IoCManager.Resolve <IStylesheetManager>().SheetSpace;

            ReconnectButton.OnPressed += _ => _state.RetryConnect();
            // Redial shouldn't fail, but if it does, try a reconnect (maybe we're being run from debug)
            RedialButton.OnPressed += _ =>
            {
                if (!_state.Redial())
                {
                    _state.RetryConnect();
                }
            };
            RetryButton.OnPressed += _ => _state.RetryConnect();
            ExitButton.OnPressed  += _ => _state.Exit();

            var addr = state.Address;

            if (addr != null)
            {
                ConnectingAddress.Text = addr;
            }

            state.PageChanged += OnPageChanged;
            state.ConnectFailReasonChanged += ConnectFailReasonChanged;
            state.ConnectionStateChanged   += ConnectionStateChanged;

            ConnectionStateChanged(state.ConnectionState);

            // Redial flag setup
            var edim = IoCManager.Resolve <ExtendedDisconnectInformationManager>();

            edim.LastNetDisconnectedArgsChanged += LastNetDisconnectedArgsChanged;
            LastNetDisconnectedArgsChanged(edim.LastNetDisconnectedArgs);
        }