Пример #1
0
        /// <summary>
        /// 添加要画的图形的按钮的事件处理程序
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Submmit_Button_Click(object sender, RoutedEventArgs e)
        {
            if (context.dictionaryBpskBoc.Count != 0)  //若已添加过图形,则可打开画板显示
            {
                NewThread newThread = new NewThread(); //创建新的线程参数传递实例以向新线程传递参数
                switch (flagTab1)
                {
                case 0:
                    newThread.WhichMode = "时域波形";
                    break;

                case 1:
                    newThread.WhichMode = "功率谱密度";
                    break;

                case 2:
                    newThread.WhichMode = "自相关函数";
                    break;
                }
                foreach (var item in context.dictionaryBpskBoc)//将字典的值传递到下一个线程
                {
                    newThread.dictionary.Add(item.Key, item.Value);
                }
                Thread thread = new Thread(new ThreadStart(newThread.StartThread));
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
                RemoveAll_Button_Click(null, null); //清除表格和存储的所有内容
                flagTab1 = null;                    //重置标志位
            }
            else
            {
                MessageBox.Show("请先添加至少一个波形", "提示");
            }
        }
Пример #2
0
        /// <summary>
        /// tab_2的提交事件处理程序
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Submmit2_Button_Click(object sender, RoutedEventArgs e)
        {
            if (context.dictionaryError.Count != 0)
            {
                NewThread newThread = new NewThread();
                switch (flagTab2)
                {
                case 0:
                    newThread.WhichMode = "s曲线";
                    break;

                case 1:
                    newThread.WhichMode = "码跟踪精度(时延)";
                    break;

                case 2:
                    newThread.WhichMode = "码跟踪精度(信噪比)";
                    break;

                case 3:
                    newThread.WhichMode = "镜像多径引起的偏移误差";
                    break;
                }
                foreach (var item in context.dictionaryError)
                {
                    newThread.dictionary.Add(item.Key, item.Value);
                }
                Thread thread = new Thread(new ThreadStart(newThread.StartThread));
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
                RemoveAll2_Button_Click(null, null);
                flagTab2 = null;
            }
            else
            {
                MessageBox.Show("请先添加至少一个波形", "提示");
            }
        }
Пример #3
0
        private void PaintButton_Click(object sender, RoutedEventArgs e)
        {
            BPSK_Sequence_Generate bpskSequenceGenerate = new BPSK_Sequence_Generate(Convert.ToDouble(context.FrequenceBpsk), 2);                   //利用TextBox中输入的参数获取一个序列
            BOC_Sequence_Generate  bocSequenceGenerate  = new BOC_Sequence_Generate(Convert.ToInt32(context.Alpha), Convert.ToInt32(context.Beta)); //利用TextBox中输入的参数获取一个序列
            NewThread newThread = new NewThread();

            if (context.WhichMode)
            {
                if (context.TimeDomain)
                {
                    context.points        = new List <Point>();
                    newThread.whichFigure = "bpskTimeDomain";
                }
                else if (context.Psd)
                {
                    context.points        = bpskSequenceGenerate.GetPsdSequenceRealDb;//把计算得到的点序列存到context类中
                    newThread.whichFigure = "bpskPsd";
                }
                else if (context.Autocorrelation)
                {
                    context.points        = bpskSequenceGenerate.GetAutocorrelationSequence;
                    newThread.whichFigure = "bpskAutocorrelation";
                }
                if ((context.points != null) && (context.points.Count != 0))
                {
                    newThread.points = context.points;
                    Thread thread = new Thread(new ThreadStart(newThread.StartThread));
                    thread.SetApartmentState(ApartmentState.STA);
                    thread.Start();
                }
                else
                {
                    MessageBox.Show("请先输入频率", "错误");
                }
            }
            else
            {
                if (context.TimeDomain)
                {
                    context.points        = new List <Point>();
                    newThread.whichFigure = "bocTimeDomain";
                }
                else if (context.Psd)
                {
                    context.points        = bocSequenceGenerate.GetPsdSequenceRealDb;//把计算得到的点序列存到context类中
                    newThread.whichFigure = "bocPsd";
                }
                else if (context.Autocorrelation)
                {
                    context.points        = bocSequenceGenerate.GetAutocorrelationSequence;
                    newThread.whichFigure = "bocAutocorrelation";
                }
                if ((context.points != null) && (context.points.Count != 0))
                {
                    newThread.points = context.points;
                    Thread thread = new Thread(new ThreadStart(newThread.StartThread));
                    thread.SetApartmentState(ApartmentState.STA);
                    thread.Start();
                }
                else
                {
                    MessageBox.Show("请先输入频率", "错误");
                }
            }
        }