public void ChangeSettings(object sender, EventArgs args)
        {
            bool CurrentConnectionStatus = SignalRService.IsConnected;

            if (CurrentConnectionStatus)
            {
                SignalRService.CloseConnection();
            }

            ConnectionSettings = ConnectionSettingsChanged;

            UserInfo = UserInfoChanged;

            IsActivated = IsActivatedChange;

            SignalRService.Settings = ConnectionSettings;

            SignalRService.UserInfo = UserInfo;

            if (CurrentConnectionStatus && IsActivated)
            {
                SignalRService.StartConnection();
            }

            ConnectionService.Settings = ConnectionSettings;

            DataStorageService.StoreData(UserInfo, "UserInfo.json", this);
            DataStorageService.StoreData(ConnectionSettings, "ConnectionSettings.json", this);
            DataStorageService.StoreData(IsActivated, "IsActivated.json", this);

            Reciver.OnReceive(this, new Intent());
        }
Beispiel #2
0
        protected async override void OnAppearing()
        {
            if (!initialDataLoaded)
            {
                chatService = new SignalRService();
                chatService.OnMessageReceived += AppendMessage;
                chatService.ConfigureConnection(GroupPage.GroupId);

                await LoadMessages();

                initialDataLoaded = true;
            }

            if (!chatService.IsConnected)
            {
                await chatService.StartConnection();
            }

            base.OnAppearing();
        }