public DetailPage(DeviceDetailViewModel viewModel) { InitializeComponent(); BindingContext = this.viewModel = viewModel; this.viewModel.OnFinished += OnFinished; }
private async Task NavigateToDetailsPage() { DeviceDetailViewModel deviceDetailVm = ViewModelLocator.Current.DeviceDetailViewModel; deviceDetailVm.Device = this._bluetoothDevice; await deviceDetailVm.ConnectToDevice(); var navigationPage = ViewLocator.BasePage; await navigationPage.PushAsync(ViewLocator.DeviceDetailPage); }
private EnableTimerViewController(DeviceDetailViewModel device, ProgramDisableFeatureViewModel feature) : base() { ExceptionUtility.Try(() => { this._feature = feature; this._device = device; this.Initialize(); this._navBarView.TitleText = feature.SettingName; }); }
public DeviceDetailMobile(DeviceDetailViewModel viewModel) { viewModel.DataLoaded += () => AddChartData(); InitializeComponent(); BindingContext = viewModel; imageDevice.Source = ImageSource.FromResource($"AccelMobileClient.Images.{viewModel.TypeOfDevice}.png"); }
private WateringTimerViewController(DeviceDetailViewModel device, Action <IEnumerable <PumpViewModel>, int> waterSelectedStations) : base() { ExceptionUtility.Try(() => { this._device = device; this.Initialize(); if (waterSelectedStations != null) { this._waterSelectedStations = WeakReferenceUtility.MakeWeakAction(waterSelectedStations); } }); }
private CircuitsTimerViewController(DeviceDetailViewModel device, Action <int> testSelectedCircuits) : base() { ExceptionUtility.Try(() => { //this._device = device; this.Initialize(); if (testSelectedCircuits != null) { this._testSelectedCircuits = WeakReferenceUtility.MakeWeakAction(testSelectedCircuits); } }); }
public void SetTitleAndIcon(DeviceDetailViewModel device) { UIImage icon = _iconImageGray; foreach (var alert in device.Alerts) { if (alert.ShowRed) { icon = _iconImageRed; break; } } this.SetTitleAndImage(device.Name, icon); }
public static CircuitsTimerViewController CreateInstance(DeviceDetailViewModel device, Action <int> testSelectedCircuits) { ExceptionUtility.Try(() => { if (_instance != null) { _instance.Dispose(); _instance = null; } _instance = new CircuitsTimerViewController(device, testSelectedCircuits); }); return(_instance); }
public static EnableTimerViewController CreateInstance(DeviceDetailViewModel device, ProgramDisableFeatureViewModel feature) { ExceptionUtility.Try(() => { if (_instance != null) { _instance.Dispose(); _instance = null; } _instance = new EnableTimerViewController(device, feature); }); return(_instance); }
public static WateringTimerViewController CreateInstance(DeviceDetailViewModel device, Action <IEnumerable <PumpViewModel>, int> waterSelectedStations) { ExceptionUtility.Try(() => { if (_instance != null) { _instance.Dispose(); _instance = null; } _instance = new WateringTimerViewController(device, waterSelectedStations); }); return(_instance); }
async Task <ProgressResponse> IStartPivot.StartPivotDevice(DeviceDetailViewModel model, string deviceId, Action onReconnect, bool silentMode) { try { var request = new StartPivotDevice(model, deviceId); var response = await this.DoRequest <StartPivotDevice, ProgressResponse>(request, onReconnect : onReconnect, silentMode : silentMode); //handle after-response tasks ServiceContainer.InvalidateCache(); return(response); } catch (Exception e) { LogUtility.LogException(e); } return(null); }
public DeviceDetailPage(ParticleDevice device) { ViewModel = new DeviceDetailViewModel(device); indicator = new ActivityIndicator(); nameLabel = new Label { HorizontalOptions = LayoutOptions.Center, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) }; var width = (App.ScreenWidth - 20) / 2; functionVariableGrid = new Grid { ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(10, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(width) }, new ColumnDefinition { Width = new GridLength(width) }, new ColumnDefinition { Width = new GridLength(10, GridUnitType.Star) } }, RowSpacing = 0 }; layout = new AbsoluteLayout { WidthRequest = App.ScreenWidth, HeightRequest = App.ScreenHeight }; layout.Children.Add(nameLabel, new Rectangle(10, 5, App.ScreenWidth, 40)); layout.Children.Add(indicator); layout.Children.Add(functionVariableGrid); Content = layout; BindingContext = ViewModel; if (device.Name == "InternetButton") { var flashNewProgram = new ToolbarItem { Text = "Flash" }; flashNewProgram.Clicked += async(object sender, EventArgs e) => { var result = await DisplayActionSheet("Pick File to Flash", "Cancel", null, "Tinker", "RGB LED", "Shake LED", "Sound Check", "Simon Says", "Follow me LED"); var success = await ViewModel.TryFlashFileAsync(result); if (!success) { await DisplayAlert("Error", "Problem flashing file, please try again", "Ok"); } if (result != "Cancel") { await Navigation.PopAsync(); } }; ToolbarItems.Add(flashNewProgram); } nameLabel.SetBinding(Label.TextProperty, "Device.Name"); indicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); }
public DeviceDetailPage() { InitializeComponent(); BindingContext = DeviceDetailViewModel = new DeviceDetailViewModel(); }
public StartsPivotRequestBody(DeviceDetailViewModel model, string deviceId) { this.DeviceId = deviceId; var aux1 = new Auxiliary1 { Value = model.Aux1Value }; var aux2 = new Auxiliary2 { Value = model.Aux2Value }; var fromAngle = new FromAngle { Value = model.Device.CurrentStep == null ? "0" : model.Device.CurrentStep.FromAngle.Value == string.Empty ? "0" : model.Device.CurrentStep.FromAngle.Value }; var toangle = new ToAngle { Value = model.ToAngleValue.ToString() }; var applicationAmount = new ApplicationAmount { Value = model.AppAmountValue.ToString() }; var endgun = new EndGun { Value = model.EndGunValue }; var speed = new Speed { Value = model.Speed.ToString() }; var direction = new Direction { Value = model.DirectionValue, //Visible = model.Device.CurrentStep.Direction == null ? "false" : model.Device.CurrentStep.Direction.Visible.ToString() }; var wet = new Wet { Value = model.WetDryValue }; var durationMinutes = new DurationMinutes { Value = model.Device.CurrentStep == null ? "1" : model.Device.CurrentStep.DurationMinutes == null ? "1" : model.Device.CurrentStep.DurationMinutes.Value }; var step1 = new Step { Auxiliary1 = aux1, DurationMinutes = durationMinutes }; var step2 = new Step { Auxiliary1 = aux1, Auxiliary2 = aux2, FromAngle = fromAngle, ToAngle = toangle, Direction = direction, ApplicationAmount = applicationAmount, Speed = speed, EndGun = endgun, Wet = wet, }; var continuous = new Continuous { Value = model.Continuous.ToString() }; var autoReverse = new AutoReverse { Value = model.AutoReverseValue.ToString() }; var itemSteps = new Steps(); itemSteps.Add("0", step1); itemSteps.Add("1", step2); itemSteps.CurrentProgramId = null; var program = new Program { Continuous = continuous, AutoReverse = autoReverse, Steps = itemSteps }; Programs = new Programs(); Programs.Add("0", program); Programs.CurrentProgramId = null; }
public StartPivotDevice(DeviceDetailViewModel model, string deviceId, Action onReconnect = null) : base(RequestKey) { this.Body = new StartsPivotRequestBody(model, deviceId); }
private void DeviceDetailView_Loaded(object sender, RoutedEventArgs e) { this.Loaded -= DeviceDetailView_Loaded; mModel = (this.DataContext as DeviceDetailViewModel); mModel.grid = this.dg; }
// GET: Devices/Details/5 public async Task <IActionResult> Details(long?id, string sortOrder, int?page = 1) { if (id == null) { return(NotFound()); } if (String.IsNullOrWhiteSpace(sortOrder)) { sortOrder = "endDate"; } ViewData["CurrentSort"] = sortOrder; ViewData["ServiceTitleSortParm"] = sortOrder == "serviceTitle" ? "serviceTitle_Desc" : "serviceTitle"; ViewData["StartDateSortParm"] = sortOrder == "startDate" ? "startDate_desc" : "startDate"; ViewData["EndDateSortParm"] = sortOrder == "endDate" ? "endDate_desc" : "endDate"; ViewData["CostSortParm"] = sortOrder == "cost" ? "cost_desc" : "cost"; var device = await _context.Devices .Include(d => d.User) .SingleOrDefaultAsync(m => m.Id == id); if (device == null) { return(NotFound()); } var deviceServices = _context.DeviceServices .Include(d => d.Service) .Where(ds => ds.DeviceId == device.Id); switch (sortOrder) { case "serviceTitle": deviceServices = deviceServices.OrderBy(ds => ds.Service.Title); break; case "serviceTitle_Desc": deviceServices = deviceServices.OrderByDescending(ds => ds.Service.Title); break; case nameof(DeviceService.DateOrdered): deviceServices = deviceServices.OrderBy(ds => ds.DateOrdered); break; case nameof(DeviceService.DateOrdered) + "_desc": deviceServices = deviceServices.OrderByDescending(ds => ds.DateOrdered); break; case "cost": deviceServices = deviceServices.OrderBy(ds => ds.Service.Price); break; case "cost_desc": deviceServices = deviceServices.OrderByDescending(ds => ds.Service.Price); break; default: deviceServices = deviceServices.OrderByDescending(ds => ds.DateOrdered); break; } int pageSize = 4; var deviceDetails = new DeviceDetailViewModel(); deviceDetails.Device = device; deviceDetails.DeviceServices = await PaginatedList <DeviceService> .CreateAsync(deviceServices.AsNoTracking(), page ?? 1, pageSize); return(View(deviceDetails)); }