Exemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            Log4WinEvents.FrequencyChanged +=
                new Log4WinEvents.FrequencyChangedEventHandler(Log4WinEvents_FrequencyChanged);
            Log4WinEvents.OnDoubleClicked += new Log4WinEvents.SCPEventHandler(Log4WinEvents_OnDoubleClicked);
            ListFreq.MouseDoubleClick     += new MouseEventHandler(ListFreq_MouseDoubleClick);
            try
            {
                //clsFcm.MainFrm.cat
                string Flpath = Settings.Default.FlRig_path;
                if (Flpath.IsNullOrEmpty())
                {
                    throw new ArgumentNullException("Flpath", "Please set path to FlRig software!");
                }
                if (!File.Exists(Flpath))
                {
                    throw new FileNotFoundException("Path to FlRig software not found!");
                }
                string proname = System.IO.Path.GetFileNameWithoutExtension(Flpath);
                if (!GetProcess(proname))
                {
                    Process p = Process.Start(Flpath);
                    //p.WaitForInputIdle(16000);
                }

                bool b = false;
                while (!b)
                {
                    b = GetProcess(proname);
                }
                rd  = clsFcm.mRadio;
                rig = XmlRpcProxyGen.Create <IFlRig>();

                RadioTimer.Enabled = true;
                Isconnected        = true;
                rd.IsConnected     = true;
                //string[] modes = rig.RigGetModes();
                //modes.Cast<string>().ToList().ForEach(s => ModeBox.Items.Add(s));
                //FreqRig = rig.RigGetVfo();
                //MainFrequency = (FreqRig.ToDouble() / 1000d);
                //lblFreq.Text = (FreqRig.ToDouble() / 1000d).ToFormatFrequency();
                MainFrequency = CommonFunctions.Freq;
                lblFreq.Text  = MainFrequency.ToFormatFrequency();
                rig.RigSetFreq(MainFrequency * 1E3);
                rig.RigSetMode(Settings.Default.RadioMode);

                rd.SetRig <IFlRig>(rig);
            }
            catch (FileNotFoundException fx) {
                clsFcm.MyMessage(fx.Message, false, "FlRig error!!!");
            }
            catch { }
            //    tflrig = new Thread(GetDataRig);
            //Done = Isconnected;

            //tflrig.Start();

            base.OnLoad(e);
        }
Exemplo n.º 2
0
        //DAC dc = new DAC();
        public CatRigControl()
        {
            //CwGet.CwGetX cw = new CwGet.CwGetX();
            InitializeComponent();
            this.Text = "Rig:";
            StepBox.Items.With(s =>
            {
                s.Clear();
                s.Add("1");
                s.Add("5");
                s.Add("10");
                s.Add("15");
                s.Add("20");
            });
            StepBox.Text = "10";
            //ListFreq.Items.With(l =>
            //    {
            //        l.Add("1840.0");

            LoadListFreqs();
            //    });

            rd = new Radio();
        }