예제 #1
0
        //loads switches ui
        private void LoadSwitches()
        {
            //set inital margin as 0
            int margin = 0;

            //Cycle through all switches
            for (int i = 0; i < sensorData.SwitchItems.Count(); i++)
            {
                //create toggleswitch using LoadDisplay class
                ToggleSwitch ts = new LoadDisplay().Switches(connectionData.ViewOnly,
                                                             sensorData.SwitchItems[i].Value, sensorData.SwitchItems[i].Description, margin, sensorData.SwitchItems[i].Index.ToString());
                //temp names for display
                if (ts.Header.Equals("S 1"))
                {
                    ts.Header = "Return Pump";
                }
                else if (ts.Header.Equals("S 2"))
                {
                    ts.Header = "Refugium Lights";
                }
                else if (ts.Header.Equals("S 3"))
                {
                    ts.Header = "Skimmer";
                }
                else if (ts.Header.Equals("S12"))
                {
                    ts.Header = "Right Tunze";
                }
                else if (ts.Header.Equals("S11"))
                {
                    ts.Header = "Left Radion";
                }
                else if (ts.Header.Equals("S10"))
                {
                    ts.Header = "Right Radion";
                }
                //Handle switch clicks
                ts.Click += new EventHandler <RoutedEventArgs>(UpdateSwitch);
                //add to ui
                switchGrid.Children.Add(ts);
                //increment margins
                margin += 90;
            }
        }
예제 #2
0
        //Loads lighting into ui
        private void LoadLighting()
        {
            //inital setting of the margin at 0
            int margin = 0;

            //cycle through all of the light items
            for (int i = 0; i < sensorData.LightingItems.Count(); i++)
            {
                //add text to ui
                lightingGrid.Children.Add(new LoadDisplay().LightingTextBlock(margin,
                                                                              sensorData.LightingItems[i].Description, sensorData.LightingItems[i].Value.ToString()));

                //create a slider component
                Slider si = new LoadDisplay().LightingSlider(
                    margin, sensorData.LightingItems[i].Value, connectionData.ViewOnly, sensorData.LightingItems[i].Index.ToString());

                //control what happens when the value is changed
                si.ValueChanged += SliderValueChange;
                //add control to ui
                lightingGrid.Children.Add(si);
                //increment margin
                margin += 134;
            }
        }