public Multimeter(BLE.IDeviceBLE pDevice) { mDevice = pDevice ?? throw new Exception("Multimeter must connect to a BLE device, not null."); mDevice.Change += (o, e) => { MyProcessor.Recieve(e.Bytes); }; MyProcessor.mCallback += ProcessPacket; Screen = new MultimeterScreen(); Menu = new MultimeterMenu(); #region MULTIMETER_BUTTON_EVENTS void SendKeycode(Packet121GW.Keycode keycode) { SendData(Packet121GW.GetKeycode(keycode)); } Menu.HoldClicked += (s, e) => { SendKeycode(Packet121GW.Keycode.HOLD); }; Menu.RelClicked += (s, e) => { SendKeycode(Packet121GW.Keycode.REL); }; Menu.ModeChanged += (s, e) => { SendKeycode(Packet121GW.Keycode.MODE); }; Menu.RangeChanged += (s, e) => { SendKeycode(Packet121GW.Keycode.RANGE); }; #endregion #region CHART_CONSTRUCTION Chart = new SmartChart( new SmartData( new SmartAxisPair( new SmartAxisHorizontal("Horizontal", -0.1f, 0.1f), new SmartAxisVertical("Vertical", -0.2f, 0.1f)), Logger.Data)); Chart.Clicked += (o, e) => { Plot_FullScreenClicked(o, e); }; #endregion ChartMenu = new SmartChartMenu(true, true); ChartMenu.SaveClicked += (s, e) => { Chart.SaveCSV(); }; ChartMenu.ResetClicked += (s, e) => { Reset(); }; DefineGrid(1, 4); AutoAdd(Screen); FormatCurrentRow(GridUnitType.Star); AutoAdd(Menu); FormatCurrentRow(GridUnitType.Auto); AutoAdd(Chart); FormatCurrentRow(GridUnitType.Star); AutoAdd(ChartMenu); FormatCurrentRow(GridUnitType.Auto); Item = ActiveItem.Screen; }
public MultimeterThemed(Color BackColor) { HorizontalOptions = LayoutOptions.Fill; VerticalOptions = LayoutOptions.StartAndExpand; //Assures that a non-zero height is allocated MinimumHeightRequest = 200; // InitializeComponent (); Screen = new MultimeterScreen(); Screen.BackgroundColor = BackColor; Screen.Clicked += BackClicked; Menu = new MultimeterMenu(); Menu.BackgroundColor = BackColor; Menu.BackClicked += BackClicked; Menu.PlotClicked += PlotClicked; Data = new rMultiplatform.ChartData(rMultiplatform.ChartData.ChartDataMode.eRolling, "Time (s)", "Volts (V)", 0.1f, 10.0f); Plot = new rMultiplatform.Chart() { Padding = new rMultiplatform.ChartPadding(0.1) }; Plot.AddGrid(new rMultiplatform.ChartGrid()); Plot.AddAxis(new rMultiplatform.ChartAxis(5, 5, 0, 20) { Label = "Time (s)", Orientation = rMultiplatform.ChartAxis.AxisOrientation.Horizontal, AxisLocation = 0.9, LockToAxisLabel = "Volts (V)", LockAlignment = rMultiplatform.ChartAxis.AxisLock.eMiddle }); Plot.AddAxis(new rMultiplatform.ChartAxis(5, 5, 0, 0) { Label = "Volts (V)", Orientation = rMultiplatform.ChartAxis.AxisOrientation.Vertical, AxisLocation = 0.1, LockToAxisLabel = "Time (s)", LockAlignment = rMultiplatform.ChartAxis.AxisLock.eStart }); Plot.AddData(Data); Menu.IsVisible = true; Screen.IsVisible = false; Plot.IsVisible = false; MultimeterGrid = new StackLayout(); MultimeterGrid.Children.Add(Screen); MultimeterGrid.Children.Add(Menu); MultimeterGrid.Children.Add(Plot); Content = MultimeterGrid; SetView(); }