示例#1
0
 public void Unsubscribe()
 {
     MessagingCenter.Unsubscribe <Application>(Xamarin.Forms.Application.Current, "installer_page_goto_pre_initialize");
     MessagingCenter.Unsubscribe <Application>(Xamarin.Forms.Application.Current, "installer_page_goto_language");
     MessagingCenter.Unsubscribe <Application>(Xamarin.Forms.Application.Current, "installer_page_reopen_announcement");
 }
示例#2
0
 protected override void OnDisappearing()
 {
     base.OnDisappearing();
     MessagingCenter.Unsubscribe <object>(this, "connected");
 }
示例#3
0
 async void Save_Clicked(object sender, EventArgs e)
 {
     MessagingCenter.Send(this, "AddItem", Item);
     await Navigation.PopModalAsync();
 }
 private void FuerzasProyectoCommandExecute()
 {
     MessagingCenter.Send(this, "GoToFuerzas");
 }
 private void remove()
 {
     MessagingCenter.Send <ListItemViewModel, ListItemViewModel>(this, "remove", this);
 }
示例#6
0
 void OnTap()
 {
     MessagingCenter.Send(this, "tap");
 }
 protected override void OnDisappearing()
 {
     MessagingCenter.Unsubscribe <BinsViewModel>(this, "BinsIsLoaded");
     MessagingCenter.Unsubscribe <BinViewModel>(this, "BinsViewModel.BinSelected");
     base.OnDisappearing();
 }
示例#8
0
 public void SubscribeMessages()
 {
     MessagingCenter.Subscribe <object>(
         this,
         MessagingCenterKeys.KEY_MESSAGE_RECEIVED, async obj => { await NewMessagesFetched(); });
 }
示例#9
0
 protected override void OnAppearing()
 {
     base.OnAppearing();
     MessagingCenter.Send(this, "AllowLandscape");
 }
示例#10
0
        public async Task GetPessoas(bool ministerio)
        {
            Aguarde = true;
            try
            {
                HttpClient cliente = new HttpClient();

                if (ministerio)
                {
                    var resultadoLista = await cliente.GetStringAsync(Url_Get_PessoaMinisterio + Ministerio.IdMinisterio.ToString());

                    var listaPessoaMinisterio = JsonConvert.DeserializeObject <PessoaMinisterio[]>(resultadoLista);
                    this.PessoasDoMinisterio.Clear();
                    foreach (var pessoaMinisterio in listaPessoaMinisterio)
                    {
                        this.PessoasDoMinisterio.Add(new Pessoa
                        {
                            Celula      = pessoaMinisterio.Pessoa.Celula,
                            celula_     = pessoaMinisterio.Pessoa.celula_,
                            Chamada     = pessoaMinisterio.Pessoa.Chamada,
                            Codigo      = pessoaMinisterio.Pessoa.Codigo,
                            Email       = pessoaMinisterio.Pessoa.Email,
                            Falta       = pessoaMinisterio.Pessoa.Falta,
                            Historico   = pessoaMinisterio.Pessoa.Historico,
                            IdPessoa    = pessoaMinisterio.Pessoa.IdPessoa,
                            Img         = pessoaMinisterio.Pessoa.Img,
                            Ministerios = pessoaMinisterio.Pessoa.Ministerios,
                            NomePessoa  = pessoaMinisterio.Pessoa.NomePessoa,
                            Reuniao     = pessoaMinisterio.Pessoa.Reuniao
                        });
                    }
                }
                else
                {
                    var resultado = await cliente.GetStringAsync(Url_Get_ReuniaoPessoa + Reuniao.Id.ToString());

                    var lista = JsonConvert.DeserializeObject <ReuniaoPessoa[]>(resultado);

                    this.PessoasDaReuniao.Clear();
                    foreach (var reuniaoPessoa in lista)
                    {
                        this.PessoasDaReuniao.Add(new Pessoa
                        {
                            Celula      = reuniaoPessoa.Pessoa.Celula,
                            celula_     = reuniaoPessoa.Pessoa.celula_,
                            Chamada     = reuniaoPessoa.Pessoa.Chamada,
                            Codigo      = reuniaoPessoa.Pessoa.Codigo,
                            Email       = reuniaoPessoa.Pessoa.Email,
                            Falta       = reuniaoPessoa.Pessoa.Falta,
                            Historico   = reuniaoPessoa.Pessoa.Historico,
                            IdPessoa    = reuniaoPessoa.Pessoa.IdPessoa,
                            Img         = reuniaoPessoa.Pessoa.Img,
                            Ministerios = reuniaoPessoa.Pessoa.Ministerios,
                            NomePessoa  = reuniaoPessoa.Pessoa.NomePessoa,
                            Reuniao     = reuniaoPessoa.Pessoa.Reuniao
                        });
                    }
                }
            }
            catch (Exception exc)
            {
                MessagingCenter.Send <Exception>(exc, "FalhaListagemReuniao");
            }
            Aguarde = false;
        }
示例#11
0
		protected override void OnCreate(Bundle bundle)
		{
			Profile.Start();

			ToolbarResource = Resource.Layout.Toolbar;
			TabLayoutResource = Resource.Layout.Tabbar;

			// Uncomment the next line to run this as a full screen app (no status bar)
			//Window.AddFlags(WindowManagerFlags.Fullscreen | WindowManagerFlags.TurnScreenOn);

			base.OnCreate(bundle);

#if TEST_EXPERIMENTAL_RENDERERS
			// Fake_Flag is here so we can test for flag initialization issues
			Forms.SetFlags("Fake_Flag"/*, "CollectionView_Experimental", "Shell_Experimental"*/); 
#else
			Forms.SetFlags("UseLegacyRenderers", "SwipeView_Experimental", "MediaElement_Experimental");
#endif
			Forms.Init(this, bundle);

			FormsMaps.Init(this, bundle);
			DualScreen.DualScreenService.Init(this);
			FormsMaterial.Init(this, bundle);
			AndroidAppLinks.Init(this);
			Forms.ViewInitialized += (sender, e) => {
				//				if (!string.IsNullOrWhiteSpace(e.View.StyleId)) {
				//					e.NativeView.ContentDescription = e.View.StyleId;
				//				}
			};

			// uncomment to verify turning off title bar works. This is not intended to be dynamic really.
			//Forms.SetTitleBarVisibility (AndroidTitleBarVisibility.Never);

			if (RestartAppTest.App != null)
			{
				_app = (App)RestartAppTest.App;
				RestartAppTest.Reinit = true;
			}
			else
			{
				_app = new App();
			}

			// When the native control gallery loads up, it'll let us know so we can add the nested native controls
			MessagingCenter.Subscribe<NestedNativeControlGalleryPage>(this, NestedNativeControlGalleryPage.ReadyForNativeControlsMessage, AddNativeControls);

			// When the native binding gallery loads up, it'll let us know so we can set up the native bindings
			MessagingCenter.Subscribe<NativeBindingGalleryPage>(this, NativeBindingGalleryPage.ReadyForNativeBindingsMessage, AddNativeBindings);

			// Listen for the message from the status bar color toggle test
			MessagingCenter.Subscribe<AndroidStatusBarColor>(this, AndroidStatusBarColor.Message, color => SetStatusBarColor(global::Android.Graphics.Color.Red));

			SetUpForceRestartTest();

			// Make the activity accessible to platform unit tests
			DependencyResolver.ResolveUsing((t) => {
				if (t == typeof(Context))
				{
					return this;
				}

				return null;
			});

			LoadApplication(_app);
			if (Forms.Flags.Contains("FastRenderers_Experimental"))
			{
				var masterPage = ((_app.MainPage as MasterDetailPage)?.Master as ContentPage);
				if (masterPage != null)
					masterPage.Content = new Label { Text = "Fast Renderers" };
			}
		}
示例#12
0
 public static void sendRefresh()
 {
     MessagingCenter.Send(new MyDayFoodItem(), "RefreshMyDay");
 }
示例#13
0
 //If a user edits an item, we need to reopen the item in an addItemPage, this command is sent to MyDayPage.
 void OnEdit()
 {
     MessagingCenter.Send(this, "UpdateMyDayFoodItem");
 }
示例#14
0
 protected override void OnDisappearing()
 {
     base.OnDisappearing();
     MessagingCenter.Send(this, "PreventLandscape");
     pageIsActive = false;
 }
示例#15
0
 void OnFavourite()
 {
     MessagingCenter.Send(this, "favourite");
 }
示例#16
0
 protected override void OnDisappearing()
 {
     base.OnDisappearing();
     MessagingCenter.Send(this, "PreventLandscape"); //during page close setting back to portrait
 }
示例#17
0
 void OnDelete()
 {
     MessagingCenter.Send(this, "delete");
 }
示例#18
0
 public override void ViewDidUnload()
 {
     MessagingCenter.Unsubscribe <object>(this, MessagingCenterKeys.KEY_MESSAGE_STATUS_UPDATED);
     MessagingCenter.Unsubscribe <object>(this, MessagingCenterKeys.KEY_CONSENT_MODAL_IS_CLOSED);
     base.ViewDidUnload();
 }
示例#19
0
        public SalesDashboardPage()
        {
            _AuthenticationService = DependencyService.Get<IAuthenticationService>();

            this.SetBinding(Page.TitleProperty, new Binding() { Source = TextResources.Sales });

            #region sales chart view
            var salesChartView = new SalesDashboardChartView() { BindingContext = _SalesDashboardChartViewModel = new SalesDashboardChartViewModel() };

            #endregion

            #region leads view
            var leadsView = new LeadsView { BindingContext = _SalesDashboardLeadsViewModel = new SalesDashboardLeadsViewModel(new Command(PushTabbedLeadPageAction)) };
            #endregion

            _ScrollView = new ScrollView
            { 
                Content = new StackLayout
                {
                    Spacing = 0,
                    Children =
                    {
                        salesChartView,
                        leadsView
                    }
                }
            };
                        
            #region compose view hierarchy
            if (Device.OS == TargetPlatform.Android)
            {
                _Fab = new FloatingActionButtonView
                {
                    ImageName = "fab_add.png",
                    ColorNormal = Palette._001,
                    ColorPressed = Palette._002,
                    ColorRipple = Palette._001,
                    Clicked = (sender, args) => 
                            _SalesDashboardLeadsViewModel.PushTabbedLeadPageCommand.Execute(null),
                };

                var absolute = new AbsoluteLayout
                { 
                    VerticalOptions = LayoutOptions.FillAndExpand, 
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                };

                // Position the pageLayout to fill the entire screen.
                // Manage positioning of child elements on the page by editing the pageLayout.
                AbsoluteLayout.SetLayoutFlags(_ScrollView, AbsoluteLayoutFlags.All);
                AbsoluteLayout.SetLayoutBounds(_ScrollView, new Rectangle(0f, 0f, 1f, 1f));
                absolute.Children.Add(_ScrollView);

                // Overlay the FAB in the bottom-right corner
                AbsoluteLayout.SetLayoutFlags(_Fab, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(_Fab, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
                absolute.Children.Add(_Fab);

                Content = absolute;
            }
            else
            {
                ToolbarItems.Add(new ToolbarItem("Add", "add_ios_gray", () =>
                    _SalesDashboardLeadsViewModel.PushTabbedLeadPageCommand.Execute(null)));

                Content = _ScrollView;
            }
            #endregion

            #region wire up MessagingCenter
            // Catch the login success message from the MessagingCenter.
            // This is really only here for Android, which doesn't fire the OnAppearing() method in the same way that iOS does (every time the page appears on screen).
            Device.OnPlatform(Android: () => MessagingCenter.Subscribe<SplashPage>(this, MessagingServiceConstants.AUTHENTICATED, sender => OnAppearing()));
            #endregion
        }
示例#20
0
        public MainPage()
        {
            _eventTimes = new List <string> ();

            var clearButton = new Button {
                Text = "Clear"
            };

            clearButton.Clicked += (sender, e) => {
                _eventTimes.Clear();
                UpdateList();
            };

            var publishButton = new Button {
                Text = "Publish"
            };

            publishButton.Clicked += (sender, e) => {
                MessagingCenter.Send <MainPage, DateTime>(this, "boom", DateTime.Now);
            };

            var subUnsubButton = new Button {
                Text = "Subscribe"
            };

            subUnsubButton.Clicked += (sender, e) => {
                _isSubscribed = !_isSubscribed;

                if (_isSubscribed)
                {
                    subUnsubButton.Text = "Unsubscribe";
                    MessagingCenter.Subscribe <MainPage, DateTime>(this, "boom", (page, time) => {
                        _eventTimes.Add(time.ToString());
                        UpdateList();
                    });
                }
                else
                {
                    subUnsubButton.Text = "Subscribe";
                    MessagingCenter.Unsubscribe <MainPage, DateTime>(this, "boom");
                }
            };

            var buttonStack = new StackLayout {
                Spacing           = 20,
                Padding           = 20,
                Orientation       = StackOrientation.Horizontal,
                Children          = { publishButton, subUnsubButton, clearButton },
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            _eventList = new ListView {
                ItemsSource = new ObservableCollection <string>(_eventTimes)
            };

            var mainStackLayout = new StackLayout {
                Children          = { buttonStack, _eventList },
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };

            Content = mainStackLayout;
        }
示例#21
0
 protected override void OnResume()
 {
     // Handle when your app resumes
     MessagingCenter.Send <object>(this, Constants.re_open_connection);
 }
 private void ClickedToddler()
 {
     _navigation.NavigateAsync(nameof(ChangeGradeView));
     MessagingCenter.Send(Application.Current, Constant.SendToddlerInformation, _selectedToddler);
     Debug.WriteLine(Constant.SendToddlerInformation + _selectedToddler);
 }
 private void toggleIsRead()
 {
     IsRead = ((IsRead == "Yes") ? "No" : "Yes");
     MessagingCenter.Send <ListItemViewModel, int>(this, "update", Number);
 }
示例#24
0
 public override void OnActivated(UIApplication uiApplication)
 {
     base.OnActivated(uiApplication);
     MessagingCenter.Send((object)this, AppConstants.IosOnActivatedMessage);
 }
示例#25
0
        public static async Task <(List <IDisposable>, HubConnection)> EstablishSignalRConnectionAsync(string token, ListAggregationViewModel vm,
                                                                                                       IConfiguration configuration, Func <Task <User> > RequestForNewData, ListItemService listItemService,
                                                                                                       Action <string> SetInvitationString)
        {
            var           signalRAddress = configuration.GetSection("AppSettings")["SignlRAddress"];
            HubConnection hubConnection  = new HubConnectionBuilder().WithUrl(signalRAddress, (opts) =>
            {
                opts.Headers.Add("Access_Token", token);

                opts.HttpMessageHandlerFactory = (message) =>
                {
                    if (message is HttpClientHandler clientHandler)
                    {
                        // bypass SSL certificate
                        clientHandler.ServerCertificateCustomValidationCallback +=
                            (sender, certificate, chain, sslPolicyErrors) => { return(true); }
                    }
                    ;
                    return(message);
                };
            }).WithAutomaticReconnect().Build();


            var dataAreChangeDispose = hubConnection.On("DataAreChanged_" + App.User.UserId,
                                                        async() =>
            {
                var data = await RequestForNewData();

                MessagingCenter.Send <ListAggregationViewModel, User>(vm, "New Data", data);

                return;
            });

            var listItemArechangeDispose = hubConnection.On("ListItemAreChanged_" + App.User.UserId,
                                                            async(string command, int?id1, int?listAggregationId, int?parentId) =>
            {
                if (command.EndsWith("ListItem"))
                {
                    var item = await listItemService.GetItem <ListItem>((int)id1, (int)listAggregationId);

                    if (command == "Edit/Save_ListItem")
                    {
                        var lists = App.User.ListAggregators.Where(a => a.ListAggregatorId == listAggregationId).FirstOrDefault();

                        ListItem foundListItem = null;
                        foreach (var listItem in lists.Lists)
                        {
                            foundListItem = listItem.ListItems.Single(a => a.Id == id1);
                            if (foundListItem != null)
                            {
                                break;
                            }
                        }
                        foundListItem.ListItemName = item.ListItemName;
                        foundListItem.State        = item.State;
                    }
                    else
                    if (command == "Add_ListItem")
                    {
                        var tempList = App.User.ListAggregators.Where(a => a.ListAggregatorId == listAggregationId).FirstOrDefault().
                                       Lists.Where(a => a.ListId == parentId).FirstOrDefault().ListItems;

                        if (!tempList.Where(a => a.Id == item.Id).Any())
                        {
                            tempList.Add(item);
                        }
                        MessagingCenter.Send <ListAggregationViewModel, User>(vm, "New Data", App.User);
                    }
                    else
                    if (command == "Delete_ListItem")
                    {
                        var lists = App.User.ListAggregators.Where(a => a.ListAggregatorId == listAggregationId).FirstOrDefault();

                        ListItem foundListItem = null;
                        List founfList         = null;

                        foreach (var listItem in lists.Lists)
                        {
                            founfList     = listItem;
                            foundListItem = listItem.ListItems.FirstOrDefault(a => a.Id == id1);
                            if (foundListItem != null)
                            {
                                break;
                            }
                        }

                        founfList.ListItems.Remove(foundListItem);

                        MessagingCenter.Send <ListAggregationViewModel, User>(vm, "New Data", App.User);
                    }
                }
            });

            var newInvitationDispose = hubConnection.On("NewInvitation_" + App.User.UserId, async() =>
            {
                SetInvitationString("NEW");
            });



            List <IDisposable> disposables = new List <IDisposable>(new[]
                                                                    { newInvitationDispose, listItemArechangeDispose, dataAreChangeDispose });


            await hubConnection.StartAsync();

            return(disposables, hubConnection);
        }
 private void CancelarAssinaturas()
 {
     MessagingCenter.Unsubscribe <Usuario>(this, "MeusAgendamentos");
 }
示例#27
0
        protected override void ViewIsDisappearing(object sender, EventArgs e)
        {
            base.ViewIsDisappearing(sender, e);

            MessagingCenter.Unsubscribe <SPService, string>(this, "SP_REQUEST_STATUS");
        }
示例#28
0
 partial void GoToForceUpdate_TouchUpInside(UIButton sender)
 {
     MessagingCenter.Send <object>(this, MessagingCenterKeys.KEY_FORCE_UPDATE);
 }
示例#29
0
 protected override void OnDisappearing()
 {
     base.OnDisappearing();
     MessagingCenter.Unsubscribe <CustomNavigationBar>(this, "ToggleDrawer");
 }
 void OnOrientationChanged(object sender, OrientationChangedEventArgs e)
 {
     MessagingCenter.Send(this, Forms.WP8DeviceInfo.BWPorientationChangedName, e.Orientation.ToDeviceOrientation());
 }