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;
        }
Exemplo n.º 2
0
        public MathChart()
        {
            DeviceAEvent.CollectionChanged += Data_Changed;
            DeviceBEvent.CollectionChanged += Data_Changed;

            //Setup listviews
            Menu               = new SmartChartMenu(true, true);
            Menu.SaveClicked  += (o, e) => { Chart.SaveCSV(); };
            Menu.ResetClicked += (o, e) => { InvalidateLayout(); };

            //
            A_List = MakePicker((o, e) => { List_ItemSelected(ref DeviceA, o, e); }, "Device A");
            B_List = MakePicker((o, e) => { List_ItemSelected(ref DeviceB, o, e); }, "Device B");

            A_List.ItemsSource        = Devices;
            A_List.ItemDisplayBinding = new Binding("Title");
            B_List.ItemsSource        = Devices;
            B_List.ItemDisplayBinding = new Binding("Title");

            Operation_List = MakePicker(Operation_List_ItemSelected, "Operation");
            Operation_List.ItemDisplayBinding = new Binding("Label");
            Operation_List.ItemsSource        = Operations;
            //
            Chart = new SmartChart(
                new SmartData(
                    new SmartAxisPair(
                        new SmartAxisHorizontal("Horizontal", +0, 1),
                        new SmartAxisVertical("Vertical", -1, 1)), Data));
            Chart.Clicked += Plot_FullscreenClicked;

            //
            DefineGrid(3, 3);

            //RowDefinition 1
            AutoAdd(A_List);
            AutoAdd(Operation_List);
            AutoAdd(B_List);        FormatCurrentRow(GridUnitType.Auto);
            AutoAdd(Chart, 3);  FormatCurrentRow(GridUnitType.Star);
            AutoAdd(Menu, 3);   FormatCurrentRow(GridUnitType.Auto);
        }