public MenuPageViewModel(INavigation navigation = null) : base(navigation) { _helper = DependencyService.Get <IHelper>(); ApplicationVersion = string.Format(TextResources.AppVersion, App.Configuration.AppConfig.ApplicationVersion); User = App.CurrentUser.UserInfo; }
public BatteryDemo() { InitializeComponent(); StackLayout stack = new StackLayout(); var button = new Button { Text = "Click for battery info", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, }; button.Clicked += (sender, e) => { var bat = DependencyService.Get <IBattery>(); switch (bat.PowerSource) { case PowerSource.Battery: button.Text = "Battery - "; break; case PowerSource.Ac: button.Text = "AC - "; break; case PowerSource.Usb: button.Text = "USB - "; break; case PowerSource.Wireless: button.Text = "Wireless - "; break; case PowerSource.Other: default: button.Text = "Unknown - "; break; } switch (bat.Status) { case BatteryStatus.Charging: button.Text += "Charging"; break; case BatteryStatus.Discharging: button.Text += "Discharging"; break; case BatteryStatus.NotCharging: button.Text += "Not Charging"; break; case BatteryStatus.Full: button.Text += "Full"; break; case BatteryStatus.Unknown: default: button.Text += "Unknown"; break; } }; stack.Children.Add(button); Content = stack; }
public static void LongMessage(string message) { DependencyService.Get <IMessage>().LongAlert(message); }
public static void EnviarCorreo(string direccion, string asunto, string mensaje) { var correo = DependencyService.Get <ICorreo>(); correo.CrearCorreo(direccion, asunto, mensaje); }
void OpenSearchOptions() { DependencyService.Get <MainPage>().Detail.Navigation.PushAsync(_optionsSearchPage); }
public SettingsPage() { Resources = DependencyService.Resolve <ResourceDictionary>(); InitializeComponent(); }
public async Task LoginAsync(MobileServiceAuthenticationProvider provider) { var loginProvider = DependencyService.Get <ILoginProvider>(); await loginProvider.LoginAsync(client, provider); }
private void FireReceiveNotification() { DependencyService.Get <INotificationService>().ReceiveNotification(null); }
public DataStore() { Repositorio = DependencyService.Get <TRepository>(); }
public BackButtonPress() { _notificator = DependencyService.Get <IToastNotificator>(); _backPressPeriod = DateTime.Now.AddDays(-1); clickAttempts = 0; }
private void Share_Tapped(object sender, EventArgs e) { DependencyService.Get <ISocial>().ShareLink("Estoy escuchando Radio Zonica!! www.radiozonica.com.ar"); }
/// <summary> /// Initializes a new instance of the class <see cref="BluetoothPageViewModel"/> /// </summary> /// <param name="eventAggregator"></param> /// <param name="navigationService"></param> /// <param name="userRepository"></param> /// <param name="userSettingsRepository"></param> /// <param name="sensorRepository"></param> /// <param name="bleService"></param> public BluetoothPageViewModel(IEventAggregator eventAggregator, INavigationService navigationService, IUserRepository userRepository, IUserSettingsRepository userSettingsRepository, ISensorRepository sensorRepository, IGlucoseMeasureRepository glucoseMeasureRepository, BluetoothScanService bleService, AppSettings settings) : base(navigationService) { this.eventAggregator = eventAggregator; this.settings = settings; InitializeDeviceItemTemplate(); this.BleService = bleService; this.UserRepository = userRepository; this.UserSettingsRepository = userSettingsRepository; this.GlucoseMeasureRepository = glucoseMeasureRepository; this.CurrentUser = this.UserRepository.GetCurrentUser(); this.CurrentUserSettings = this.UserSettingsRepository.GetCurrentUserSettings(); this.DeviceIsBoundedToUser = this.CurrentUser.DeviceIsBounded; this.availableDevices = new ObservableCollection <Models.Device>(); this.CalibrationSourceValue = this.CurrentUserSettings.CalibrationSourcedValue; this.CalibrationRevisedValue = this.CurrentUserSettings.CalibrationRevisedValue; this.IsBluetoothActive = this.BleService.Ble.IsOn; //Visual var initialization this.IsFocused = false; // The measure background service this.MeasureService = DependencyService.Get <IMeasure>(DependencyFetchTarget.GlobalInstance); // if current user has an affected device, we set the position to the 3rd tab if (DeviceIsBoundedToUser) { this.CarouselPosition = this.settings.BLUETOOTH_INDEX_PAGE_DEVICE; } else { this.CarouselPosition = this.settings.BLUETOOTH_INDEX_PAGE_DEFAULT; } // Unregister device command this.UnregisterDeviceCommand = new DelegateCommand(() => UnregisterDevice(true)); // Register scan device command this.ScanDeviceCommand = new DelegateCommand(() => ScanForDevices()); // Register the save calibration command this.UnfocusCalibrationCommand = new DelegateCommand(() => { this.IsFocused = false; //Reset value if (CalibrationRevisedValue == 0f) { CalibrationRevisedValue = AjustedValueTmp; } SaveCalibrationValues(true); App.Current.MainPage.DisplayAlert("", Utils.GetTranslation("BluetoothPage_CalibrationSaved"), Utils.GetTranslation("OK")); this.CalibrationSourceValue = CalibrationRevisedValue; Analytics.TrackEvent(AnalyticsEvent.BluetoothCalibrationChanged); }); // this.FocusAdjustedValueCommand = new DelegateCommand(() => { this.IsFocused = true; AjustedValueTmp = CalibrationRevisedValue; this.CalibrationRevisedValue = 0f; }); // Register to events this.eventAggregator.GetEvent <BluetoothStateChangeEvent>().Subscribe((value) => { switch (value) { case Plugin.BLE.Abstractions.Contracts.BluetoothState.TurningOn: this.IsBluetoothActive = true; break; case Plugin.BLE.Abstractions.Contracts.BluetoothState.TurningOff: this.IsBluetoothActive = false; break; } }); this.eventAggregator.GetEvent <NotificationMeasureEvent>().Subscribe(value => { this.CalibrationSourceValue = value.NewMeasure; this.CalibrationRevisedValue = value.NewMeasure; }); }
public void OnResult(Object result) { DependencyService.Get <IGoogleSignInService>().InvokeSignedIn(null); }
public LocalDatabaseManager() { _sqliteConnetion = DependencyService.Get <ISQLite>().GetConnection(); // _sqliteConnetion.DropTable<Customer>(); CreateTables(); }
public NotificationService() { _notificationManager = DependencyService.Get <INotificationManager>(); _notificationManager.Initialize(); _notificationManager.NotificationReceived += OnNotificationReceived; }
private void InitStyles() { var theme = DependencyService.Get <AppTheme>(); theme.InitTheme(); }
public void SetUp() { Xamarin.Forms.Mocks.MockForms.Init(); DependencyService.Register <IDataService, SqliteDatabaseDataService>(); DependencyService.Register <IPlatform, UnitTestPlatform>(); }
private async void Submit_Clicked(object sender, EventArgs e) { try { HttpClient _client = new HttpClient(); var radio = sender as CustomRadioButton; OrderConfirmation order = new OrderConfirmation(); ReportTuble report = new ReportTuble(); if (paymenttype != null) { var text = paymenttype; HubData data = new HubData(); data = JsonConvert.DeserializeObject <HubData>(Helper.Settings.permantdata) as HubData; var payments = data.PaymentMethods; Ambulance.Paramedic.Models.Payment pay = new Ambulance.Paramedic.Models.Payment(); foreach (Ambulance.Paramedic.Models.Payment item in payments) { if (item.Type == paymenttype) { order.PaymentId = item.Id; } } if (order.PaymentId != null) { order.OrderStatus = true; order.HospitalId = hospitalid; order.OrderId = data.OrderId; order.ArrivalTime = DateTime.Now; var Json = JsonConvert.SerializeObject(order); //ConfirmOrder var uri = new Uri(string.Format(Settings.Ngrok + "Paramedic/ConfirmOrder", string.Empty)); var content = new StringContent(Json, Encoding.UTF8, "application/json"); HttpResponseMessage response; response = await _client.PostAsync(uri, content); if (response.IsSuccessStatusCode) { DependencyService.Get <Toast>().Show("send succesfully"); await Navigation.PushModalAsync(new ParamedicProfile()); //await Navigation.PushModalAsync(new MainPage()); } else { DependencyService.Get <Toast>().Show("Faild to send Request"); } } else { DependencyService.Get <Toast>().Show("Invalid Payment Method"); } } else { await DisplayAlert("Hint", "Payment must be selected", "OK"); } } catch (Exception exception) { DependencyService.Get <Toast>().Show("No Internet connection"); } }
private void SendNotification(object sender, EventArgs e) { DependencyService.Get <INotification>().CreateNotification("XFBDBoys", message.Text); }
public TodoItemPageCS() { Title = "Todo Item"; var nameEntry = new Entry(); nameEntry.SetBinding(Entry.TextProperty, "Name"); var notesEntry = new Entry(); notesEntry.SetBinding(Entry.TextProperty, "Notes"); var doneSwitch = new Switch(); doneSwitch.SetBinding(Switch.IsToggledProperty, "Done"); var saveButton = new Button { Text = "Save" }; saveButton.Clicked += async(sender, e) => { var todoItem = (TodoItem)BindingContext; //await App.Database.SaveItemAsync(todoItem); await Navigation.PopAsync(); }; var deleteButton = new Button { Text = "Delete" }; deleteButton.Clicked += async(sender, e) => { var todoItem = (TodoItem)BindingContext; //await App.Database.DeleteItemAsync(todoItem); await Navigation.PopAsync(); }; var cancelButton = new Button { Text = "Cancel" }; cancelButton.Clicked += async(sender, e) => { await Navigation.PopAsync(); }; var speakButton = new Button { Text = "Speak" }; speakButton.Clicked += (sender, e) => { var todoItem = (TodoItem)BindingContext; DependencyService.Get <ITextToSpeech>().Speak(todoItem.Name + " " + todoItem.Notes); }; Content = new StackLayout { Margin = new Thickness(20), VerticalOptions = LayoutOptions.StartAndExpand, Children = { new Label { Text = "Name" }, nameEntry, new Label { Text = "Notes" }, notesEntry, new Label { Text = "Done" }, doneSwitch, saveButton, deleteButton, cancelButton, speakButton } }; }
public static void HideKeyboard() { IKeyboardHelper k = DependencyService.Get<IKeyboardHelper>(); k.HideKeyboard(); }
public DatabaseHelper() { sqliteconnection = DependencyService.Get <ISQLite>().GetConnection(); sqliteconnection.CreateTable <ContactInfo>(); }
/********** Profile Content View : START **********/ public async Task GetUserAsync(bool showTracker = false) { try { MilestoneRequired = false; UserDetail = await _userPivotService.GetFullAsync(); if (UserDetail == null) { App.GoToAccountPage(); return; } UserGreeting = string.Format(TextResources.GreetingUser, UserDetail.DisplayName); if ((UserDetail.Achievement?.AchievementIcon ?? null) != null) { BadgeAchievedImage = ImageResizer.ResizeImage(DependencyService.Get <IMessage>() .GetResource(UserDetail.Achievement.AchievementIcon), _imageSizeBadge); } JoiningDate = string.Format(CommonConstants.DATE_FORMAT_MMM_d_yyyy, UserDetail.UserRegistered); double.TryParse(UserDetail.MetaPivot.WeightLossGoal, out double yourGoal); YourGoal = yourGoal; TargetDate = UserDetail.TargetDate; // "Sunday, March 9, 2008" UserTrackers = UserDetail.TrackerPivot.ToList(); var trackerFirst = UserTrackers.OrderBy(t => t.ModifyDate).FirstOrDefault(); var trackerLast = UserTrackers.OrderBy(t => t.ModifyDate).LastOrDefault(); MilestoneRequired = trackerFirst == null; if (trackerFirst != null && trackerLast != null) { double.TryParse(trackerFirst.CurrentWeight, out double firstWeight); StartWeight = firstWeight; Weight = StartWeight; WeightLossGoal = YourGoal; double.TryParse(trackerLast.CurrentWeight, out double lastWeight); YouLost = (short)(StartWeight - lastWeight); ToLoose = (short)(YourGoal - YouLost); ToLoose = (short)(ToLoose >= 0 ? ToLoose : 0); if (UserTrackers.Count != 1) { double.TryParse(UserTrackers.OrderBy(t => t.ModifyDate) .LastOrDefault(t => t.RevisionNumber != trackerLast?.RevisionNumber)?.CurrentWeight, out double previousWeight); YouLostThisWeek = (short)(previousWeight - lastWeight); } // Milestone Requirement Check MilestoneRequired = UserDetail.IsWeightSubmissionRequired; } LoadGauge(); GetTrackerData(); if (showTracker && MilestoneRequired) { await Task.Delay(TimeSpan.FromMilliseconds(1500)); Device.BeginInvokeOnMainThread(async() => { await App.CurrentApp.MainPage.Navigation.PushModalAsync( new Pages.Milestone.UserMilestonePage(Root, null)); }); } } catch (Exception ex) { var exceptionHandler = new ExceptionHandler(typeof(MyProfileViewModel).FullName, ex); // } }
public MainPage() { InitializeComponent(); auth = DependencyService.Get <IAuth>(); }
void ViewGameItem(GameShortDetails gameShortDetails) { DependencyService.Get <MainPage>().Detail.Navigation.PushAsync(new InfoGamePage(gameShortDetails)); }
public DatabaseCubeOpslagController() { database = DependencyService.Get <ISQLite>().GetConnection(); database.CreateTable <DatabaseCubeOpslag>(); }
public MemberDataStore() { conn = DependencyService.Get <ISqliteDB>().GetConnection(); conn.CreateTable <Member>(); members = conn.Table <Member>().ToList(); }
public TranslateExtension() { _ci = string.IsNullOrEmpty("") ? DependencyService.Get <ILocalize>().GetCurrentCultureInfo() : DependencyService.Get <ILocalize>().GetCurrentCultureInfo("km"); switch (_ci.Name) { case "km-KH": _resourceId = "Memories.Resx.AppResource.kh"; break; case "en-US": _resourceId = "Memories.Resx.AppResource"; break; } }
public static void ShortMessage(string message) { DependencyService.Get <IMessage>().ShortAlert(message); }
public TranslateExtension() { ci = DependencyService.Get <ILocalize>().GetCurrentCultureInfo(); }