private void SetTimer(int i) { switch (i) { case 0: //"Begin cycles": CrossVibrate.Current.Vibration(1000); State.Text = "State: [25 min] Working!"; onStart(); TimerState(); break; case 1: //"pause" StartButton.Text = "Resume"; timer.stopTimer(); timerFlag = false; TimerState(); break; case 2: //"resume": StartButton.Text = "Pause"; timer.startTimer(); timerFlag = true; TimerState(); break; case 3: // "work": CrossVibrate.Current.Vibration(1000); TimeLeft.Text = "25:00"; timerTime = 25 * 60 * 1000; State.Text = "State: [25 min] Working."; TimerState(); break; case 4: // "rest": CrossVibrate.Current.Vibration(1000); TimeLeft.Text = "5:00"; timerTime = 5 * 60 * 1000; State.Text = "State: [5 min] Resting."; TimerState(); break; case 5: // "relax": CrossVibrate.Current.Vibration(1000); TimeLeft.Text = "35:00"; timerTime = 35 * 60 * 1000; State.Text = "State: [35 min] Relaxing"; TimerState(); break; } return; }
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 } } }; }
private void timerPracaHandler(object sender, EventArgs e) { if (Praca == 0) { widocznoscPraca = false; timerPraca.stopTimer(); widocznoscOdpoczynek = true; Kolor = "#82d845"; CrossTextToSpeech.Current.Speak("Rest"); timerOdpoczynek.startTimer(); } else { Praca--; if (Praca <= 3) { CrossTextToSpeech.Current.Speak(Praca.ToString()); } } }
public void Trening() { Serie--; CrossTextToSpeech.Current.Speak("Work"); Praca = pomP; if (Serie == 0) { Odpoczynek = 0; } else { Odpoczynek = pomO; } timerPraca.startTimer(); Kolor = "#e85151"; widocznoscPraca = true; if (Praca == 0 && timerOdpoczynek.isTimerEnabled() == false) { timerPraca.stopTimer(); } }
public Timer(Action TimerElapsed) { timer.initTimer(InactivityIntervalInMs, (sender, e) => TimerElapsed(), false); timer.startTimer(); }
/// <summary> /// Starts the totalTimer and sets DateTime property. /// </summary> public void StartTimer() { StartTime = DateTime.Now; totalTimer.startTimer(); }
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; }