예제 #1
0
        private static void UpdateConnectionState(MainWindowModel model, ConnectionState state)
        {
            string[] stateTexts =
            {
                "Connecting...",
                "Connecting to proxy...",
                "Ready.",
                "Updating...",
                "Waiting for network..."
            };

            model.ConnectionState = stateTexts[(int)state];
        }
        private static void HandleState(MainWindowModel model, TdApi.AuthorizationState state)
        {
            switch (state)
            {
            case TdApi.AuthorizationState.AuthorizationStateWaitTdlibParameters _:
            case TdApi.AuthorizationState.AuthorizationStateWaitEncryptionKey _:
                GoToStartupPage(model);
                break;

            case TdApi.AuthorizationState.AuthorizationStateWaitPhoneNumber _:
            case TdApi.AuthorizationState.AuthorizationStateWaitCode _:
            case TdApi.AuthorizationState.AuthorizationStateWaitPassword _:
                GoToAuthenticationPage(model);
                break;

            case TdApi.AuthorizationState.AuthorizationStateReady _:
                GoToWorkspacePage(model);
                break;
            }
        }
예제 #3
0
        public static IDisposable BindPopup(
            this MainWindowModel model,
            IPopupController popupController)
        {
            model.PopupModel = PopupModel.Hidden();

            var trigger = (popupController as PopupController)?.Trigger;

            if (trigger != null)
            {
                return(trigger
                       .SubscribeOn(RxApp.TaskpoolScheduler)
                       .ObserveOn(RxApp.MainThreadScheduler)
                       .Accept(context =>
                {
                    model.PopupModel = context == null
                            ? PopupModel.Hidden()
                            : new PopupModel(context);
                }));
            }

            return(Disposable.Empty);
        }