private void InitializeDataContext() { HoldingSectionParams = (HoldingSectionParams)ProjectPropertyManager.ProjectPropertyDic["HoldingSectParams"]; DataContext = HoldingSectionParams; MStackPanel1.DataContext = this; MStackPanel2.DataContext = this; DStackPanel1.DataContext = this; DStackPanel2.DataContext = this; SStackPanel1.DataContext = this; SStackPanel2.DataContext = this; CVStackPanel1.DataContext = this; CVStackPanel2.DataContext = this; }
/// <summary> /// 写入所有参数设置 /// </summary> /// <param name="pmodel">工程类</param> static private void WriteParameters(ProjectModel pmodel) { int szid = odata.Count(); odata.Add(0x00); odata.Add(0x00); CommunicationInterfaceParams com232params = (CommunicationInterfaceParams)(ProjectPropertyManager.ProjectPropertyDic["CommunParams232"]); CommunicationInterfaceParams com485params = (CommunicationInterfaceParams)(ProjectPropertyManager.ProjectPropertyDic["CommunParams485"]); PasswordParams pwparams = (PasswordParams)(ProjectPropertyManager.ProjectPropertyDic["PasswordParams"]); FilterParams ftparams = (FilterParams)(ProjectPropertyManager.ProjectPropertyDic["FilterParams"]); HoldingSectionParams hsparams = (HoldingSectionParams)(ProjectPropertyManager.ProjectPropertyDic["HoldingSectParams"]); odata.Add(Int32_Low(com232params.BaudRateIndex)); odata.Add(Int32_Low(com232params.DataBitIndex)); odata.Add(Int32_Low(com232params.StopBitIndex)); odata.Add(Int32_Low(com232params.CheckCodeIndex)); odata.Add(Int32_Low(com485params.BaudRateIndex)); odata.Add(Int32_Low(com485params.DataBitIndex)); odata.Add(Int32_Low(com485params.StopBitIndex)); odata.Add(Int32_Low(com485params.CheckCodeIndex)); odata.Add(Int32_Low(com232params.StationNum)); odata.Add(Int32_Low(Int32_Low(com232params.Timeout))); odata.Add(Int32_Low(Int32_High(com232params.Timeout))); odata.Add((byte)(pwparams.UPIsChecked ? 1 : 0)); WriteO(pwparams.UPassword); odata.Add((byte)(com232params.CommuType)); odata.Add((byte)(com485params.CommuType)); odata.Add((byte)(pwparams.DPIsChecked ? 1 : 0)); WriteO(pwparams.DPassword); odata.Add((byte)(pwparams.MPIsChecked ? 1 : 0)); WriteO(pwparams.MPassword); odata.Add((byte)(ftparams.IsChecked ? 1 : 0)); int fttime = 1 << (ftparams.FilterTimeIndex + 1); odata.Add(Int32_Low(fttime)); odata.Add(Int32_High(fttime)); odata.Add(Int32_Low(hsparams.MStartAddr)); odata.Add(Int32_High(hsparams.MStartAddr)); odata.Add(Int32_Low(hsparams.MLength)); odata.Add(Int32_High(hsparams.MLength)); odata.Add(Int32_Low(hsparams.SStartAddr)); odata.Add(Int32_High(hsparams.SStartAddr)); odata.Add(Int32_Low(hsparams.SLength)); odata.Add(Int32_High(hsparams.SLength)); odata.Add(Int32_Low(hsparams.DStartAddr)); odata.Add(Int32_High(hsparams.DStartAddr)); odata.Add(Int32_Low(hsparams.DLength)); odata.Add(Int32_High(hsparams.DLength)); odata.Add(Int32_Low(hsparams.CVStartAddr)); odata.Add(Int32_High(hsparams.CVStartAddr)); odata.Add(Int32_Low(hsparams.CVLength)); odata.Add(Int32_High(hsparams.CVLength)); int sz = odata.Count() - szid - 2; odata[szid] = Int32_Low(sz); odata[szid + 1] = Int32_High(sz); }