public override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); this.toggleButtons = new ToggleButtons(view, this.saunaModel); this.toggleButtons.UpdateToggleButtons(this.ventilationModel.Status); this.toggleButtons.OnToggleChanged += ToggleButtons_OnToggleChanged; if (DateTimeOffset.UtcNow.ToUnixTimeSeconds() < this.ventilationModel.OpenedAt) { this.linearLayoutProgress.Visibility = ViewStates.Visible; int diff = (int)(this.ventilationModel.OpenedAt - DateTimeOffset.UtcNow.ToUnixTimeSeconds()); this.progressBarOpening.Progress = 150 - diff; this.textViewProgressStatus.Text = System.Math.Ceiling(100 - ((diff * 100) / 150.0)) + " %"; } editTextFanDuration1.Text = this.ventilationModel.FanRunningTime1.ToString(); editTextFanDuration2.Text = this.ventilationModel.FanRunningTime2.ToString(); toggleButtonFan1.Checked = DateTimeOffset.UtcNow.ToUnixTimeSeconds() < this.ventilationModel.Fan1ClosingAt; toggleButtonFan2.Checked = DateTimeOffset.UtcNow.ToUnixTimeSeconds() < this.ventilationModel.Fan2ClosingAt; // Create a timer which should update the views, when time runs out and ventilation completes to updated timer = new Timer(); timer.Enabled = true; timer.Interval = 1005; timer.Elapsed += (sender, e) => { Timer_Elapsed(); }; timer.Start(); }
public override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); // Set heater value this.toggleButtons = new ToggleButtons(view, this.saunaModel); this.toggleButtons.UpdateToggleButtons(this.heaterModel.Status); this.toggleButtons.OnToggleChanged += ToggleButtons_OnToggleChanged; // Set segmented control power items, selection event and selected index this.sfSegmentedControlPower.DisplayMode = SegmentDisplayMode.Text; this.sfSegmentedControlPower.SegmentHeight = 33; this.sfSegmentedControlPower.SelectionTextColor = Color.DarkGreen; this.sfSegmentedControlPower.FontColor = Color.White; this.sfSegmentedControlPower.CornerRadius = 10; this.sfSegmentedControlPower.BackColor = Color.LightGray; this.sfSegmentedControlPower.BorderColor = Color.DarkGreen; this.sfSegmentedControlPower.BorderThickness = 2; this.sfSegmentedControlPower.VisibleSegmentsCount = 3; this.sfSegmentedControlPower.ItemsSource = this.heterModelList; this.sfSegmentedControlPower.SelectedIndex = GetSelectedHeatingIndex(this.heterModelList, this.heaterModel); SelectionIndicatorSettings selectionIndicator = new SelectionIndicatorSettings(); selectionIndicator.Color = Color.White; this.sfSegmentedControlPower.SelectionIndicatorSettings = selectionIndicator; this.sfSegmentedControlPower.SelectionChanged += SfSegmentedControlPower_SelectionChanged; // Update selected edit temperature this.editTextTemperature.Text = this.heaterModel.TemperatureThreshold.ToString(); // Set values to heater sensors and recyclerview this.recyclerViewSensorTemperatures.SetAdapter(this.heaterSensorsAdapter); /* * Special type of layout manager for recycler view, developed by google: FlexLayoutManager * https://github.com/AigioL/XAB.FlexboxLayout * * Let's easily manage items when not using linearlayout manager. */ FlexboxLayoutManager flexboxLayoutManager = new FlexboxLayoutManager(this.Activity, FlexDirection.Row, FlexWrap.Wrap); flexboxLayoutManager.JustifyContent = JustifyContent.Center; flexboxLayoutManager.AlignItems = AlignItems.Stretch; flexboxLayoutManager.FlexWrap = FlexWrap.Wrap; this.recyclerViewSensorTemperatures.SetLayoutManager(flexboxLayoutManager); this.recyclerViewSensorTemperatures.NestedScrollingEnabled = false; }
public void setVisibleXrayState() { foreach (GameObject xrayMaterialObject in xrayMaterialObjects) { if (xrayMaterialObject != null) { string materialName = xrayMaterialObject.GetComponent <Renderer>().material.name; ToggleButtons.ToggleMaterial shaderMaterial = ToggleButtons.GetToggleMaterialForString(materialName); xrayMaterialObject.SetActive(ToggleButtons.XRAY_MATERIALS_VISIBLE.Contains(shaderMaterial)); } } }
public override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); this.toggleButtons = new ToggleButtons(view, this.saunaModel); this.toggleButtons.UpdateToggleButtons(this.soundModel.Status); this.toggleButtons.OnToggleChanged += ToggleButtons_OnToggleChanged; this.textViewVolumeLevel.Text = this.soundModel.Volume.ToString(); this.seekBarVolume.Progress = this.soundModel.Volume; this.seekBarVolume.ProgressChanged += SeekBarVolume_ProgressChanged; this.recyclerViewMusic.SetAdapter(this.songsAdapter); this.recyclerViewMusic.SetLayoutManager(new LinearLayoutManager(view.Context)); }
public override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); // At first, set all values acording to model values this.toggleButtons = new ToggleButtons(view, this.saunaModel); this.toggleButtons.UpdateToggleButtons(this.lightModel.Status); this.toggleButtons.OnToggleChanged += ToggleButtons_OnToggleChanged; // Update color switch, based on saved settings this.switchColorLightOn.Checked = this.lightModel.ColorStatus; // Set selected color for panel view this.colorPanelView.SetColor(this.lightModel.GetColor); // Update color layout visibilities based on color status if (this.lightModel.ColorStatus) { this.colorPanelView.Visibility = ViewStates.Visible; this.textViewTapForColor.Visibility = ViewStates.Visible; } // Update layout if light status is on if (this.lightModel.Status) { // Set visible brightness layout this.linearLayoutBrightness.Visibility = ViewStates.Visible; // Also set the layout brightness values this.seekBarBrightness.Progress = this.lightModel.Brightness; this.textViewBrightnessLevel.Text = "Brightness: " + this.lightModel.Brightness; } this.seekBarBrightness.ProgressChanged += SeekBarBrightness_ProgressChanged; }