public SplashPage() { InitializeComponent(); timer = DependencyService.Get <IAdvancedTimer>(); timer.initTimer(3000, timerElapsed, true); timer.startTimer(); }
public bool onStart() { timerTime = 25 * 60 * 1000; StartButton.Text = "Pause"; rounds = 4; timer.initTimer(1000, timerElapsed, false); timerFlag = true; timer.startTimer(); phase = 1; // select next phase to be resting return(true); }
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 } } }; }
public Ekran4ViewModel() { MessagingCenter.Subscribe <Ekran3ViewModel, Tabata>(this, "Hi", (sender, arg) => { Serie = arg.serie; Praca = arg.praca; Odpoczynek = arg.odpoczynek; pomO = arg.odpoczynek; pomP = arg.praca; }); timerPraca.initTimer(1000, timerPracaHandler, true); timerOdpoczynek.initTimer(1000, timerOdpoczynekHandler, true); MessagingCenter.Subscribe <ekran4, bool>(this, "odpowiedz", (sender, values) => { if (values == true) { App.Navigation.PopAsync(); } }); }
public Timer(Action TimerElapsed) { timer.initTimer(InactivityIntervalInMs, (sender, e) => TimerElapsed(), false); timer.startTimer(); }
/// <summary> /// Initialize totalTimer. /// </summary> public void Initialize() { totalTimer.initTimer(interval, TimerElapsedEvent, true); }
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; }