Ejemplo n.º 1
0
        public void OnClock(uint tick, bool isTransmit)
        {
            labelClock.Text = (tick / 10).ToString();
            if (tick < 10)
            {
                if (!markedWaterfallThisCycle)
                {
                    if (null != iwaterfall)
                    {
                        int tag = 1;
                        if (!String.IsNullOrEmpty(mostRecentMessageTimeTag))
                        {
                            Int32.TryParse(mostRecentMessageTimeTag, out tag);
                        }
                        iwaterfall.MarkCurrentRaster(tag);
                        mostRecentMessageTimeTag = null;
                    }
                }
                markedWaterfallThisCycle = true;
            }
            else
            {
                markedWaterfallThisCycle = false;
            }
            ClockLabel cl = labelClockAnimation as ClockLabel;

            if (null != cl)
            {
                cl.Tenths     = tick;
                cl.AmTransmit = isTransmit;
            }
        }
Ejemplo n.º 2
0
        private void XcvrForm_Load(object sender, EventArgs e)
        {
            this.Text       = String.Format("{0}-{1}", this.Text, instanceNumber);
            labelPower.Text = "";
            ClockLabel cl = new ClockLabel();

            cl.Location = labelClockAnimation.Location;
            cl.Size     = labelClockAnimation.Size;
            panelRightGain.Controls.Remove(labelClockAnimation);
            panelRightGain.Controls.Add(cl);
            labelClockAnimation.Dispose();
            labelClockAnimation = cl;

            comboBoxnDepth.SelectedIndex = Properties.Settings.Default.Decode_ndepth - 1;
            checkBoxEnableAP.Checked     = Properties.Settings.Default.Decode_lft8apon;

            panelRightGain.BackColor =
                panel1.BackColor     = CustomColors.CommonBackgroundColor;


            object wlDir = Microsoft.Win32.Registry.GetValue(
                "HKEY_LOCAL_MACHINE\\Software\\W5XD\\WriteLog\\Install", "Directory", "0");

            try
            {
                // if WriteLog's DigiRiteWaterfall assembly loads, use it.
                const string name         = "WriteLogWaterfall.dll";
                string       assemblyPath = System.IO.Path.GetFullPath(name);
#if DEBUG
                // debug environment its easier to copy the waterfall into our work area
#else
                // Use WriteLog's waterfall Control
                if (null != wlDir)
                {
                    assemblyPath = wlDir.ToString() + "Programs\\" + name;
                }
#endif
                System.Reflection.Assembly waterfallAssembly = System.Reflection.Assembly.LoadFile(assemblyPath);
                System.Type t = waterfallAssembly.GetType("WriteLog.Waterfall");
                if (t == null)
                {
                    throw new System.Exception("Waterfall type not found");
                }
                waterfall  = (Control)System.Activator.CreateInstance(t);
                iwaterfall = (WriteLog.IWaterfall)waterfall;
            }
            catch (System.Exception ex)
            {   // if WriteLog is not installed, this is "normal successful completion"
                if (null != wlDir)
                {
                    logfile.SendToLog("Xcvr exception " + ex.ToString()); // not normal
                }
            }

            if (null != waterfall)
            {   // waterfall loaded. it goes where chartSpectrum was.
                ((System.ComponentModel.ISupportInitialize)waterfall).BeginInit();
                waterfall.Location      = chartSpectrum.Location;
                waterfall.Dock          = chartSpectrum.Dock;
                waterfall.Size          = chartSpectrum.Size;
                waterfall.TabIndex      = chartSpectrum.TabIndex;
                waterfall.Name          = "waterfall";
                waterfall.Font          = labelWaterfall.Font; // labelWaterfall is placeholder for properties
                waterfall.BackColor     = labelWaterfall.BackColor;
                waterfall.ForeColor     = labelWaterfall.ForeColor;
                waterfall.Visible       = true;
                iwaterfall.MaxHz        = MaxDecodeFrequency;
                iwaterfall.MinHz        = MinDecodeFrequency;
                iwaterfall.TxFreqHz     = mainForm.TxFrequency;
                iwaterfall.RxFreqHz     = mainForm.RxFrequency;
                iwaterfall.onTxFreqMove = new WriteLog.OnFreqMove((int hz) => { mainForm.TxFrequency = hz; });
                iwaterfall.onRxFreqMove = new WriteLog.OnFreqMove((int hz) => { mainForm.RxFrequency = hz; });
                ((System.ComponentModel.ISupportInitialize)waterfall).EndInit();
                splitContainerMain.Panel2.Controls.Remove(chartSpectrum);
                chartSpectrum.Dispose();
                chartSpectrum = null;
                splitContainerMain.Panel2.Controls.Add(waterfall);
                splitContainerMain.Panel2.Controls.SetChildIndex(waterfall, 0);
                iwaterfall.TimeToFreqPowerOfTwo = 12;
                myDemod.SetAudioSamplesCallback(null, iwaterfall.TimeToFreqSampleCount,
                                                iwaterfall.TimeToFreqSampleCount, iwaterfall.GetAudioProcessor());
            }
            prevSplitter   = splitContainerMain.SplitterDistance;
            locationToSave = Location;
            sizeToSave     = Size;

#if DEBUG   // test the waterfall's ability to change frequency resolution
            if (null != iwaterfall)
            {
                labelWaterfall.Visible = true;
                labelWaterfall.Click  += new EventHandler((object o, EventArgs ev) =>
                {
                    iwaterfall.TimeToFreqPowerOfTwo += 1;
                    myDemod.SetAudioSamplesCallback(null, iwaterfall.TimeToFreqSampleCount,
                                                    iwaterfall.TimeToFreqSampleCount, iwaterfall.GetAudioProcessor());
                });
            }
#endif
        }