protected override void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { DebugSettings.EnableFrameRateCounter = true; } #endif // Recommended that you hide the status bar StatusBar.GetForCurrentView().HideAsync(); var rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { // ToastFrame is constructed and used here rootFrame = new ToastFrame(); rootFrame.CacheSize = 1; Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { if (!rootFrame.Navigate(typeof(MainPage), e.Arguments)) { throw new Exception("Failed to create initial page"); } } Window.Current.Activate(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { _frame = (ToastFrame)Frame; }
/// <summary> /// RecordItem Screen Constructor /// </summary> /// <param name="selectedItem"></param> public RecordItem(object selectedItem) { InitializeComponent(); Connection_Button.WidthRequest = Device.Idiom == TargetIdiom.Tablet ? 330 : 230; if (HaccpAppSettings.SharedInstance.IsWindows) { TempLabelGrid.IsVisible = false; } NavigationPage.SetBackButtonTitle(this, string.Empty); _viewModel = new RecordTempViewModel(this, selectedItem as LocationMenuItem); BindingContext = _viewModel; //Button btn; toggleBtn.Clicked += (sender, e) => { if (_viewModel.IsManualEntryOn) { manualEntry.Focus(); } }; manualEntry.Focused += (sender, e) => { if (Device.Idiom != TargetIdiom.Tablet) { bottomgrid.IsVisible = bottomline.IsVisible = false; } if (HaccpAppSettings.SharedInstance.IsWindows) { if (!string.IsNullOrEmpty(manualEntry.Text)) { string value = manualEntry.Text; value = value.Replace(_viewModel.UnitString, string.Empty); manualEntry.Text = value; } } }; editorcontrol.Focused += (sender, e) => { bottomgrid.IsVisible = bottomline.IsVisible = false; }; manualEntry.Unfocused += (sender, e) => { //make visible bottom control after the entry keyboard dismissal Task.Delay(200).ContinueWith((t, s) => { Device.BeginInvokeOnMainThread(() => { if (!editorcontrol.IsFocused) { bottomgrid.IsVisible = bottomline.IsVisible = true; } }); }, new object()); if (HaccpAppSettings.SharedInstance.IsWindows) { if (!string.IsNullOrEmpty(manualEntry.Text)) { string value = manualEntry.Text; value = value.Replace(_viewModel.UnitString, string.Empty); manualEntry.Text = string.Format("{0}{1}", value, _viewModel.UnitString); } } }; editorcontrol.Unfocused += (sender, e) => { //make visible bottom control after the entry keyboard dismissal Task.Delay(200).ContinueWith((t, s) => { Device.BeginInvokeOnMainThread(() => { if (!manualEntry.IsFocused) { bottomgrid.IsVisible = bottomline.IsVisible = true; } }); }, new object()); }; AddToolBarButton("home.png", _viewModel.HomeCommand); MessagingCenter.Subscribe <RecordSaveCompleteToast>(this, HaccpConstant.ToastMessage, sender => { editorcontrol.IsEnabled = false; var second = 1; ToastFrame.IsVisible = true; ToastFrame.Opacity = 1; var timerOn = true; Device.StartTimer(new TimeSpan(0, 0, 0, second), () => { second++; if (second == 3) { ToastFrame.FadeTo(0, 250, Easing.Linear); } if (second == 4) { _viewModel.CheckAutoAdvance(); timerOn = false; } return(timerOn); }); }); }