Пример #1
0
        public EmergencyNotificationMonitor(Notificacao msg)
        {
            InitializeComponent();

            //OnFinalizeEmergencyActivated.IsVisible = (msg.NotificationType.Equals(Constants.TypeEmergency)) ? true : false;
            //OnFinalizeAlarmActivated.IsVisible = (msg.NotificationType.Equals(Constants.TypeAlarm)) ? true : false;

            Task.Run(async() => { await SireneServices.GetInstance().MonitoringNotification(msg); });

            OnFinalizeEmergencyActivated.Clicked += async(sender, args) =>
            {
                await SireneServices.GetInstance().FinalizeNotification(Constants.IdComunidadeQuery, UserManager.GetLogUser());

                await Navigation.PopToRootAsync();
            };
        }
Пример #2
0
        public EmergencyNotificationReceiver(string groupName)
        {
            InitializeComponent();

            OnIamSafe.Clicked += async(sender, args) =>
            {
                Usuario user = UserManager.GetLogUser();
                await SireneServices.GetInstance().ReplyNotification(user, groupName, Constants.SafeResponse);

                await Navigation.PopToRootAsync();
            };

            OnNeedHelp.Clicked += async(sender, args) =>
            {
                Usuario user = UserManager.GetLogUser();
                await SireneServices.GetInstance().ReplyNotification(user, groupName, Constants.NeedHelpResponse);

                await Navigation.PopToRootAsync();
            };
        }
Пример #3
0
        protected override async void OnAppearing()
        {
            try
            {
                base.OnAppearing();

                string condoId = UserManager.GetLogUser().IdComunidadeUsu;
                await SireneServices.GetInstance().CreateOrOpenGroup(UserManager.GetLogUser());

                TiposMensagens = await TipoMsgService.GetInstance().GetMsgTypeList(Constants.IdComunidadeQuery, condoId);

                foreach (TipoMessagem msg in TiposMensagens)
                {
                    spreadedMessageType.Items.Add(msg.MsgTipo);
                }
            }
            catch (Exception e)
            {
                StringBuilder errorSb = new StringBuilder();
                errorSb.Append("Error: ");
                errorSb.Append(e.ToString());
            }
        }
Пример #4
0
        public EmergencyNotificationTrigger()
        {
            InitializeComponent();

            OnEmergencyActivated.Clicked += async(sender, args) =>
            {
                try
                {
                    var    msg     = spreadedMessage.Text.Trim();
                    string msgType = spreadedMessageType.Items[spreadedMessageType.SelectedIndex];
                    var    grp     = GetGroupName();
                    if (msg.Length > 0)
                    {
                        await SireneServices.GetInstance().SendMessage(UserManager.GetLogUser(), msgType, msg, grp);
                    }
                }
                catch (Exception e)
                {
                    StringBuilder errorSb = new StringBuilder();
                    errorSb.Append("Error: ");
                    errorSb.Append(e.ToString());
                }
            };
        }
Пример #5
0
 protected override void OnResume()
 {
     //Handle when your app resumes
     Task.Run(async() => { await SireneServices.GetInstance().GetIn(UserManager.GetLogUser()); });
 }
Пример #6
0
 public async void AddUserConnectionId(Usuario user)
 {
     await SireneServices.GetInstance().AddUserConnectionId(user);
 }
Пример #7
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            SireneIdAccess = CrossDeviceInfo.Current.Id;

            if (SireneIdAccess != null)
            {
                CurrentUser = await UsuarioService.GetInstance().GetUser(Constants.IdAccessQuery, SireneIdAccess);

                if (CurrentUser != null)
                {
                    //Logando na API no Azure.
                    await SireneServices.GetInstance().Login(CurrentUser);

                    OpenNotificationScreen(CurrentUser);

                    //List<string> profile = JsonConvert.DeserializeObject<List<string>>(CurrentUser.UserProfile);
                    menuHeader.IsVisible = true;

                    if (CurrentUser.PerfilUsuario == "Adm Geral")
                    {
                        emergencia.IsVisible = true;
                        comunidade.IsVisible = true;
                        mensagem.IsVisible   = true;
                        usuario.IsVisible    = true;
                    }
                    else if (CurrentUser.PerfilUsuario == "Adm Comunidade")
                    {
                        emergencia.IsVisible = true;
                        mensagem.IsVisible   = true;
                        usuario.IsVisible    = true;
                    }
                    else if (CurrentUser.PerfilUsuario == "Operador")
                    {
                        emergencia.IsVisible = true;
                    }
                }
                else
                {
                    emergencia.IsVisible = false;
                    comunidade.IsVisible = false;
                    mensagem.IsVisible   = false;
                    usuario.IsVisible    = false;

                    regAtivHeader.IsVisible = true;
                    regRotuloAtiv.IsVisible = true;
                    codigoUsu.IsVisible     = true;
                    regBtAtivacao.IsVisible = true;
                }
            }
            else
            {
                emergencia.IsVisible = false;
                comunidade.IsVisible = false;
                mensagem.IsVisible   = false;
                usuario.IsVisible    = false;

                regAtivHeader.IsVisible = true;
                regRotuloAtiv.IsVisible = true;
                codigoUsu.IsVisible     = true;
                regBtAtivacao.IsVisible = true;
            }
        }