예제 #1
0
        /// <summary>
        /// フォームロードイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmMeasureMain_Load(object sender, EventArgs e)
        {
            if (this.log != null) this.log.PutLog("frmMeasureMain.frmMeasureMain_Load() - 測定中画面のロードを開始しました。");

            try
            {
                RealTimeData.DataTagSetting = (DataTagSetting)SystemSetting.DataTagSetting.Clone();
                // 言語切替
                AppResource.SetControlsText(this);

                // 測定設定ファイル読み込み
                var xmlFilePath = CommonLib.SystemDirectoryPath.SystemPath + MeasureSetting.FileName;
                if (System.IO.File.Exists(xmlFilePath))
                {
                    this.measSetting = (MeasureSetting)MeasureSetting.Deserialize(xmlFilePath);
                }
                else
                {
                    MessageBox.Show(AppResource.GetString("ERROR_MEASURE_SETTING_FILE_NOT_FOUND"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    this.Close();
                    return;
                }

                // 2Dグラフの設定
                for (int i = 0; i < this.graph2DList.Length; i++)
                {
                    if (this.measSetting.GraphSettingList.Length <= i) break;

                    if (this.measSetting.GraphSettingList[i].IsValid)
                    {
                        this.graph2DList[i] = new frmGraph2D(this.log, i) { MdiParent = this, CurrentValueLineChanged = Graph2DCurrentValueLineChanged, FormHidden = Graph2DFormHidden };
                        this.graph2DList[i].Resize += new EventHandler(this.graph_Resize);
                        this.graph2DList[i].FormClosed += new FormClosedEventHandler(this.graph2D_FormClosed);
                    }
                }

                // 各種表示フォームの設定
                this.tagValueListForm = new frmTagValueList(this.log) { MdiParent = this, Top = 80, Left = 0 };
                this.controllerForm = new frmMeasureController(this.log) { MdiParent = this, Top = 0, Left = 0, MeasureStatusChanged = MeasureStatusChangedCallback, Mode = this.measSetting.Mode };
                this.measInfoForm = new frmMeasureInfo(this.log) { MdiParent = this, Top = 0, Left = 1000, MeasSetting = this.measSetting };
                this.graphControllerForm = new frmGraphController(this.log) { MdiParent = this, Left = 0, Mode = this.measSetting.Mode, GraphFormList = this.graph2DList, GraphZoomInOccurred = this.Graph2DZoomIn, GraphZoomOutOccurred = this.Graph2DZoomOut, GraphArrangeOccurred = this.Graph2DArrange };

                // 測定データ収集タスク
                this.measureTask = new MeasureDataTask(this.log);
                this.measureTask.GotCondition += new MeasureDataTask.GotConditionDelegate(this.GotCondition);
                this.measureTask.DataReceived += new MeasureDataTask.DataReceivedDelegate(this.SetMeasureData);
                this.measureTask.DataReceived += new MeasureDataTask.DataReceivedDelegate(this.tagValueListForm.SetMeasureData);
                for (int i = 0; i < this.graph2DList.Length; i++)
                {
                    if (this.graph2DList[i] != null)
                    {
                        this.measureTask.DataReceived += new MeasureDataTask.DataReceivedDelegate(this.graph2DList[i].SetMeasureData);
                    }
                }

                ArrangeGraphForms();
                SetMaximumGraphArea(null);

                // 測定処理クラス初期化
                testSquence.InitPreMeasure(true);
                ShowStatusMessage(AppResource.GetString("MSG_MEAS_INIT"));
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex);
            }

            if (this.log != null) this.log.PutLog("frmMeasureMain.frmMeasureMain_Load() - 測定中画面のロードを終了しました。");
        }
예제 #2
0
        /// <summary>
        /// フォームロードイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmAnalyzeController_Load(object sender, EventArgs e)
        {
            if (this.log != null) this.log.PutLog("frmAnalyzeController.frmAnalyzeController_Load() - 解析制御画面のロードを開始しました。");

            try
            {
                AppResource.SetControlsText(this);

                this.mode = this.AnalyzeData.MeasureSetting.Mode;

                // ラベル表示等
                this.lblMode.Text = AppResource.GetString("TXT_MODE" + this.mode.ToString());
                if (this.mode == 1)
                {
                    this.lblSamplingTiming.Visible = false;
                    this.lblSamplingTiming_Title.Visible = false;
                }
                else if (this.mode == 2)
                {
                    this.lblSamplingTiming.Text = CommonLib.CommonMethod.GetSamplingTimingString(this.AnalyzeData.MeasureSetting.SamplingTiming_Mode2);
                }
                else if (this.mode == 3)
                {
                    this.lblSamplingTiming.Text = CommonLib.CommonMethod.GetSamplingTimingString(this.AnalyzeData.MeasureSetting.SamplingTiming_Mode3);
                }

                this.lblMeasureStartDateTime.Text = this.AnalyzeData.MeasureData.StartTime.ToString(AppResource.GetString("TXT_DATETIME_FORMAT"));
                this.lblMeasureEndDateTime.Text = this.AnalyzeData.MeasureData.EndTime.ToString(AppResource.GetString("TXT_DATETIME_FORMAT"));
                this.lblTrackValueTitle.Visible = this.lblTrackValue.Visible =
                this.lblScrollValueTitle.Visible = this.lblScrollValue.Visible = SystemSetting.SystemConfig.IsDebugMode;
                //this.btnPrintScreen.Visible = SystemSetting.SystemConfig.IsDebugMode;

                int calcCount = 0;
                bool found = false;
                // 2Dグラフの設定
                for (int i = 0; i < this.AnalyzeData.MeasureSetting.GraphSettingList.Length; i++)
                {
                    if (this.AnalyzeData.MeasureSetting.GraphSettingList[i] != null && this.AnalyzeData.MeasureSetting.GraphSettingList[i].IsValid)
                    {
                        this.graph2DList[i] = new frmGraph2D(this.log, i) { MdiParent = (Form)this.MdiParent, AnalyzeData = this.AnalyzeData, CurrentValueLineChanged = Graph2DCurrentValueLineChanged, FormHidden = Graph2DFormHidden };
                        this.graph2DList[i].OnAppIdleCallBack = this.graph_OnAppIdleCallBack;
                        this.graph2DList[i].ResizeEnd += new EventHandler(this.graph_Resize);
                        this.graph2DList[i].VisibleChanged += new EventHandler(this.graph_Visible);
                        this.graph2DList[i].OnOverShotAxisYZoomed = this.OverShotAxisYZoomed;
                        this.graph2DList[i].OnOverShotMouseDragZoomed = this.OverShotMouseDragZoomed;

                        //get calc tag list
                        if (calcCount < 10)
                        {
                            for (int m = 0; m < 10; m++)
                            {
                                //
                                if (this.AnalyzeData.DataTagSetting.GetTagKind(this.AnalyzeData.MeasureSetting.GraphSettingList[i].GraphTagList[m].GraphTagNo) == 2)
                                {
                                    for (int k = 0; k < calcCount; k++)
                                    {
                                        if (this.calcTagArray[k] > -1 && this.calcTagArray[k] == this.AnalyzeData.MeasureSetting.GraphSettingList[i].GraphTagList[m].GraphTagNo)
                                        {
                                            found = true;
                                            break;
                                        }

                                    }
                                    if (!found && calcCount < 10)
                                    {
                                        this.calcTagArray[calcCount] = this.AnalyzeData.MeasureSetting.GraphSettingList[i].GraphTagList[m].GraphTagNo;
                                        //this.graphGroupIndex[calcCount] = i;
                                        //this.graphIndex[calcCount] = m;
                                        calcCount++;
                                    }
                                    found = false;
                                }
                            }
                        }
                    }
                }

                // 各種画面の設定
                this.tagValueListForm = new frmTagValueList(this.log, this.AnalyzeData) { MdiParent = (Form)this.MdiParent, Top = this.Height, Left = 0 };
                this.graphControllerForm = new frmGraphController(this.log) { MdiParent = (Form)this.MdiParent, AnalyzeData = this.AnalyzeData, Left = 0, GraphFormList = this.graph2DList, GraphZoomInOccurred = this.Graph2DZoomIn, GraphZoomOutOccurred = this.Graph2DZoomOut, GraphArrangeOccurred = this.Graph2DArrange, GraphSettingChanged = this.Graph2SSettingChanged, GraphLineDotChanged = this.Graph2DLineDotChanged };

                this.tagValueListForm.PrepareCalculateTag(this.calcTagArray);
                // スクロールバーの設定
                this.trackMain.Visible = (this.mode == 2);
                // 3D表示画面の設定
                if (this.mode == 2)
                {
                    // Calculate Degree1 and Degree2 with Shot.10 data - 入角度,出角度を計算する(ショット10のデータを使用する)
                    CalculateDegrees();

                    // 3D制御画面
                    this.graph3DControllerForm = new frm3DGraphController(this.log, this) { MdiParent = (Form)this.MdiParent, Top = this.Height, Left = this.tagValueListForm.Width };
                    this.graph3DControllerForm.Graph3DList = this.graph3DList;
                    this.graph3DControllerForm.ControlStateStatus = frm3DGraphController.ControlState.DisableAll;
                    var f = new frmGraph3D(this.log, 0) { MdiParent = (Form)this.MdiParent, AnalyzeData = this.AnalyzeData, Top = this.graph3DControllerForm.Top + this.graph3DControllerForm.Height, Left = this.graph3DControllerForm.Left };
                    f.FormClosed += new FormClosedEventHandler(this.graph3D_FormClosed);
                    f.Resize += new EventHandler(this.graph_Resize);
                    this.graph3DList.Add(f);

                    // Mode2
                    this.trackMain.Minimum = 0;
                    this.trackMain.Maximum = this.AnalyzeData.MeasureData.SamplesCount - 1;    // Total Shot
                    this.trackMain.SmallChange = 1;
                    this.trackMain.LargeChange = 1;
                    this.trackMain.Value = 0;
                    this.lblShotMin.Visible = this.lblShotMax.Visible = true;
                    this.lblShotMin.Text = ((int)this.trackMain.Minimum + 1).ToString();
                    this.lblShotMax.Text = ((int)this.trackMain.Maximum + 1).ToString();

                    // Mode2の重ね書きショット数で全グラフの中の最大数を求める
                    GetMaxOverShotCountForMode2();

                    // Show Degree1 and Degree2 as limit of scrollbar - 入角度,出角度をスクロールバーの上下限値として表示する
                    this.lblScrollMin.Text = this.AnalyzeData.ChannelsSetting.ChannelMeasSetting.Degree1.ToString("##0.0");
                    this.lblScrollMax.Text = this.AnalyzeData.ChannelsSetting.ChannelMeasSetting.Degree2.ToString("##0.0");

                    // ショット番号を初期化して2Dグラフを更新する
                    ChangeShot(0);

                    isSensorData3D = Check3DSensorAndData();
                    if (isSensorData3D)
                    {
                        // 自動アニメーション用スレッド生成
                        if (this.graph3DList.Count > 0)
                        {
                            this.graph3DList[0].OnAnimationCompleted += new frmGraph3D.AnimationCompletedEventHandler(this.frmGraph3D_OnAnimationCompleted);
                        }
                        //this.bw3Dgraph = new BackgroundWorker();
                        //this.bw3Dgraph.WorkerSupportsCancellation = true;
                        //this.bw3Dgraph.WorkerReportsProgress = false;
                        //this.bw3Dgraph.DoWork += new DoWorkEventHandler(this.bw3DGraph_Animation);
                        //this.bw3Dgraph.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw3DGraph_WorkerCompleted);

                        // 3Dグラフへデータセット
                        if (this.dataList != null && this.dataList.Count > 0 && this.dataList[0] != null)
                        {
                            SetDataToGraph3D();
                            Create3DAnimation();
                            this.graph3DControllerForm.ControlStateStatus = frm3DGraphController.ControlState.Stop;
                        }
                    }
                }
                else
                {
                    // Mode1, 3
                    decimal maxx = 0;
                    if (this.AnalyzeData.MeasureSetting.GraphSettingList[0] != null)
                    {
                        var incx = GetIncrementX();
                        if (incx == 0)
                            incx = 1;

                        decimal modeval = 0;
                        if (this.mode == 1)
                            modeval = this.AnalyzeData.MeasureSetting.GraphSettingList[0].MaxX_Mode1;
                        else
                            modeval = this.AnalyzeData.MeasureSetting.GraphSettingList[0].MaxX_Mode3;

                        maxx = Convert.ToDecimal((double)modeval / incx);
                    }

                    //mode 1 index is start from 1
                    var index = 0;
                    var count = 0;
                    if (this.mode == 1)
                        index = 1;
                    else
                        count = 1;

                    this.ScrollSub.Maximum = this.AnalyzeData.MeasureData.SamplesCount - count;
                    this.scaleX = ((int)maxx < this.ScrollSub.Maximum) ? (int)maxx : this.ScrollSub.Maximum;
                    if (this.scaleX == 0)
                        this.scaleX = 1;

                    this.ScrollSub.LargeChange = this.scaleX + count;

                    this.ScrollSub.Minimum = index;
                    this.ScrollSub.Value = index;

                    // Show Low/High limit values of scrollbar - スクロールバーの上下限値を表示する
                    this.lblScrollMin.Text = this.ScrollSub.Minimum.ToString();
                    this.lblScrollMax.Text = (this.mode == 1) ? this.ScrollSub.Maximum.ToString() : ((int)this.ScrollSub.Maximum * (this.AnalyzeData.MeasureSetting.SamplingTiming_Mode3 / 1000.0)).ToString();

                    // 2Dグラフを更新する
                    UpdateGraph2D();
                }

                //initial 2D Current line position at start degree
                for (int i = 0; i < this.graph2DList.Length; i++)
                {
                    if (this.graph2DList[i] != null)
                    {
                        try { this.graph2DList[i].CurrentLine = this.currentIndex; }
                        catch { }
                    }
                }

                // グラフ表示位置調整
                ArrangeGraphForms();

                //Set maximum size of graph form.
                this.MdiParent.Resize += new EventHandler(this.frmAnalyzeMain_Resize);
                SetMaximumGraphArea(null);

            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex);
            }

            // アイコン表示
            InitButtonImage();

            if (this.log != null) this.log.PutLog("frmAnalyzeController.frmAnalyzeController_Load() - 解析制御画面のロードを終了しました。");
        }