public DataGenerator() { _MaxDataPerLoop = 0; _MaxChannel = 0; _MaxLoop = 0; // 測定中 this.measSetting = SystemSetting.MeasureSetting; this.chSetting = SystemSetting.ChannelsSetting; }
public object Clone() { ChannelsSetting ret = new ChannelsSetting(); for (int i = 0; i < ChannelSettingList.Length; i++) { ret.ChannelSettingList[i] = (ChannelSetting)this.ChannelSettingList[i].Clone(); } ret.ChannelMeasSetting = (ChannelMeasSetting)this.ChannelMeasSetting.Clone(); return ret; }
/// <summary> /// initial data /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmChannelSetting_Load(object sender, EventArgs e) { try { PutLog("frmChannelSetting-frmChannelSetting_Load() open form"); this.uctrlArray = new uctrlChannelSetting[10]; this.uctrlArray[0] = uctrlChannelSetting1; uctrlChannelSetting1.Width = 112; //uctrlChannelSetting1.Height = 461; for (int i = 1; i < this.uctrlArray.Length; i++) { this.uctrlArray[i] = new uctrlChannelSetting(); this.uctrlArray[i].Anchor = uctrlChannelSetting1.Anchor; this.uctrlArray[i].ChannelNo = i + 1; this.uctrlArray[i].boardType = uctrlChannelSetting.BoardType.NotSetting; this.uctrlArray[i].Font = new Font(uctrlChannelSetting1.Font, FontStyle.Regular); this.uctrlArray[i].Size = new Size(uctrlChannelSetting1.Width, uctrlChannelSetting1.Height); this.uctrlArray[i].Left = uctrlChannelSetting1.Left + (uctrlChannelSetting1.Width + 3) * i; this.uctrlArray[i].Top = uctrlChannelSetting1.Top; this.uctrlArray[i].TabIndex = 20 + i; this.Controls.Add(this.uctrlArray[i]); } this.Width = this.uctrlArray[9].Left + this.uctrlArray[9].Width + 20; //this.Height = this.uctrlChannelSetting1.Location.Y + this.uctrlChannelSetting1.Height + 20 + this.btnUpdate.Height + 20; this.MinimumSize = new Size(this.Width, this.Height); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.setting = SystemSetting.ChannelsSetting; //set value to user control if (this.setting.ChannelSettingList != null) { for (int k = 0; k < this.uctrlArray.Length; k++) { if (this.setting.ChannelSettingList[k] != null) { switch (this.setting.ChannelSettingList[k].ChKind) { case ChannelKindType.B: this.uctrlArray[k].boardType = uctrlChannelSetting.BoardType.Type_B; B_BoardSetting b = this.setting.ChannelSettingList[k].BoardSetting as B_BoardSetting; if (b != null) { this.uctrlArray[k].Hold_B = b.Hold; this.uctrlArray[k].Precision_B = b.Precision; } break; case ChannelKindType.D: this.uctrlArray[k].boardType = uctrlChannelSetting.BoardType.Type_D; break; case ChannelKindType.L: this.uctrlArray[k].boardType = uctrlChannelSetting.BoardType.Type_L; L_BoardSetting l = this.setting.ChannelSettingList[k].BoardSetting as L_BoardSetting; if (l != null) { this.uctrlArray[k].Range_L = l.Range; this.uctrlArray[k].FullScale_L = l.Full; this.uctrlArray[k].SensorOutput_L = l.SensorOutput; } break; case ChannelKindType.N: this.uctrlArray[k].boardType = uctrlChannelSetting.BoardType.None; break; case ChannelKindType.R: this.uctrlArray[k].boardType = uctrlChannelSetting.BoardType.Type_R; R_BoardSetting r = this.setting.ChannelSettingList[k].BoardSetting as R_BoardSetting; if (r != null) { this.uctrlArray[k].Precision_R = r.Precision; } break; case ChannelKindType.T: this.uctrlArray[k].boardType = uctrlChannelSetting.BoardType.Type_T; break; case ChannelKindType.V: this.uctrlArray[k].boardType = uctrlChannelSetting.BoardType.Type_V; V_BoardSetting v = this.setting.ChannelSettingList[k].BoardSetting as V_BoardSetting; if (v != null) { this.uctrlArray[k].Filter_V = v.Filter; this.uctrlArray[k].Range_V = v.Range; this.uctrlArray[k].FullScale_V = v.Full; this.uctrlArray[k].ZeroScale_V = v.Zero; } break; default: break; } //チャンネルタイプの保持 this.oldSetting[k] = this.setting.ChannelSettingList[k].ChKind; //小数点桁数 //ボード無・Tボードは小数点表示なし if (this.setting.ChannelSettingList[k].ChKind == ChannelKindType.N || this.setting.ChannelSettingList[k].ChKind == ChannelKindType.T) { this.uctrlArray[k].PointVisible = false; this.uctrlArray[k].NumPoint = 0; } else //その他は、海外モードかどうかで判定 { this.uctrlArray[k].PointVisible = !SystemSetting.HardInfoStruct.IsExportMode; if (SystemSetting.HardInfoStruct.IsExportMode) this.uctrlArray[k].NumPoint = 0; else this.uctrlArray[k].NumPoint = this.setting.ChannelSettingList[k].NumPoint; } } else { this.setting.ChannelSettingList[k] = new ChannelSetting(); this.setting.ChannelSettingList[k].ChNo = k + 1; this.setting.ChannelSettingList[k].NumPoint = 0; } this.uctrlArray[k].DirtyFlag = false; this.uctrlArray[k].BoardTypeChanged += new uctrlChannelSetting.BoardTypeChangedEventHandler(frmChannelSetting_BoardTypeChanged); } } //channel設定の反映 this.ucTimingSetting1.setting = this.setting; AppResource.SetControlsText(this); //海外モードの変更イベント SystemSetting.HardInfoStruct.ChangeExportMode += new HardInfoStruct.ChangeExportModeEventHander(HardInfoStruct_ChangeExportMode); } catch (Exception ex) { ShowErrorMessage(ex); } }
/// <summary> /// フォームロードイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMeasureStart_Load(object sender, EventArgs e) { if (this.log != null) this.log.PutLog("frmMeasureStart.frmMeasureStart_Load() - 測定開始画面のロードを開始しました。"); try { // 言語切替 AppResource.SetControlsText(this); cmbMeasMode.Items.Clear(); cmbMeasMode.Items.Add(AppResource.GetString("TXT_MODE1")); cmbMeasMode.Items.Add(AppResource.GetString("TXT_MODE2")); cmbMeasMode.Items.Add(AppResource.GetString("TXT_MODE3")); // タグ一覧表示 this.tagSetting = SystemSetting.DataTagSetting; // 測定設定ファイル読み込み this.measSetting = SystemSetting.MeasureSetting; this.relationSetting = SystemSetting.RelationSetting; this.chSetting = SystemSetting.ChannelsSetting; //選択色をセットする。 cmbColor.ListColors = new List<Color>(Constants.GraphLineColors); cmbColor.InitColors(); // ch-tag relation can be changed in other setting form. if (this.measSetting != null && this.measSetting.MeasTagList != null) { for (int i = 1; i < this.relationSetting.RelationList.Length; i++) { this.measSetting.MeasTagList[i - 1] = this.relationSetting.RelationList[i].TagNo_1; } this.revolutionTag = this.relationSetting.RelationList[0].TagNo_1; } // 測定設定を表示 ShowMeasSetting(); this.measSetting.IsUpdated = false; if (cmbColor.Visible) { cmbColor.Visible = false; } //コンテンツのロード ContentsLoad(); //ボタンイメージの設定 InitButtonImage(); } catch (Exception ex) { ShowErrorMessage(ex); } if (this.log != null) this.log.PutLog("frmMeasureStart.frmMeasureStart_Load() - 測定開始画面のロードを終了しました。"); }
/// <summary> /// 計測前初期化処理 /// </summary> /// <param name="ch_setting"></param> /// <param name="meas_setting"></param> /// <param name="folderPath"></param> /// <remarks> /// 計測前処理として、内部のSampleDatasのHeader情報を書き込み。 /// 自動保存されるように設定する。 /// </remarks> public void InitializeforMeasure(ChannelsSetting ch_setting , MeasureSetting meas_setting , string folderPath) { sampleDatas = new SampleDataManager(); sampleDatas.FolderPath = folderPath; sampleDatas.HeaderData = new SampleDataHeader(); //モードの設定 sampleDatas.HeaderData.Mode = (ModeType)meas_setting.Mode; //チャンネルデータの設定 SampleDataHeader.CHANNELDATATYPE[] channeldatatypes = new SampleDataHeader.CHANNELDATATYPE[11]; //回転数分 switch (sampleDatas.HeaderData.Mode) { case ModeType.MODE3: channeldatatypes[0] = SampleDataHeader.CHANNELDATATYPE.NONE; break; default: channeldatatypes[0] = SampleDataHeader.CHANNELDATATYPE.SINGLEDATA; break; } //他チャンネル for(int i = 0 ; i < ch_setting.ChannelSettingList.Length; i++) { if (ch_setting.ChannelSettingList[i].ChKind != ChannelKindType.N && meas_setting.MeasTagList[i] != -1) { switch (sampleDatas.HeaderData.Mode) { case ModeType.MODE1: if (ch_setting.ChannelSettingList[i].ChKind == ChannelKindType.R && ch_setting.ChannelSettingList[i].Mode1_Trigger == Mode1TriggerType.MAIN) channeldatatypes[i+1] = SampleDataHeader.CHANNELDATATYPE.DOUBLEDATA; else channeldatatypes[i+1] = SampleDataHeader.CHANNELDATATYPE.SINGLEDATA; break; case ModeType.MODE2: case ModeType.MODE3: channeldatatypes[i+1] = SampleDataHeader.CHANNELDATATYPE.SINGLEDATA; break; } } else { channeldatatypes[i+1] = SampleDataHeader.CHANNELDATATYPE.NONE; } } sampleDatas.HeaderData.ChannelsDataType = channeldatatypes; //自動保存の開始 sampleDatas.AutoWriteFlag = true; }
/// <summary> /// 各種設定取得 /// </summary> private void LoadSettings() { // タグ一覧取得 this.tagSetting = (this.IsMeasure) ? SystemSetting.DataTagSetting : this.AnalyzeData.DataTagSetting; // 測定設定取得 this.measSetting = (this.IsMeasure) ? SystemSetting.MeasureSetting : this.AnalyzeData.MeasureSetting; // 測定項目-チャンネル結び付け設定取得 this.relationSetting = (this.IsMeasure) ? SystemSetting.RelationSetting : this.AnalyzeData.TagChannelRelationSetting; // 回転数タグ this.revolutionTag = this.relationSetting.RelationList[0].TagNo_1; // チャンネル設定取得 this.chSetting = (this.IsMeasure) ? SystemSetting.ChannelsSetting : this.AnalyzeData.ChannelsSetting; }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmLocationSetting_Load(object sender, EventArgs e) { try { AppResource.SetControlsText(this); //システム設定からチャンネル設定を取得 this.chSettings = SystemSetting.ChannelsSetting; //システム設定からセンサ位置情報を取得 if (SystemSetting.PositionSetting != null) { this.sensorPositionSetting = SystemSetting.PositionSetting; } else { this.sensorPositionSetting = new SensorPositionSetting(); this.sensorPositionSetting.PositionList = new PositionSetting[10]; for (int i = 0; i < this.sensorPositionSetting.PositionList.Length; i++) { this.sensorPositionSetting.PositionList[i] = new PositionSetting(); this.sensorPositionSetting.PositionList[i].ChNo = -1; this.sensorPositionSetting.PositionList[i].X = -100; this.sensorPositionSetting.PositionList[i].Z = -100; this.sensorPositionSetting.PositionList[i].Way = PositionSetting.WayType.INVAILED; this.sensorPositionSetting.PositionList[i].Target = PositionSetting.TargetType.INVAILED; } } this.readSettingData(); this.setGridData(); frmLocationSetting2 win2 = new frmLocationSetting2(this.log); this.locationSetting2 = win2; this.locationSetting2.visibleKanagata(this.chkDispKanagata.Checked); win2.locationSetting = this; win2.setLocationSetting(this); win2.Show(this.Parent); win2.setDefault(this.getSettingStage(), this.settingList); win2.DoneInitailized += new EventHandler(win2_DoneInitailized); } catch (Exception ex) { ShowErrorMessage(ex); } }
/// <summary> /// 測定処理前の初期化 /// </summary> public void InitPreMeasure(bool RecordFlag , bool bForPositionSetting = false) { //チャンネル設定の取得 this.channelsSetting = (ChannelsSetting)SystemSetting.ChannelsSetting.Clone(); ////チャンネル設定のLoad //string channcelxmlFilePath = CommonLib.SystemDirectoryPath.SystemPath + ChannelsSetting.FileName; //if (System.IO.File.Exists(channcelxmlFilePath)) //{ // channelsSetting = SettingBase.DeserializeFromXml<ChannelsSetting>(channcelxmlFilePath); //} //測定設定の取得 this.measureSetting = (MeasureSetting)SystemSetting.MeasureSetting.Clone(); //測定設定のLoad //string measurexmlFilePath = CommonLib.SystemDirectoryPath.SystemPath + MeasureSetting.FileName; //if (System.IO.File.Exists(measurexmlFilePath)) //{ // measureSetting = SettingBase.DeserializeFromXml<MeasureSetting>(measurexmlFilePath); //} //リアルタイムデータの初期化 RealTimeData.bRecord = RecordFlag; //if (this.Mode != ModeType.Non && measureSetting.Mode != (int)this.Mode) if (bForPositionSetting) { measureSetting.Mode = (int)ModeType.Mode3; measureSetting.SamplingTiming_Mode3 = 200000; measureSetting.MeasureTime_Mode3 = 0; } RealTimeData.InitData(channelsSetting, measureSetting, CommonLib.SystemDirectoryPath.MeasureData + DateTime.Now.ToString("yyyyMMdd_HHmmss")); //測定チャンネルの設定 for(int i = 0 ; i < channelsSetting.ChannelSettingList.Length; i++) { channelEnables[i] = (channelsSetting.ChannelSettingList[i].ChKind != ChannelKindType.N && measureSetting.MeasTagList[i] != -1); } //測定モードを取得 this.Mode = (ModeType)measureSetting.Mode; //サンプリング周期を取得 switch ((ModeType)this.Mode) { case ModeType.Mode1: this.SamplingTiming = (uint)measureSetting.SamplingCountLimit; break; case ModeType.Mode2: this.SamplingTiming = (uint)measureSetting.SamplingTiming_Mode2; break; case ModeType.Mode3: this.SamplingTiming = (uint)measureSetting.SamplingTiming_Mode3; break; } //通信クラスイベントのメソッド登録 comm.ExecuteCommandMethod = new CommRM3000.ExecuteCommandHander(ExcuteCommand); comm.ReserveDataMethod = new CommRM3000.ReserveDataHander(ReserveData); }
/// <summary> /// Constructor /// </summary> /// <param name="log">ログ</param> public frmTagChannelRelation(LogManager log) { InitializeComponent(); int index = 0; this.log = log; try { //タグリスト this.setting = SystemSetting.DataTagSetting; dgvDataTag.Rows.Clear(); if (this.setting != null && this.setting.DataTagList != null) { this.list.AddRange(this.setting.DataTagList); int count = this.setting.DataTagList.Length; for (int i = 0; i < count; i++) { if (this.setting.DataTagList[i] != null) { dgvDataTag.Rows.Add(new object[] { this.setting.DataTagList[i].TagNo, this.setting.DataTagList[i].GetSystemTagName(), this.setting.DataTagList[i].GetSystemUnit() }); } else { dgvDataTag.Rows.Add(new object[] { "---", "---", "---" }); } } } this.chSetting = SystemSetting.ChannelsSetting; if (this.chSetting.ChannelSettingList == null) { this.chSetting.ChannelSettingList = new ChannelSetting[10]; for (int i = 0; i < this.chSetting.ChannelSettingList.Length; i++) { this.chSetting.ChannelSettingList[i] = new ChannelSetting(); this.chSetting.ChannelSettingList[i].ChKind = 0; this.chSetting.ChannelSettingList[i].ChNo = i + 1; } } //回転数結び付け設定 dgvRotation.Rows.Add(new string[] { "---", "---", "-1" }); this.relationSetting = SystemSetting.RelationSetting; if (this.relationSetting != null && this.relationSetting.RelationList != null) { if (this.relationSetting.RelationList.Length <= 11) { DataTag tag = null; if (this.relationSetting.RelationList[0] != null) { tag = FindDataTag(this.relationSetting.RelationList[0].TagNo_1); if (tag != null) { dgvRotation.Rows[0].Cells[0].Value = tag.GetSystemTagName(); dgvRotation.Rows[0].Cells[1].Value = tag.GetSystemUnit(); dgvRotation.Rows[0].Cells[2].Value = tag.TagNo.ToString(); selectedRotation = tag; } } for (index = 1; index < 11; index++) { if (this.relationSetting.RelationList[index] != null) { tag = FindDataTag(this.relationSetting.RelationList[index].TagNo_1); if (tag != null) { this.selectedTagArray[index - 1] = tag; } if (this.relationSetting.RelationList[index].TagNo_2 > 0) { tag = FindDataTag(this.relationSetting.RelationList[index].TagNo_2); this.selectedTagSecond[index - 1] = tag; } } } LoadBoardDataByChannelType(); } } else { this.relationSetting.RelationList = new RelationSetting[11]; for (int i = 0; i < 11; i++) { dgvBoardChannel.Rows.Add(new string[] { i.ToString(), "---", "---", "---", "-1" }); } } AppResource.SetControlsText(this); } catch (Exception ex) { ShowErrorMessage(ex); } }
/// <summary> /// revert to last save /// </summary> public override void Revert() { ChannelsSetting data = new ChannelsSetting(); //if (this.oldValue == null) //{ if (System.IO.File.Exists(this.FilePath)) { this.oldValue = (ChannelsSetting)ChannelsSetting.Deserialize(this.FilePath); } else { this.oldValue = new ChannelsSetting(); } //} data = (ChannelsSetting)this.oldValue; this.ChannelSettingList = data.ChannelSettingList; this.ChannelMeasSetting = data.ChannelMeasSetting; this.IsUpdated = false; }
/// <summary> /// load content analyze data /// </summary> private void LoadContent() { bool selectAll = false; try { this.analyzeData.Desirialize_WithOut_Data(); } catch { } if (this.analyzeData.DataTagSetting != null) { this.tagSetting = this.analyzeData.DataTagSetting; } else { this.tagSetting = new DataTagSetting(); } if (this.analyzeData.MeasureSetting != null) { this.measSetting = this.analyzeData.MeasureSetting; } else { selectAll = true; this.measSetting = new MeasureSetting(); } if (this.analyzeData.TagChannelRelationSetting != null) { this.relationSetting = this.analyzeData.TagChannelRelationSetting; } else { this.relationSetting = new TagChannelRelationSetting(); } if (this.analyzeData.ChannelsSetting != null) { this.chSetting = this.analyzeData.ChannelsSetting; } else { this.chSetting = new ChannelsSetting(); } if (this.analyzeData.PositionSetting != null) { this.positionSetting = this.analyzeData.PositionSetting; } else { this.positionSetting = new SensorPositionSetting(); } if (selectAll) { for (int i = 1; i < this.relationSetting.RelationList.Length; i++) { this.measSetting.MeasTagList[i - 1] = this.relationSetting.RelationList[i].TagNo_1; } } }
/// <summary> /// Set graph setting to graph control /// </summary> public void SetGraphSetting() { // 測定設定ファイル読み込み if (this.IsMeasure) { // 測定中 this.measSetting = SystemSetting.MeasureSetting; this.relationSetting = SystemSetting.RelationSetting; this.chSetting = SystemSetting.ChannelsSetting; this.graphViewer.EnableCurrentLine = false; this.IsMouseZoomEnabled = false; } else { // 解析中 this.measSetting = this.AnalyzeData.MeasureSetting; this.relationSetting = this.AnalyzeData.TagChannelRelationSetting; this.chSetting = this.AnalyzeData.ChannelsSetting; this.graphViewer.EnableCurrentLine = true; this.IsMouseZoomEnabled = true; } // 測定項目設定ファイル読み込み if (this.tagSetting == null) { if (this.IsMeasure) { // 測定中 this.tagSetting = SystemSetting.DataTagSetting; } else { // 解析中 this.tagSetting = this.AnalyzeData.DataTagSetting; } } if (this.measSetting != null && this.measSetting.GraphSettingList != null && this.graphIndex >= 0) { var graph = this.measSetting.GraphSettingList[this.graphIndex]; // グラフタイトル this.Text = graph.Title; // グラフに割り当てられているCH番号を取得する { // CH番号リストクリア this.chIndexList = new ChannelIndex[10]; for (int i = 0; i < this.chIndexList.Length; i++) { this.chIndexList[i] = new ChannelIndex(); } this.calcTagList = new ChannelIndex[10]; for (int i = 0; i < this.calcTagList.Length; i++) { this.calcTagList[i] = new ChannelIndex(); } // 測定項目-チャンネル結び付け設定ファイル読み込み var relation = (this.IsMeasure) ? SystemSetting.RelationSetting : this.AnalyzeData.TagChannelRelationSetting; if (relation == null || relation.RelationList == null || relation.RelationList.Length == 0) { MessageBox.Show(AppResource.GetString("MSG_RELATION_INVALID_SETTING"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } // CH番号リスト探索 for (int i = 0; i < graph.GraphTagList.Length; i++) { if (graph.GraphTagList[i].GraphTagNo != -1) { if (this.tagSetting.GetTagKind(graph.GraphTagList[i].GraphTagNo) == 2) { // 2:演算(解析) this.calcTagList[i].Index = graph.GraphTagList[i].GraphTagNo; continue; } else { for (int j = 0; j < relation.RelationList.Length; j++) { if (graph.GraphTagList[i].GraphTagNo == relation.RelationList[j].TagNo_1 || (this.measSetting.Mode == 1 && graph.GraphTagList[i].GraphTagNo == relation.RelationList[j].TagNo_2)) { this.chIndexList[i].Index = j; this.chIndexList[i].IsMaxCh = (graph.GraphTagList[i].GraphTagNo == relation.RelationList[j].TagNo_1); break; } } } } } } // グラフ軸設定 if (this.measSetting.Mode == 1) { CreateGraphInfo1(graph); } else if (this.measSetting.Mode == 2) { CreateGraphInfo2(graph); } else if (this.measSetting.Mode == 3) { CreateGraphInfo3(graph); } } }
/// <summary> /// フォームロードイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmGraphAxisSetting_Load(object sender, EventArgs e) { if (this.log != null) this.log.PutLog("frmGraphAxisSetting.frmGraphAxisSetting_Load() - グラフ軸設定画面のロードを開始しました。"); try { AppResource.SetControlsText(this); config.LoadXmlFile(); IsModXAxis = false; if (this.MeasSetting == null) { ShowErrorMessage(AppResource.GetString("ERROR_MEASURE_SETTING_FILE_NOT_FOUND")); this.Close(); } if (this.IsMeasure) { // 測定中 this.relationSetting = SystemSetting.RelationSetting; this.chSetting = SystemSetting.ChannelsSetting; } else { // 解析中 this.relationSetting = this.AnalyzeData.TagChannelRelationSetting; this.chSetting = this.AnalyzeData.ChannelsSetting; } // Check this graph includes B and R type board only. (Mode1) this.boardBR = (this.MeasSetting.Mode == 1) ? CheckBoardBR(this.Graph) : false; this.binding = true; if (Graph != null) { this.currentGraphSetting = (GraphSetting)Graph.Clone(); if (this.MeasSetting.Mode == 1) { this.ntbMinX.Text = Graph.MinimumX_Mode1.ToString(); this.ntbMaxX.Text = Graph.MaxX_Mode1.ToString(); this.ntbDistanceX.Text = Graph.DistanceX_Mode1.ToString(); if (this.boardBR) { this.lblSign.Visible = true; this.ntbMinY.Text = Graph.CenterScale.ToString(); this.ntbMaxY.Text = Graph.Scale.ToString(); this.ntbMinY.MaxLength = 9; this.ntbMaxY.AllowMinus = false; this.ntbDistanceY.Text = Graph.DistanceY_CenterScale_Mode1.ToString(); } else { this.ntbMinY.Text = Graph.MinimumY_Mode1.ToString(); this.ntbMaxY.Text = Graph.MaxY_Mode1.ToString(); this.ntbMaxY.AllowMinus = true; this.ntbDistanceY.Text = Graph.DistanceY_Mode1.ToString(); } this.ntbMinY.AllowMinus = true; } else if (this.MeasSetting.Mode == 2) { this.ntbMinX.Text = SystemSetting.ChannelsSetting.ChannelMeasSetting.Degree1.ToString(); this.ntbMaxX.Text = SystemSetting.ChannelsSetting.ChannelMeasSetting.Degree2.ToString(); this.ntbDistanceX.Text = Graph.DistanceX_Mode2.ToString(); this.ntbMinY.Text = Graph.MinimumY_Mode2.ToString(); this.ntbMaxY.Text = Graph.MaxY_Mode2.ToString(); this.ntbDistanceY.Text = Graph.DistanceY_Mode2.ToString(); } else if (this.MeasSetting.Mode == 3) { this.ntbMinX.Text = Graph.MinimumX_Mode3.ToString(); this.ntbMaxX.Text = Graph.MaxX_Mode3.ToString(); this.ntbDistanceX.Text = Graph.DistanceX_Mode3.ToString(); this.ntbMinY.Text = Graph.MinimumY_Mode3.ToString(); this.ntbMaxY.Text = Graph.MaxY_Mode3.ToString(); this.ntbDistanceY.Text = Graph.DistanceY_Mode3.ToString(); } //if (this.MeasSetting.Mode == 1) //{ // this.ntbMinY.Text = Graph.CenterScale.ToString(); // this.ntbMaxY.Text = Graph.Scale.ToString(); // this.ntbMinY.AllowMinus = true; // this.ntbMaxY.AllowMinus = true; // this.ntbMinY.MaxLength = 9; // this.ntbDistanceY.Text = Graph.DistanceY_Mode1.ToString(); //} //else //{ // if (this.MeasSetting.Mode == 2) // { // this.ntbMinY.Text = Graph.MinimumY_Mode2.ToString(); // this.ntbMaxY.Text = Graph.MaxY_Mode2.ToString(); // this.ntbDistanceY.Text = Graph.DistanceY_Mode2.ToString(); // } // else // { // this.ntbMinY.Text = Graph.MinimumY_Mode3.ToString(); // this.ntbMaxY.Text = Graph.MaxY_Mode3.ToString(); // this.ntbDistanceY.Text = Graph.DistanceY_Mode3.ToString(); // } //} if (this.MeasSetting.Mode != 2) { ntbMinX.Enabled = false; ntbMinX.Text = "0"; } // this.ntbDistanceY.Text = Graph.DistanceY.ToString(); this.ntbShotNumber.Text = Graph.NumbeOfShotMode2.ToString(); } this.binding = false; string unit = string.Empty; if (this.MeasSetting.Mode == 3) { // To Net // Enable below after you fix #.... #if false if (this.MeasSetting.SamplingTiming_Mode3 > 999999) { unit = AppResource.GetString("TXT_UNIT_SECOND"); } else if (this.MeasSetting.SamplingTiming_Mode3 > 999) { unit = AppResource.GetString("TXT_UNIT_MILLISECOND"); } else if (this.MeasSetting.SamplingTiming_Mode3 <= 999) { unit = AppResource.GetString("TXT_UNIT_MICROSECOND"); ; } #else unit = AppResource.GetString("TXT_UNIT_MILLISECOND"); #endif } if (this.MeasSetting.Mode == 1) { this.lblUnit1.Text = "TXT_SHOT_NUMBER"; this.lblUnit2.Text = string.Empty; } else if (this.MeasSetting.Mode == 2) { if (!IsMeasure) { this.lblShotNumber.Visible = true; this.ntbShotNumber.Visible = true; this.lblShot.Visible = true; } this.lblUnit1.Text = "TXT_DEGREE_UNIT"; this.lblUnit2.Text = string.Empty; ntbMinX.Enabled = false; ntbMaxX.Enabled = false; } else if (this.MeasSetting.Mode == 3) { this.lblUnit1.Text = unit; this.lblUnit2.Text = string.Empty; } if (this.currentGraphSetting != null && this.currentGraphSetting.GraphTagList != null) { for (int i = 0; i < this.currentGraphSetting.GraphTagList.Length; i++) { if (this.currentGraphSetting.GraphTagList[i].GraphTagNo > 0) { if (!IsMeasure && this.MeasSetting.Mode == 2) { this.lblShotNumber.Visible = true; this.ntbShotNumber.Visible = true; this.lblShot.Visible = true; } DataTagSetting tagSetting = (IsMeasure) ? SystemSetting.DataTagSetting : this.AnalyzeData.DataTagSetting; this.lblUnit2.Text = tagSetting.GetUnitFromTagNo(this.currentGraphSetting.GraphTagList[i].GraphTagNo); break; } } } // 言語切替 AppResource.SetControlsText(this); } catch (Exception ex) { ShowErrorMessage(ex); } if (this.log != null) this.log.PutLog("frmGraphAxisSetting.frmGraphAxisSetting_Load() - グラフ軸設定画面のロードを終了しました。"); }
/// <summary> /// load settings from xml files /// </summary> public static void LoadInstance() { MeasureSetting = new MeasureSetting(); string xmlFilePath = CommonLib.SystemDirectoryPath.SystemPath + MeasureSetting.FileName; if (System.IO.File.Exists(xmlFilePath)) { MeasureSetting = (MeasureSetting)MeasureSetting.Deserialize(xmlFilePath); if (MeasureSetting.Mode1_MeasCondition != null) { MeasureSetting.Mode1_MeasCondition.IsUpdated = false; } } else { MeasureSetting = new MeasureSetting() { FilePath = xmlFilePath }; } ChannelsSetting = new ChannelsSetting(); xmlFilePath = CommonLib.SystemDirectoryPath.SystemPath + ChannelsSetting.FileName; if (System.IO.File.Exists(xmlFilePath)) { ChannelsSetting = (ChannelsSetting)ChannelsSetting.Deserialize(xmlFilePath); } else { ChannelsSetting = new ChannelsSetting() { FilePath = xmlFilePath }; } ConstantSetting = new ConstantSetting(); xmlFilePath = CommonLib.SystemDirectoryPath.SystemPath + ConstantSetting.FileName; if (System.IO.File.Exists(xmlFilePath)) { ConstantSetting = (ConstantSetting)ConstantSetting.Deserialize(xmlFilePath); } else { ConstantSetting = new ConstantSetting() { FilePath = xmlFilePath }; } DataTagSetting = new DataTagSetting(); xmlFilePath = CommonLib.SystemDirectoryPath.SystemPath + DataTagSetting.FileName; if (System.IO.File.Exists(xmlFilePath)) { DataTagSetting = (DataTagSetting)DataTagSetting.Deserialize(xmlFilePath); } else { DataTagSetting = new DataTagSetting() { FilePath = xmlFilePath }; } RelationSetting = new TagChannelRelationSetting(); xmlFilePath = CommonLib.SystemDirectoryPath.SystemPath + TagChannelRelationSetting.FileName; if (System.IO.File.Exists(xmlFilePath)) { RelationSetting = (TagChannelRelationSetting)TagChannelRelationSetting.Deserialize(xmlFilePath); } else { RelationSetting = new TagChannelRelationSetting() { FilePath = xmlFilePath }; } PositionSetting = new SensorPositionSetting(); xmlFilePath = CommonLib.SystemDirectoryPath.SystemPath + SensorPositionSetting.FileName; if (System.IO.File.Exists(xmlFilePath)) { PositionSetting = (SensorPositionSetting)SensorPositionSetting.Deserialize(xmlFilePath); } else { PositionSetting = new SensorPositionSetting() { FilePath = xmlFilePath }; } SystemConfig = new SystemConfig(); SystemConfig.LoadXmlFile(); HardInfoStruct = new HardInfoStruct(); HardInfoStruct.LoadXmlFile(); }
/// <summary> /// Initialize controls /// </summary> private void InitializeControls() { if (this.isMeasure) { this.tagLabels = new Label[] { lblItem0, lblItem1, lblItem2, lblItem3, lblItem4, lblItem5, lblItem6, lblItem7, lblItem8, lblItem9, lblItem10 }; this.unitLabels = new Label[] { lblUnit0, lblUnit1, lblUnit2, lblUnit3, lblUnit4, lblUnit5, lblUnit6, lblUnit7, lblUnit8, lblUnit9, lblUnit10 }; this.dataValueLabels = new Label[] { lblDataValue0, lblDataValue1, lblDataValue2, lblDataValue3, lblDataValue4, lblDataValue5, lblDataValue6, lblDataValue7, lblDataValue8, lblDataValue9, lblDataValue10 }; this.dataValueLabels_Zero = new Label[] { lblDataValue_Zero0, lblDataValue_Zero1, lblDataValue_Zero2, lblDataValue_Zero3, lblDataValue_Zero4, lblDataValue_Zero5, lblDataValue_Zero6, lblDataValue_Zero7, lblDataValue_Zero8, lblDataValue_Zero9, lblDataValue_Zero10 }; } else { this.tagLabels = new Label[] { lblAnlMeasItem0, lblAnlMeasItem1, lblAnlMeasItem2, lblAnlMeasItem3, lblAnlMeasItem4, lblAnlMeasItem5, lblAnlMeasItem6, lblAnlMeasItem7, lblAnlMeasItem8, lblAnlMeasItem9, lblAnlMeasItem10 }; this.unitLabels = new Label[] { lblAnlMeasUnit0, lblAnlMeasUnit1, lblAnlMeasUnit2, lblAnlMeasUnit3, lblAnlMeasUnit4, lblAnlMeasUnit5, lblAnlMeasUnit6, lblAnlMeasUnit7, lblAnlMeasUnit8, lblAnlMeasUnit9, lblAnlMeasUnit10 }; this.dataValueLabels = new Label[] { lblAnlDataMeas0, lblAnlDataMeas1, lblAnlDataMeas2, lblAnlDataMeas3, lblAnlDataMeas4, lblAnlDataMeas5, lblAnlDataMeas6, lblAnlDataMeas7, lblAnlDataMeas8, lblAnlDataMeas9, lblAnlDataMeas10 }; this.dataValueLabels_Zero = new Label[] { lblAnlDataMeas_Zero0, lblAnlDataMeas_Zero1, lblAnlDataMeas_Zero2, lblAnlDataMeas_Zero3, lblAnlDataMeas_Zero4, lblAnlDataMeas_Zero5, lblAnlDataMeas_Zero6, lblAnlDataMeas_Zero7, lblAnlDataMeas_Zero8, lblAnlDataMeas_Zero9, lblAnlDataMeas_Zero10 }; pnlAnalysis.Left = pnlMain.Left; pnlAnalysis.Top = pnlMain.Top; pnlMain.Visible = false; pnlAnalysis.Visible = true; this.tagLabelsAnl = new Label[] { lblAnlysisItem0, lblAnlysisItem1, lblAnlysisItem2, lblAnlysisItem3, lblAnlysisItem4, lblAnlysisItem5, lblAnlysisItem6, lblAnlysisItem7, lblAnlysisItem8, lblAnlysisItem9, lblAnlysisItem10 }; this.unitLabelsAnl = new Label[] { lblAnlUnit0, lblAnlUnit1, lblAnlUnit2, lblAnlUnit3, lblAnlUnit4, lblAnlUnit5, lblAnlUnit6, lblAnlUnit7, lblAnlUnit8, lblAnlUnit9, lblAnlUnit10 }; this.dataValueLabelsAnl = new Label[] { lblAnlData0, lblAnlData1, lblAnlData2, lblAnlData3, lblAnlData4, lblAnlData5, lblAnlData6, lblAnlData7, lblAnlData8, lblAnlData9, lblAnlData10 }; this.calcAssignedTagNo = new int[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; } // 各種設定読み込み if (this.isMeasure) { // 測定中 this.tagSetting = RealTimeData.DataTagSetting; this.measSetting = SystemSetting.MeasureSetting; this.chSetting = SystemSetting.ChannelsSetting; this.relationSetting = SystemSetting.RelationSetting; } else { // 解析中 this.tagSetting = this.analyzeData.DataTagSetting; this.measSetting = this.analyzeData.MeasureSetting; this.chSetting = this.analyzeData.ChannelsSetting; this.relationSetting = this.analyzeData.TagChannelRelationSetting; } // 測定項目No2の調整など if (this.measSetting != null && this.measSetting.MeasTagList != null) { var tagLabelList = new List<Label>(); var dataValueLabelList = new List<Label>(); var dataValueLabelZeroList = new List<Label>(); var unitLabelList = new List<Label>(); //回転数の測定項目を取得 this.tagLabels[0].Text = (this.relationSetting.RelationList[0].TagNo_1 > 0) ? this.tagSetting.GetTagNameFromTagNo(this.relationSetting.RelationList[0].TagNo_1) : string.Empty; this.unitLabels[0].Text = (this.relationSetting.RelationList[0].TagNo_1 > 0) ? this.tagSetting.GetUnitFromTagNo(this.relationSetting.RelationList[0].TagNo_1) : string.Empty; //回転数はゼロ点無 this.dataValueLabels_Zero[0].Visible = false; // 回転数は追加しておく tagLabelList.Add(this.tagLabels[0]); dataValueLabelList.Add(this.dataValueLabels[0]); dataValueLabelZeroList.Add(this.dataValueLabels_Zero[0]); unitLabelList.Add(this.unitLabels[0]); var heightMargin = 5; for (int i = 0; i < this.measSetting.MeasTagList.Length; i++) { // タグ名と単位名の設定 this.tagLabels[i + 1].Text = (this.measSetting.MeasTagList[i] > 0) ? this.tagSetting.GetTagNameFromTagNo(this.measSetting.MeasTagList[i]) : string.Empty; this.unitLabels[i + 1].Text = (this.measSetting.MeasTagList[i] > 0) ? this.tagSetting.GetUnitFromTagNo(this.measSetting.MeasTagList[i]) : string.Empty; // 位置調整 if (i != 0) { this.tagLabels[i + 1].Top = tagLabelList.Last().Top + tagLabelList.Last().Height + heightMargin; this.dataValueLabels[i + 1].Top = dataValueLabelList.Last().Top + dataValueLabelList.Last().Height + heightMargin; this.dataValueLabels_Zero[i + 1].Top = this.dataValueLabels[i + 1].Top; this.unitLabels[i + 1].Top = unitLabelList.Last().Top + unitLabelList.Last().Height + heightMargin; } tagLabelList.Add(this.tagLabels[i + 1]); dataValueLabelList.Add(this.dataValueLabels[i + 1]); dataValueLabelZeroList.Add(this.dataValueLabels_Zero[i + 1]); unitLabelList.Add(this.unitLabels[i + 1]); // 測定項目No2の有無 if (this.measSetting.Mode == 1) { //ゼロ設定を表示するため調整 this.dataValueLabels[i + 1].Width -= this.dataValueLabels_Zero[i + 1].Width + 3; this.dataValueLabels[i + 1].Left += this.dataValueLabels_Zero[i + 1].Width + 3; // センサがRでかつ基準設定ならば if (this.chSetting.ChannelSettingList[i].ChKind == ChannelKindType.R && this.chSetting.ChannelSettingList[i].Mode1_Trigger == Mode1TriggerType.MAIN) { var tag = new Controls.AutoFontSizeLabel() { //Name = "lblItem" + (i + 1).ToString() + "-2" Name = tagLabelList.Last().Name + "-2" , Top = tagLabelList.Last().Top + tagLabelList.Last().Height + heightMargin , Left = this.tagLabels[0].Left , Width = this.tagLabels[0].Width , Height = this.tagLabels[0].Height , TextAlign = this.tagLabels[0].TextAlign , Font = new Font(this.tagLabels[i + 1].Font, this.tagLabels[i + 1].Font.Style) , AutoFontSize = ((Controls.AutoFontSizeLabel)this.tagLabels[i + 1]).AutoFontSize , MaxFontSize = ((Controls.AutoFontSizeLabel)this.tagLabels[i + 1]).MaxFontSize }; tag.Text = (this.relationSetting.RelationList[i + 1].TagNo_2 > 0) ? this.tagSetting.GetTagNameFromTagNo(this.relationSetting.RelationList[i + 1].TagNo_2) : string.Empty; if (isMeasure) pnlMain.Controls.Add(tag); else tabPage1.Controls.Add(tag); tagLabelList.Add(tag); var val = new Label() { //Name = "lblDataValue" + (i + 1).ToString() + "-2" Name = dataValueLabelList.Last().Name + "-2" , Top = dataValueLabelList.Last().Top + dataValueLabelList.Last().Height + heightMargin , Left = dataValueLabelList.Last().Left , Width = dataValueLabelList.Last().Width , Height = dataValueLabelList.Last().Height , TextAlign = dataValueLabelList.Last().TextAlign , Font = new Font(this.dataValueLabels[i + 1].Font, this.dataValueLabels[i + 1].Font.Style) , BorderStyle = BorderStyle.Fixed3D , BackColor = System.Drawing.Color.White }; val.Text = string.Empty; if (isMeasure) pnlMain.Controls.Add(val); else tabPage1.Controls.Add(val); dataValueLabelList.Add(val); var zero = new Label() { Name = dataValueLabelZeroList.Last().Name + "-2" , Top = dataValueLabelZeroList.Last().Top + dataValueLabelZeroList.Last().Height + heightMargin , Left = dataValueLabelZeroList.Last().Left , Width = dataValueLabelZeroList.Last().Width , Height = dataValueLabelZeroList.Last().Height , TextAlign = dataValueLabelZeroList.Last().TextAlign , Font = new Font(this.dataValueLabels_Zero[i + 1].Font, this.dataValueLabels_Zero[i + 1].Font.Style) , BorderStyle = BorderStyle.Fixed3D , BackColor = System.Drawing.Color.Transparent }; zero.Text = string.Empty; if (isMeasure) pnlMain.Controls.Add(zero); else tabPage1.Controls.Add(zero); dataValueLabelZeroList.Add(val); var unit = new Controls.AutoFontSizeLabel() { //Name = "lblUnit" + (i + 1).ToString() + "-2" Name = unitLabelList.Last().Name + "-2" , Top = unitLabelList.Last().Top + unitLabelList.Last().Height + heightMargin , Left = this.unitLabels[0].Left , Width = this.unitLabels[0].Width , Height = this.unitLabels[0].Height , TextAlign = this.unitLabels[0].TextAlign , Font = new Font(this.unitLabels[i + 1].Font, this.unitLabels[i + 1].Font.Style) , AutoFontSize = ((Controls.AutoFontSizeLabel)this.unitLabels[i + 1]).AutoFontSize , MaxFontSize = ((Controls.AutoFontSizeLabel)this.unitLabels[i + 1]).MaxFontSize }; unit.Text = (this.relationSetting.RelationList[i + 1].TagNo_2 > 0) ? this.tagSetting.GetUnitFromTagNo(this.relationSetting.RelationList[i + 1].TagNo_2) : string.Empty; if (isMeasure) pnlMain.Controls.Add(unit); else tabPage1.Controls.Add(unit); unitLabelList.Add(unit); } } } this.tagLabels = tagLabelList.ToArray(); this.dataValueLabels = dataValueLabelList.ToArray(); this.dataValueLabels_Zero = dataValueLabelZeroList.ToArray(); this.unitLabels = unitLabelList.ToArray(); // 回転タグ位置調整 if (this.measSetting.Mode == 3) { //Mode3は回転数をすべて消す this.tagLabels[0].Visible = false; this.dataValueLabels[0].Visible = false; this.dataValueLabels_Zero[0].Visible = false; this.unitLabels[0].Visible = false; //消すので最終タグのラベル位置に合わせる this.tagLabels[0].Top = this.tagLabels.Last().Top; this.dataValueLabels[0].Top = this.dataValueLabels.Last().Top; this.dataValueLabels_Zero[0].Top = this.dataValueLabels_Zero.Last().Top; this.unitLabels[0].Top = this.unitLabels.Last().Top; } else if (this.measSetting.Mode == 2 && this.isMeasure) { // 測定中Mode2では回転タグのみ表示する this.tagLabels[0].Top = this.dataValueLabels[0].Top = this.dataValueLabels_Zero[0].Top = this.lblTitle.Height + heightMargin; this.unitLabels[0].Top = this.tagLabels[0].Top + 2; for (int i = 1; i < tagLabels.Length; i++) { this.tagLabels[i].Visible = this.dataValueLabels[i].Visible = this.dataValueLabels_Zero[i].Visible = this.unitLabels[i].Visible = false; } } else { this.tagLabels[0].Top = this.tagLabels.Last().Top + this.tagLabels.Last().Height + heightMargin; this.dataValueLabels[0].Top = this.dataValueLabels.Last().Top + this.dataValueLabels.Last().Height + heightMargin; this.dataValueLabels_Zero[0].Top = this.dataValueLabels_Zero.Last().Top + this.dataValueLabels_Zero.Last().Height + heightMargin; this.unitLabels[0].Top = this.unitLabels.Last().Top + this.unitLabels.Last().Height + heightMargin; } // フォームサイズ調整 if (isMeasure) this.Height = this.unitLabels[0].Top + this.unitLabels[0].Height + lblTitle.Height + heightMargin; else { this.tabControl1.Height = this.unitLabels[0].Top + this.unitLabels[0].Height + lblTitle.Height + heightMargin * 2; this.pnlAnalysis.Height = this.tabControl1.Top + this.tabControl1.Height; this.Height = this.tabControl1.Top + this.tabControl1.Height; } //set data point display var temp = string.Empty; var tempTagPoint = 0; for (int i = 1; i <= this.measSetting.MeasTagList.Length; i++) { tempTagPoint = FindTagPoint(this.measSetting.MeasTagList[i - 1]); if (tempTagPoint != 0) { tagPoint[i] = "#,##0." + temp.PadLeft(tempTagPoint, '0'); } else { tagPoint[i] = "#,##0"; } } tempTagPoint = FindTagPoint(this.relationSetting.RelationList[0].TagNo_1); this.tagPoint[0] = tempTagPoint <= 0 ? "#,##0" : "#,##0." + temp.PadLeft(tempTagPoint, '0'); } }
///// <summary> ///// ����̃����W�f�[�^��擾���܂��B ///// </summary> ///// <param name="StartIndex"></param> ///// <param name="Count"></param> ///// <returns></returns> //public static List<SampleData> GetRangeDatas(int StartIndex, int Count) //{ // List<SampleData> ret = null; // return ret; //} /// <summary> /// RealTimeData�̏����� /// </summary> /// <returns></returns> public static bool InitData(ChannelsSetting ch_setting, MeasureSetting meas_setting, string folderPath) { if (bRecord) { RealMeasureData.EndTime = DateTime.MaxValue; RealMeasureData.StartTime = DateTime.Now; RealMeasureData.InitializeforMeasure(ch_setting, meas_setting, folderPath); FolderPath = folderPath; //�^�O�ݒ��Clone //RealTimeData.DataTagSetting = SystemSetting.DataTagSetting.Clone(); } Samples.Clear(); TmpAverage_Samples.Clear(); //���[�h�P����̏����� Cond_ShotCount_Mode1 = 0; Cond_StartTime_Mode1 = RealMeasureData.StartTime; Cond_StopTime_Mode1 = RealMeasureData.StartTime; receiveCount = 0; return true; }