public void OnPlceNumberTap(object sender, EventArgs e) { var ojbPlceNumber = sender as Grid; var objData = ojbPlceNumber.BindingContext as TourLocation; SelectedTour = objData; routeCoversListBindData(System.Int32.Parse(objData.placeNumberTitle) - 1); if (player != null) { player.Stop(); } UpdateScreenData(objData); if (SelectedTour.location_audio == "") { timer.StopTimer(); AudioPlayerGrid.IsVisible = false; stckDownload.IsVisible = false; } else { AudioPlayerGrid.IsVisible = true; stckDownload.IsVisible = true; if (timer != null) { timer.StopTimer(); timer = null; timer = DependencyService.Get <IAdvancedTimer>(); timer.InitTimer(3000, timerElapsed, false); timer.StartTimer(); } } SelectTourIndex = System.Convert.ToInt32(objData.placeNumberTitle); }
public SplashPage() { InitializeComponent(); timer = DependencyService.Get <IAdvancedTimer>(); timer.initTimer(3000, timerElapsed, true); timer.startTimer(); }
public MeteoListPage() { InitializeComponent(); BindingContext = new MeteoListViewModel(); GetWeathers(); IAdvancedTimer timer = DependencyService.Get <IAdvancedTimer>(); timer.initTimer(3000, updateCurrentLocation, true); timer.startTimer(); }
public static Page GetMainPage() { timer = DependencyService.Get <IAdvancedTimer>(); label = new Label { Text = "Hello, Forms!", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, }; Button button1 = new Button { Text = String.Format("Start timer!"), VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, }; Button button2 = new Button { Text = String.Format("Stop timer!"), VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, }; button1.Clicked += (sender, args) => { label.Text = "Timer Started!"; timer.initTimer(3000, timerElapsed, false); timer.startTimer(); }; button2.Clicked += (sender, args) => { label.Text = "Timer Stopped!"; timer.stopTimer(); }; return(new ContentPage { Content = new StackLayout { Children = { label, button1, button2 } } }); }
public static Page GetMainPage() { timer = DependencyService.Get<IAdvancedTimer>(); label = new Label { Text = "Hello, Forms!", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, }; Button button1 = new Button { Text = String.Format("Start timer!"), VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, }; Button button2 = new Button { Text = String.Format("Stop timer!"), VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, }; button1.Clicked += (sender, args) => { label.Text = "Timer Started!"; timer.initTimer(3000, timerElapsed, false); timer.startTimer(); }; button2.Clicked += (sender, args) => { label.Text = "Timer Stopped!"; timer.stopTimer(); }; return new ContentPage { Content = new StackLayout { Children = { label, button1, button2 } } }; }
protected override void OnAppearing() { imgHeader.Source = _tourPlaceURl; routeCoversListBindData(0); UpdateScreenData(_routeCovers[0]); SelectedTour = _routeCovers[0]; timer = DependencyService.Get <IAdvancedTimer>(); timer.InitTimer(3000, timerElapsed, false); timer.StartTimer(); if (Device.OS == TargetPlatform.Android) { MapBindpinsInMap(_responseMap); } }
async protected override void OnAppearing() { base.OnAppearing(); this.BindingContext = ViewModel; heartTimer = DependencyService.Get<IAdvancedTimer>(); ConfigureTimer(); TestValue.ValueChanged += TestValue_ValueChanged; ViewModel.PropertyChanged += ViewModel_PropertyChanged; // ViewModel.Beat += async delegate(int obj) // { // var b = await AnimateHeart(); // // }; // MessagingCenter.Subscribe<MainViewModel, int> (this, "Beat", async (sender, arg) => { // // do something whenever the "Hi" message is sent // // using the 'arg' parameter which is a string // await AnimateHeart(); // }); }
public CarouselImageView() { InitializeComponent(); _indicatorStyle = CarouselLayout.IndicatorStyleEnum.Dots; _viewModel = new CarouselImageViewModel(); BindingContext = _viewModel; _relativeLayout = new RelativeLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; var pagesCarousel = CreatePagesCarousel(); var dots = CreatePagerIndicatorContainer(); _relativeLayout.Children.Add(pagesCarousel, Constraint.RelativeToParent((parent) => { return(parent.X); }), Constraint.RelativeToParent((parent) => { return(parent.Y); }), Constraint.RelativeToParent((parent) => { return(parent.Width); }), Constraint.RelativeToParent((parent) => { return(parent.Height); }) ); _relativeLayout.Children.Add(dots, Constraint.Constant(0), Constraint.RelativeToView(pagesCarousel, (parent, sibling) => { return(sibling.Height - 18); }), Constraint.RelativeToParent(parent => parent.Width), Constraint.Constant(18) ); carouseContainer.Content = _relativeLayout; _timer = DependencyService.Get <IAdvancedTimer>(DependencyFetchTarget.NewInstance); _timer.InitTimer(2000, Carousel, true); }
public MainPageModel() { _timer = DependencyService.Get <IAdvancedTimer>(); ImagenesCarousel = new List <InicioCarousel> { new InicioCarousel { ImageUrl = "CarouselOne.png", }, new InicioCarousel { ImageUrl = "CarouselTwo.png", }, new InicioCarousel { ImageUrl = "CarouselThree.png", }, new InicioCarousel { ImageUrl = "CarouselFour.png", }, }; }
public LockPage() { NavigationPage.SetHasNavigationBar(this, false); BindingContext = new LockViewModel(); sec = 30; rest = 00; milliSec = 30000; _advancedTimer = Resolver.Resolve<IAdvancedTimer>(); _advancedTimer.initTimer(1000, (sender, args) => { sec--; Device.BeginInvokeOnMainThread(() => { SecLabel.Text = sec.ToString(); }); if (sec == 5) Device.BeginInvokeOnMainThread(() => { SecLabel.TextColor = Color.Red; }); Debug.WriteLine(milliSec); if (sec == 0) { _advancedTimer.stopTimer(); GameCompleted(); } }, true); NumberGrid = new Grid { VerticalOptions = LayoutOptions.CenterAndExpand, RowSpacing = 10, ColumnSpacing = 10 }; _lockService = new LockService(); NumberGrid.Children.Add(Buttons[0], 0, 1); NumberGrid.Children.Add(Buttons[1], 1, 1); NumberGrid.Children.Add(Buttons[2], 2, 1); NumberGrid.Children.Add(Buttons[3], 0, 2); NumberGrid.Children.Add(Buttons[4], 1, 2); NumberGrid.Children.Add(Buttons[5], 2, 2); NumberGrid.Children.Add(Buttons[6], 0, 3); NumberGrid.Children.Add(Buttons[7], 1, 3); NumberGrid.Children.Add(Buttons[8], 2, 3); NumberGrid.Children.Add(Buttons[9], 0, 4); NumberGrid.Children.Add(Buttons[10], 1, 4); NumberGrid.Children.Add(Buttons[11], 2, 4); // Accomodate iPhone status bar. Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5); ClockStackLayout = new StackLayout { Orientation = StackOrientation.Vertical, Children = { SecLabel } }; if (Device.Idiom == TargetIdiom.Phone) MainStackLayout = new StackLayout { VerticalOptions = LayoutOptions.End, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { ClockStackLayout, ResponsLabel, LabelAndEraseLayout, NumberGrid }, Padding = new Thickness(0, 0, 0, 10) }; if (Device.Idiom == TargetIdiom.Tablet) { var rightStack = new StackLayout { VerticalOptions = LayoutOptions.CenterAndExpand, Children = { ClockStackLayout, ResponsLabel, LabelAndEraseLayout, NumberGrid }, Padding = new Thickness(0, 0, 0, 10) }; var width = Resolver.Resolve<IDevice>().Display.Width; var leftImage = new Image { Source = "iconlogo1024x500.png", Aspect = Aspect.AspectFill, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, WidthRequest = width/2 }; var leftContentView = new ContentView { Content = leftImage, MinimumWidthRequest = Width/2, BackgroundColor = Color.White }; var leftStackLayout = new StackLayout { Orientation = StackOrientation.Vertical, Children = { leftContentView, new Button { Text = "Reset", BorderColor = Color.Green, BorderRadius = 5, Command = new Command(() => { Reset(); }), VerticalOptions = LayoutOptions.End } }, VerticalOptions = LayoutOptions.FillAndExpand }; MainStackLayout = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Children = { // leftStackLayout, rightStack } }; } Content = MainStackLayout; //_advancedTimer.startTimer(); }
public MapPageModel() { timer = DependencyService.Get<IAdvancedTimer> (); timer.initTimer (1000, timerElapsed, true); }
public ChatDetailsPage ( ObservableCollection<ChatDetails> chats,string tosusrID, string userImageUrl, string toUserName ) { App.CurrentChatUserID = tosusrID; NavigationPage.SetHasNavigationBar(this, false); chatList = chats; touserID = tosusrID; currentuser = App.Settings.GetUser (); timer = DependencyService.Get<IAdvancedTimer>(); timer.initTimer (30000, SyncChatHistoryFromServer, true); timer.startTimer (); //Xamarin.Forms.Device.StartTimer ( TimeSpan.FromSeconds( 1 ), SyncChatHistoryFromServer ); string chatTouser = toUserName; if (chatTouser.Length > 30) { chatTouser = chatTouser.Substring(0, 30); chatTouser += "..."; } progressBar = DependencyService.Get< IProgressBar > (); mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), chatTouser, Color.Black, userImageUrl, true); mainTitleBar.imageAreaTapGestureRecognizer.Tapped += (object sender, EventArgs e) => { App.masterPage.IsPresented = true; }; subTitleBar = new CommunityGemChatTitleBar(Constants.SUB_TITLE_BG_COLOR, chatTouser, userImageUrl, false); subTitleBar.BackButtonTapRecognizer.Tapped += async (object sender, EventArgs e) => { timer.stopTimer (); App.CurrentChatUserID = null; await Navigation.PopAsync(); }; masterLayout = new CustomLayout (); masterLayout.WidthRequest = App.screenWidth; masterLayout.HeightRequest = App.screenHeight - 50; masterLayout.BackgroundColor = Color.FromRgb(45, 62, 80); chatHistoryListView = new ListView(); chatHistoryListView.ItemTemplate = new DataTemplate(typeof(ChatHistoryListCell)); chatHistoryListView.SeparatorVisibility = SeparatorVisibility.None; chatHistoryListView.HeightRequest = App.screenHeight * 70 / 100; chatHistoryListView.HasUnevenRows = true; chatHistoryListView.BackgroundColor = Color.FromRgb(54, 79, 120); chatHistoryListView.ItemsSource = chatList; if( chatList != null && chatList.Count > 1 ) chatHistoryListView.ScrollTo( chatList[ chatList.Count -1 ], ScrollToPosition.End, true ); chatHistoryListView.ItemTapped += (object sender, ItemTappedEventArgs e) => { chatHistoryListView.SelectedItem = null; }; chatHistoryListView.ItemSelected += (object sender, SelectedItemChangedEventArgs e) => { chatHistoryListView.SelectedItem = null; }; ExtendedEntry chatEntry = new ExtendedEntry { Placeholder = "Enter your chat...", BackgroundColor = Color.White,//Color.White, WidthRequest = App.screenWidth * .80, HorizontalOptions = LayoutOptions.Start, TextColor = Color.Black }; chatEntry.TextChanged += ChatEntry_TextChanged; Image postChatButton = new Image(); postChatButton.Source = Device.OnPlatform("icon_send.png", "icon_send.png", "//Assets//icon_send.png"); postChatButton.VerticalOptions = LayoutOptions.Center; postChatButton.HorizontalOptions = LayoutOptions.Center; TapGestureRecognizer postChatButtonTap = new TapGestureRecognizer(); postChatButton.GestureRecognizers.Add(postChatButtonTap); StackLayout inputCountainer = new StackLayout { Spacing = Device.OnPlatform(5, 5, 1), Padding = Device.OnPlatform(5, 5, 5), Orientation = StackOrientation.Horizontal, BackgroundColor = Color.FromRgb( 45, 62, 80 ), Children = { chatEntry, postChatButton }, WidthRequest = App.screenWidth }; masterLayout.AddChildToLayout(mainTitleBar, 0, 0); masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 10)); masterLayout.AddChildToLayout ( chatHistoryListView, 0, 17 ); masterLayout.AddChildToLayout ( inputCountainer, 0, 85 ); ScrollView masterScroll = new ScrollView (); masterScroll.Orientation = ScrollOrientation.Vertical; masterScroll.Content = masterLayout; masterScroll.IsClippedToBounds = true; postChatButtonTap.Tapped += async (object sender, EventArgs e) => { ChatDetails detail = new ChatDetails(); detail.AuthorName = "prvn"; detail.Message = chatEntry.Text; detail.FromUserID = currentuser.UserId.ToString(); detail.CurrentUserid = currentuser.UserId.ToString(); chatList.Add( detail ); chatEntry.Text = ""; chatHistoryListView.ScrollTo( chatList[ chatList.Count -1 ], ScrollToPosition.End, true ); if(!string.IsNullOrEmpty( detail.Message )) await ServiceHelper.SendChatMessage( currentuser.UserId.ToString(), touserID, detail.Message ); }; /* this.Appearing += async (object sender, EventArgs e) => { progressBar.ShowProgressbar( "Preparing chat window..." ); masterScroll.IsVisible = true; chatUsersList = await ServiceHelper.GetAllChatUsers (); progressBar.HideProgressbar(); };*/ MessagingCenter.Subscribe<CrossPushNotificationListener, string>(this, "boom", (page, message) => { string pushResult = message; string[] delimiters = { "&&" }; string[] clasIDArray = pushResult.Split(delimiters, StringSplitOptions.None); string chatMessage = clasIDArray [0]; string fromUser = clasIDArray [1]; if( touserID == fromUser ) { ChatDetails detail = new ChatDetails(); detail.AuthorName = fromUser; detail.Message = chatMessage; detail.FromUserID = fromUser; detail.CurrentUserid = currentuser.UserId.ToString(); chatList.Add( detail ); if( chatList != null && chatList.Count > 1 ) chatHistoryListView.ScrollTo( chatList[ chatList.Count -1 ], ScrollToPosition.End, true ); } }); Content = masterScroll; }
public void Dispose () { timer.stopTimer (); timer = null; App.CurrentChatUserID = null; }