Esempio n. 1
0
        protected RotarySwitch AddRotarySwitch(string name, Point posn, Size size,
                                               string knobImage, int defaultPosition, //Helios.Gauges.M2000C.RSPositions[] positions,
                                               string interfaceDeviceName, string interfaceElementName, bool fromCenter)
        {
            RotarySwitchPositionCollection positions = new RotarySwitchPositionCollection();

            return(AddRotarySwitch(name, posn, size,
                                   knobImage, defaultPosition, positions,
                                   interfaceDeviceName, interfaceElementName, fromCenter));
        }
Esempio n. 2
0
        public UHFRadio()
            : base("UHF Radio", new Size(625, 580))
        {
            RotarySwitchPositionCollection positions = new RotarySwitchPositionCollection();

            positions.Clear();
            positions.Add(new RotarySwitchPosition(this, 1, "Off", 300d));
            positions.Add(new RotarySwitchPosition(this, 2, "Main", 340d));
            positions.Add(new RotarySwitchPosition(this, 3, "Both", 20d));
            positions.Add(new RotarySwitchPosition(this, 4, "ADF", 60d));
            AddRotarySwitch("Frequency Dial", new Point(81, 455), new Size(115, 115), "1", 1, positions, "Frequency Dial");
            positions.Clear();
            positions.Add(new RotarySwitchPosition(this, 1, "Manual", 315d));
            positions.Add(new RotarySwitchPosition(this, 2, "Preset", 0d));
            positions.Add(new RotarySwitchPosition(this, 3, "Guard", 45d));
            AddRotarySwitch("Frequency Mode Dial", new Point(433, 455), new Size(115, 115), "1", 1, positions, "Frequency Mode Dial");
            positions.Clear();
            positions.Add(new RotarySwitchPosition(this, 1, "2", 225d));
            positions.Add(new RotarySwitchPosition(this, 2, "3", 270d));
            positions.Add(new RotarySwitchPosition(this, 3, "A", 315d));
            AddRotarySwitch("100Mhz Selector", new Point(54, 328), new Size(75, 75), "3", 1, positions, "100Mhz Selector");
            RotaryEncoder enc;

            enc = AddEncoder("10Mhz Selector", new Point(161, 329), new Size(75, 75), _imageLocation + "A-10C_UHF_Radio_Selector_Knob_3.png", 0.1d, 30d, _interfaceDeviceName, "10Mhz Selector", false);
            enc.InitialRotation = 15;
            enc = AddEncoder("1Mhz Selector", new Point(263, 329), new Size(75, 75), _imageLocation + "A-10C_UHF_Radio_Selector_Knob_3.png", 0.1d, 30d, _interfaceDeviceName, "1Mhz Selector", false);
            enc.InitialRotation = 90;
            enc = AddEncoder("0:1Mhz Selector", new Point(382, 329), new Size(75, 75), _imageLocation + "A-10C_UHF_Radio_Selector_Knob_3.png", 0.1d, 30d, _interfaceDeviceName, "0.1Mhz Selector", false);
            enc.InitialRotation = 60;
            enc = AddEncoder("0:025Mhz Selector", new Point(491, 329), new Size(75, 75), _imageLocation + "A-10C_UHF_Radio_Selector_Knob_3.png", 0.1d, 30d, _interfaceDeviceName, "0.025Mhz Selector", false);
            enc.InitialRotation = 45;
            enc = AddEncoder("Channel Selector", new Point(474, 110), new Size(100, 100), _imageLocation + "A-10C_UHF_Radio_Selector_Knob_2.png", 0.1d, 30d, _interfaceDeviceName, "Preset Channel Selector", false);
            enc.InitialRotation = 10;
            AddPot("Volume", new Point(274, 420), new Size(60, 60), _imageLocation + "A-10C_UHF_Radio_Volume_Knob.png", 0d, 300d, 0d, 1d, 0.5, 0.1, _interfaceDeviceName, "Volume", false, RotaryClickType.Radial, false);
            _channelDisplay   = AddPart("Channel Display", new UHFChanDisplay(), new Point(298, 111), new Size(173, 100), _interfaceDeviceName, "Channel Display") as IConfigurableBackgroundImage;
            _frequencyDisplay = AddPart("Frequency Display", new UHFFreqDisplay(), new Point(161, 219), new Size(289, 98), _interfaceDeviceName, "Frequency Display") as IConfigurableBackgroundImage;
            AddThreeWayToggle("T/Tone Switch", new Point(222, 511), new Size(59, 59), "T/Tone Switch");
            AddTwoWaySquelchToggle("Squelch Switch", new Point(354, 511), new Size(52, 61), "Squelch");

            AddButton("Test Display Button", new Point(109, 242), new Size(45, 47), _imageLocation + "A-10C_UHF_Radio_Test_Button_Unpressed.png", _imageLocation + "A-10C_UHF_Radio_Test_Button_Pressed.png", "", _interfaceDeviceName, "Test Display Button", false);
            AddButton("Status Button", new Point(466, 245), new Size(45, 45), _imageLocation + "A-10C_UHF_Radio_Status_Button_Unpressed.png", _imageLocation + "A-10C_UHF_Radio_Status_Button_Pressed.png", "", _interfaceDeviceName, "Status Button", false);

            AddCover("Cover", new Point(23, 0), new Size(268, 233), "Cover");
            // red load button is under the cover so needs to have special binding
            AddLoadButton("Load Button", 74, 175, new Size(36, 37), "Load Button");
        }
Esempio n. 3
0
        private RotarySwitch AddRotarySwitch(string name, Point posn, Size size, string knobNumber, int defaultPosition, RotarySwitchPositionCollection positions, string interfaceElementName)
        {
            RotarySwitch newSwitch = new RotarySwitch
            {
                Name            = _interfaceDeviceName + "_" + name,
                KnobImage       = _imageLocation + "A-10C_UHF_Radio_Selector_Knob_" + knobNumber + ".png",
                DrawLabels      = false,
                DrawLines       = false,
                Top             = posn.Y,
                Left            = posn.X,
                Width           = size.Width,
                Height          = size.Height,
                DefaultPosition = defaultPosition,
                IsContinuous    = false
            };

            newSwitch.Positions.Clear();
            foreach (RotarySwitchPosition swPosn in positions)
            {
                newSwitch.Positions.Add(swPosn);
            }

            AddRotarySwitchBindings(name, posn, size, newSwitch, _interfaceDeviceName, interfaceElementName);
            return(newSwitch);
        }
Esempio n. 4
0
        protected RotarySwitch AddRotarySwitch(string name, Point posn, Size size,
                                               string knobImage, int defaultPosition, RotarySwitchPositionCollection positions,
                                               string interfaceDeviceName, string interfaceElementName, bool fromCenter)
        {
            if (fromCenter)
            {
                posn = FromCenter(posn, size);
            }
            string       componentName = GetComponentName(name);
            RotarySwitch knob          = new RotarySwitch
            {
                Name            = componentName,
                KnobImage       = knobImage,
                DrawLabels      = false,
                DrawLines       = false,
                Top             = posn.Y,
                Left            = posn.X,
                Width           = size.Width,
                Height          = size.Height,
                DefaultPosition = defaultPosition
            };

            knob.Positions.Clear();
            knob.DefaultPosition = defaultPosition;
            foreach (RotarySwitchPosition swPosn in positions)
            {
                knob.Positions.Add(swPosn);
            }

            Children.Add(knob);

            foreach (IBindingTrigger trigger in knob.Triggers)
            {
                AddTrigger(trigger, componentName);
            }
            AddAction(knob.Actions["set.position"], componentName);

            AddDefaultOutputBinding(
                childName: componentName,
                deviceTriggerName: "position.changed",
                interfaceActionName: interfaceDeviceName + ".set." + interfaceElementName
                );
            AddDefaultInputBinding(
                childName: componentName,
                interfaceTriggerName: interfaceDeviceName + "." + interfaceElementName + ".changed",
                deviceActionName: "set.position");

            return(knob);
        }