Example #1
0
    public ActionResult Index()
    {
        RegistrationState model = RegistrationState.Init();

        // just display the "Fill Basic Info" form
        return(View(model));
    }
Example #2
0
        private async Task <DialogTurnResult> Register(WaterfallStepContext stepContext,
                                                       CancellationToken cancellationToken)
        {
            RegistrationState registrationState = await this.conversationStateAccessors
                                                  .RegistrationStateAccessor
                                                  .GetAsync(
                stepContext.Context,
                () => new RegistrationState(),
                cancellationToken);

            User user = new User
            {
                ChannelId             = stepContext.Context.Activity.From.Id,
                Name                  = registrationState.Name,
                Gender                = registrationState.Gender,
                ConversationReference = stepContext.Context.Activity.GetConversationReference()
            };

            await this.userRepository.AddUser(user, cancellationToken);

            await this.chatHub.Clients.All.SendAsync(method : "userAdded", arg1 : user, cancellationToken : cancellationToken);

            await stepContext.Context.SendActivityAsync(
                "Регистрация завершена, теперь все ваши сообщения будут отправляться психологу",
                cancellationToken : cancellationToken);

            return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));
        }
Example #3
0
        public async Task <bool> ProvisionDevice(WifiNetwork wifiNetwork)
        {
            State = RegistrationState.Starting;

            OnBeginDevicePairing?.Invoke();
            this.deviceSetupService.CurrentDeviceModel.SSID     = wifiNetwork.SSID;
            this.deviceSetupService.CurrentDeviceHotspotNetwork = new WifiNetwork()
            {
                SSID = wifiNetwork.SSID
            };

            // connect to device
            SetPairingStatusText("Connecting to device...");

            var defaultWifiNetwork = await wifiService.GetCurrentlyConnectedWifiNetwork();

            deviceSetupService.OriginalSSID = defaultWifiNetwork.SSID;

            State = RegistrationState.ConnectingConnectingToDeviceFirstTime;
            var success = await wifiService.ConnectToWifiNetwork(wifiNetwork.SSID, deviceSetupService.DefaultPassword);

            if (!success)
            {
                return(await ProvisionDeviceFail());
            }

            return(true);
        }
Example #4
0
        private async Task <bool> GenerateDeviceInfo(WifiNetwork wifiNetwork)
        {
            // get stuff from device
            SetPairingStatusText("Grabbing some information from the device...");

            onboardingRestService.SetBasicAuthentication(deviceSetupService.DefaultPortalPassword);

            var deviceIdResponse = await onboardingRestService.GetDeviceId();

            if (deviceIdResponse == null)
            {
                return(await ProvisionDeviceFail());
            }

            deviceSetupService.CurrentDeviceModel.DeviceId = deviceIdResponse.DeviceId;

            //return deviceIdResponse?.DeviceId; // shortcut for testing

            csrResult = await onboardingRestService.GetGeneratedCSR();

            State = RegistrationState.DeviceInfoGenerated;
            var success = await wifiService.ConnectToWifiNetwork(deviceSetupService.OriginalSSID);

            return(true);
        }
Example #5
0
 public override void UnBindEventHandlers()
 {
     base.UnBindEventHandlers();
     this.wifiService.ConnectionFailed -= WifiService_ConnectionFailed;
     this.wifiService.CheckingConnectionStatusUpdated -= WifiService_CheckingConnectionStatusUpdated;
     State = RegistrationState.New;
 }
Example #6
0
 /// <summary>
 /// Refresh the status icon given the registration state in param.
 /// </summary>
 public void RefreshStatus(RegistrationState state)
 {
     Dispatcher.BeginInvoke(() =>
     {
         if (state == RegistrationState.RegistrationOk)
         {
             StatusLed.Source = new BitmapImage(new Uri("/Assets/led_connected.png", UriKind.Relative));
             StatusText.Text  = AppResources.Registered;
         }
         else if (state == RegistrationState.RegistrationInProgress)
         {
             StatusLed.Source = new BitmapImage(new Uri("/Assets/led_inprogress.png", UriKind.Relative));
             StatusText.Text  = AppResources.RegistrationInProgress;
         }
         else if (state == RegistrationState.RegistrationFailed)
         {
             StatusLed.Source = new BitmapImage(new Uri("/Assets/led_error.png", UriKind.Relative));
             StatusText.Text  = AppResources.RegistrationFailed;
         }
         else
         {
             StatusLed.Source = new BitmapImage(new Uri("/Assets/led_disconnected.png", UriKind.Relative));
             StatusText.Text  = AppResources.Disconnected;
         }
     });
 }
 public void RefreshStatus(RegistrationState state)
 {
     if (state == RegistrationState.Ok)
     {
         StatusLed.Source = new BitmapImage(new Uri(this.BaseUri, "/Assets/led_connected.png"));
         StatusText.Text  = ResourceLoader.GetForCurrentView().GetString("Registered");
     }
     else if (state == RegistrationState.Progress)
     {
         StatusLed.Source = new BitmapImage(new Uri(this.BaseUri, "/Assets/led_inprogress.png"));
         StatusText.Text  = ResourceLoader.GetForCurrentView().GetString("RegistrationInProgress");
     }
     else if (state == RegistrationState.Failed)
     {
         StatusLed.Source = new BitmapImage(new Uri(this.BaseUri, "/Assets/led_error.png"));
         if (LinphoneManager.Instance.Core.DefaultProxyConfig.Error == Reason.Forbidden)
         {
             StatusText.Text = ResourceLoader.GetForCurrentView().GetString("RegistrationFailedForbidden");
         }
         else
         {
             StatusText.Text = ResourceLoader.GetForCurrentView().GetString("RegistrationFailed");
         }
     }
     else
     {
         StatusLed.Source = new BitmapImage(new Uri(this.BaseUri, "/Assets/led_disconnected.png"));
         StatusText.Text  = ResourceLoader.GetForCurrentView().GetString("Disconnected");
     }
 }
Example #8
0
 /// <summary>
 /// Callback for LinphoneCoreListener
 /// </summary>
 public void RegistrationState(LinphoneProxyConfig config, RegistrationState state, string message)
 {
     if ((config == null) || BaseModel.UIDispatcher == null)
     {
         return;
     }
     BaseModel.UIDispatcher.BeginInvoke(() =>
     {
         try
         {
             Logger.Msg("[LinphoneManager] Registration state changed: " + state.ToString() + ", message=" + message + " for identity " + config.GetIdentity() + "\r\n");
             LastKnownState = state;
             if (BasePage.StatusBar != null)
             {
                 BasePage.StatusBar.RefreshStatus(state);
             }
             if ((state == Core.RegistrationState.RegistrationFailed) && (config.Error == Reason.LinphoneReasonForbidden))
             {
                 if (RegistrationFailedNotification != null)
                 {
                     RegistrationFailedNotification.Dismiss();
                 }
                 RegistrationFailedNotification = new CustomMessageBox()
                 {
                     Caption            = ResourceManager.GetString("RegistrationFailedPopupTitle", CultureInfo.CurrentCulture),
                     Message            = ResourceManager.GetString("RegistrationFailedForbidden", CultureInfo.CurrentCulture),
                     RightButtonContent = AppResources.Close
                 };
                 RegistrationFailedNotification.Show();
             }
         }
         catch { }
     });
 }
        /// <summary>
        /// Configure view to show expiring soon message
        /// </summary>
        private void InitializeExpiringSoon()
        {
            state = RegistrationState.ExpiringSoon;

            if (licenseService.IsExpired)
            {
                var splitter = CommonResourceManager.Instance.GetResourceString("Common_RegistrationView_ExpiredSerialSplitter");

                var expiredLicenses = string.Join(splitter, licenseService.LicenseInfos
                                                  .Where(x => !x.IsTrial && x.IsExpired && !string.IsNullOrEmpty(x.Serial))
                                                  .Select(x => x.Serial));

                TextMessage = string.Format(CommonResourceManager.Instance.GetResourceString("Common_RegistrationView_ExpiredText"), expiredLicenses);
            }
            else
            {
                TextMessage = CommonResourceManager.Instance.GetResourceString("Common_RegistrationView_ExpiringSoonText");
            }

            IsSerialVisible = false;
            IsEmailVisible  = false;

            IsSendButtonVisible     = false;
            IsTrialButtonVisible    = false;
            IsRegisterButtonVisible = true;
            IsBuyButtonVisible      = true;
            IsRenewButtonVisible    = true;
            IsBackButtonVisible     = false;
            IsOKButtonVisible       = true;
            IsCancelButtonVisible   = false;
            IsActivateButtonVisible = false;

            IsTrialProgressBarVisible = false;
            IsLicenseDaysLeftVisible  = true;
        }
Example #10
0
        private async Task UpdateRegistration(int registrationId, RegistrationState state)
        {
            Registration registration = await _dbContext.Registrations.FindAsync(registrationId);

            registration.State = state;
            _dbContext.Update(registration);
            await _dbContext.SaveChangesAsync();
        }
 /// <summary>
 /// Callback for LinphoneCoreListener
 /// </summary>
 public void RegistrationState(LinphoneProxyConfig config, RegistrationState state, string message)
 {
     if (state == Linphone.Core.RegistrationState.RegistrationOk || state == Linphone.Core.RegistrationState.RegistrationFailed)
     {
         Debug.WriteLine("[KeepAliveAgent] Notify complete (" + state.ToString() + ")");
         base.NotifyComplete();
     }
 }
 public async Task Start()
 {
     Stopped = false;
     State   = new RegistrationState();
     while (Stopped == false)
     {
         await State.Handle(this);
     }
 }
        private void OnRegistration(Core lc, ProxyConfig config, RegistrationState state, string message)
        {
            if (this.registrationListener != null && this.registrationState != state)
            {
                registrationListener.onLinphoneStatusChanged(state, message);
            }

            this.registrationState = state;
        }
Example #14
0
 public void onLinphoneStatusChanged(RegistrationState state, string message)
 {
     if (state == RegistrationState.Failed || state == RegistrationState.None || state == RegistrationState.Cleared)
     {
         //registrationService.unRegister();
         registrationService.setRegistrationListener(null);
         ((App)App.Current).MainPage = new NavigationPage(new components.Login());
     }
 }
Example #15
0
File: Line.cs Project: afit/HVoIPM
 public Line(	String name, String lastCalledNumber, String lastCallerNumber, bool messageWaiting,
     Call[] calls, RegistrationState registrationState)
 {
     mName = name;
     mLastCalledNumber = lastCalledNumber;
     mLastCallerNumber = lastCallerNumber;
     mMessageWaiting = messageWaiting;
     mCalls = calls;
     mRegistrationState = registrationState;
 }
Example #16
0
        public async Task <IViewComponentResult> InvokeAsync(RegistrationState state)
        {
            IReadOnlyCollection <Visitor> model = await _dbContext.Visitors
                                                  .Include(m => m.Registrant)
                                                  .Include(m => m.Registrant.Registration)
                                                  .Where(m => m.Registrant.Registration.State == state)
                                                  .ToListAsync();

            return(View(model));
        }
 public Registration(CharacterSelector selector, RegisteredPlayerUIView ui, RegistrationState registrationState, NetworkMode networkMode, PlayerRegistration context)
 {
     this.selector          = selector;
     this.ui                = ui;
     this.registrationState = registrationState;
     this.context           = context;
     this.localID           = -1;
     this.networkMode       = networkMode;
     this.echoPosition      = Vector2.zero;
 }
Example #18
0
    void OnGUI()
    {
        if (GetSelectedAdCanvas() == null)
        {
            Close();
        }

        EditorGUILayout.LabelField("Register newly created VREO_AD_CANVAS object by setting its unique Spot Id:",
                                   EditorStyles.wordWrappedLabel);

        GUILayout.Space(5);

        SpotId = EditorGUILayout.TextField("Spot Id: ", SpotId);

        GUILayout.Space(5);

        EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(SpotId));

        if (GUILayout.Button("Register Ad Spot"))
        {
            VreoCommunicate.RequestRegisterAd(SpotId, () =>
            {
                Debug.Log($"Ad spot with ID {SpotId} was registered.");
                Registration = RegistrationState.eDone;
            }, error =>
            {
                Debug.LogError($"An error occured while registering ad spot with ID {SpotId}. Error: {error}");
                Registration = RegistrationState.eError;
                Error        = error;
                Repaint();
            });
        }

        EditorGUI.EndDisabledGroup();

        if (Registration == RegistrationState.eError)
        {
            GUILayout.Space(5);

            EditorGUILayout.LabelField($"An error occured while registering ad spot with ID {SpotId}. Error: {Error}", EditorStyles.wordWrappedLabel);
        }

        if (Registration == RegistrationState.eDone)
        {
            var spotId       = serializedObject.FindProperty("spotId");
            var isRegistered = serializedObject.FindProperty("isRegistered");

            spotId.stringValue     = SpotId;
            isRegistered.boolValue = true;

            serializedObject.ApplyModifiedProperties();

            Close();
        }
    }
Example #19
0
 public ActionResult Index(RegistrationState data)
 {
     // process data and redirect to next step
     this.TempData["RegState"] = data;
     if (!this.ModelState.IsValid || data.State == State.Error)
     {
         // error should handle provided state and empty one as well
         return(RedirectToAction("Error"));
     }
     return(RedirectToAction("Package"));
 }
Example #20
0
 void RegistrationStateChanged(Core lc, ProxyConfig config, RegistrationState state, string message)
 {
     if (CoreDispatcher == null)
     {
         return;
     }
     if (RegistrationChanged != null)
     {
         RegistrationChanged(config, state, message);
     }
 }
Example #21
0
        public RegistrationService(IUserAccountService userAccountService, IValidationService validationService, int maxAttempts, int lockTimespan)
        {
            _userAccountService = userAccountService;
            _validationService  = validationService;

            _registrationState = new RegistrationState()
            {
                MaxAllowedAttempts    = maxAttempts,
                LockTimespanInMinutes = lockTimespan
            };
        }
Example #22
0
        private void OnRegistration(Core lc, ProxyConfig config, RegistrationState state, string message)
        {
            Debug.WriteLine("Registration state changed: " + state);

            registration_status.Text = "Registration state changed: " + state;

            if (state == RegistrationState.Ok)
            {
                register.IsEnabled        = false;
                stack_registrar.IsVisible = false;
            }
        }
Example #23
0
        internal static string ToSerializedValue(this RegistrationState value)
        {
            switch (value)
            {
            case RegistrationState.Registered:
                return("Registered");

            case RegistrationState.NotRegistered:
                return("NotRegistered");
            }
            return(null);
        }
Example #24
0
        public bool isRegistered()
        {
            RegistrationState r = registrationService.registrationState;

            if (r == RegistrationState.Ok)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #25
0
 private void OnRegistration(Core lc, ProxyConfig config, RegistrationState state, string message)
 {
     if (state == RegistrationState.Ok)
     {
         RegStatus     = "Онлайн";
         RegStatusIcon = "StatusOnline.png";
     }
     if (state == RegistrationState.Progress)
     {
         RegStatus     = "Подключение";
         RegStatusIcon = "StatusPending.png";
     }
 }
Example #26
0
    public ActionResult Package()
    {
        RegistrationState data = this.TempData["RegState"] as RegistrationState;

        if (data == null)
        {
            return(RedirectToAction("Error"));
        }
        // get packages and display them
        IList <Package> model = this.repository.GetPackages();

        return(View(new Tuple.Create(data, model)));
    }
Example #27
0
        void CoreListener.RegistrationStateChanged(ProxyConfig config, RegistrationState state, string message)
        {
            if (CoreDispatcher == null)
            {
                return;
            }
#pragma warning disable CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel
            CoreDispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
                if (RegistrationChanged != null)
                {
                    RegistrationChanged(config, state, message);
                }
            });
        }
Example #28
0
        private void OnRegistration(Core lc, ProxyConfig config, RegistrationState state, string message)
        {
#if WINDOWS_UWP
            Debug.WriteLine("Registration state changed: " + state);
#else
            Console.WriteLine("Registration state changed: " + state);
#endif
            registration_status.Text = "Registration state changed: " + state;

            if (state == RegistrationState.Ok)
            {
                register.IsEnabled = false;
            }
        }
Example #29
0
        public async Task <StatusCodeResult> Update(int id, RegistrationState state)
        {
            Registration registration = await _dbContext.Registrations.FindAsync(id);

            if (registration == null)
            {
                return(NotFound());
            }

            registration.State = state;
            _dbContext.Update(registration);
            await _dbContext.SaveChangesAsync();

            return(Ok());
        }
Example #30
0
        private async Task <DialogTurnResult> ApplyGender(WaterfallStepContext stepContext,
                                                          CancellationToken cancellationToken)
        {
            RegistrationState registrationState = await this.conversationStateAccessors
                                                  .RegistrationStateAccessor
                                                  .GetAsync(
                stepContext.Context,
                () => new RegistrationState(),
                cancellationToken);

            registrationState.Gender =
                ((FoundChoice)stepContext.Result).Value == "Мужчина" ? Gender.Male : Gender.Female;

            return(await stepContext.NextAsync(cancellationToken : cancellationToken));
        }
Example #31
0
        private void WifiService_CheckingConnectionStatusUpdated(object sender, Common.WiFi.CheckingConnectionStatusUpdatedEventArgs e)
        {
            if (e.IsConnected)
            {
                if (DeviceSetupService.SSIDIsEdisonDevice(e.SSID))
                {
                    switch (State)
                    {
                    case RegistrationState.ConnectingConnectingToDeviceFirstTime:
                        State = RegistrationState.ConnectedToDevice;
                        Task.Factory.StartNew(async() =>
                        {
                            await GenerateDeviceInfo(new WifiNetwork()
                            {
                                SSID = e.SSID
                            });
                        }, new CancellationTokenSource(TimeSpan.FromSeconds(20)).Token);
                        break;

                    case RegistrationState.ConnectingConnectingToDeviceSecondTime:
                        State = RegistrationState.ConnectedToDevice;
                        Task.Factory.StartNew(async() =>
                        {
                            await OnboardDevice();
                        }, new CancellationTokenSource(TimeSpan.FromSeconds(30)).Token);
                        break;

                    default:
                        SetPairingStatusText($"State was set to {State}");
                        break;
                    }
                }
                else
                {
                    if (State == RegistrationState.DeviceInfoGenerated)
                    {
                        State = RegistrationState.ProvisioningWithCloud;
                        Task.Factory.StartNew(async() =>
                        {
                            await ProvisionWithCloud();
                        }, new CancellationTokenSource(TimeSpan.FromSeconds(20)).Token);
                    }
                }
            }
        }
 /// <summary>
 /// Refresh the status icon given the registration state in param.
 /// </summary>
 public void RefreshStatus(RegistrationState state)
 {
     Dispatcher.BeginInvoke(() =>
     {
         if (state == RegistrationState.RegistrationOk) {
             StatusLed.Source = new BitmapImage(new Uri("/Assets/led_connected.png", UriKind.Relative));
             StatusText.Text = AppResources.Registered;
         }
         else if (state == RegistrationState.RegistrationInProgress) {
             StatusLed.Source = new BitmapImage(new Uri("/Assets/led_inprogress.png", UriKind.Relative));
             StatusText.Text = AppResources.RegistrationInProgress;
         }
         else if (state == RegistrationState.RegistrationFailed) {
             StatusLed.Source = new BitmapImage(new Uri("/Assets/led_error.png", UriKind.Relative));
             StatusText.Text = AppResources.RegistrationFailed;
         }
         else {
             StatusLed.Source = new BitmapImage(new Uri("/Assets/led_disconnected.png", UriKind.Relative));
             StatusText.Text = AppResources.Disconnected;
         }
     });
 }
 /// <summary>
 /// Callback for LinphoneCoreListener
 /// </summary>
 public void RegistrationState(LinphoneProxyConfig config, RegistrationState state, string message)
 {
     if (state == Linphone.Core.RegistrationState.RegistrationOk || state == Linphone.Core.RegistrationState.RegistrationFailed)
     {
         Debug.WriteLine("[KeepAliveAgent] Notify complete (" + state.ToString() + ")");
         base.NotifyComplete();
     }
 }
 public void RegistrationState(LinphoneProxyConfig config, RegistrationState state, string message)
 {
     WriteLog("RegistrationState: {0} | ", state, message);
 }
 public Registration(CharacterSelector selector, RegisteredPlayerUIView ui, RegistrationState registrationState, int localID, NetworkMode networkMode, PlayerRegistration context)
     : this(selector, ui, registrationState, networkMode, context)
 {
     this.localID = localID;
 }
 public Registration(CharacterSelector selector, RegisteredPlayerUIView ui, RegistrationState registrationState, NetworkMode networkMode, PlayerRegistration context)
 {
     this.selector = selector;
     this.ui = ui;
     this.registrationState = registrationState;
     this.context = context;
     this.localID = -1;
     this.networkMode = networkMode;
     this.echoPosition = Vector2.zero;
 }
 void CoreListener.RegistrationStateChanged(ProxyConfig config, RegistrationState state, string message)
 {
     RegistrationStateText = message;
 }
 /// <summary>
 /// Callback for LinphoneCoreListener
 /// </summary>
 public void RegistrationState(LinphoneProxyConfig config, RegistrationState state, string message)
 {
     if ((config == null) || BaseModel.UIDispatcher == null) return;
     BaseModel.UIDispatcher.BeginInvoke(() =>
     {
         try
         {
             Logger.Msg("[LinphoneManager] Registration state changed: " + state.ToString() + ", message=" + message + " for identity " + config.GetIdentity() + "\r\n");
             LastKnownState = state;
             if (BasePage.StatusBar != null)
                 BasePage.StatusBar.RefreshStatus(state);
             if ((state == Core.RegistrationState.RegistrationFailed) && (config.Error == Reason.LinphoneReasonForbidden))
             {
                 if (RegistrationFailedNotification != null)
                 {
                     RegistrationFailedNotification.Dismiss();
                 }
                 RegistrationFailedNotification = new CustomMessageBox()
                 {
                     Caption = ResourceManager.GetString("RegistrationFailedPopupTitle", CultureInfo.CurrentCulture),
                     Message = ResourceManager.GetString("RegistrationFailedForbidden", CultureInfo.CurrentCulture),
                     RightButtonContent = AppResources.Close
                 };
                 RegistrationFailedNotification.Show();
             }
         }
         catch { }
     });
 }
 public Registration(CharacterSelector selector, RegisteredPlayerUIView ui, RegistrationState registrationState, PlayerRegistrationVisuals visuals)
 {
     this.selector = selector;
     this.ui = ui;
     this.registrationState = registrationState;
     this.visuals = visuals;
 }