コード例 #1
0
        private void WriteLog(DeviceCommViewModel.DeviceName diviceName, string com = null, string intUsed = null, string Param = null)
        {
            string log = lcSaveDevice.Text + _space;

            log += lcDeviceName.Text + _colon + diviceName.ToString() + _space;
            log += lcComName.Text + _colon + com + _space;
            if (intUsed != null)
            {
                log += lcUseDevice.Text + _colon + (intUsed.Trim() == "1" ? lcUseDevice.Text : lcNotUseDevice.Text);
            }
            if (Param != null)
            {
                try
                {
                    if (diviceName == DeviceCommViewModel.DeviceName.LicenseRecog || diviceName == DeviceCommViewModel.DeviceName.SecurityCamera)
                    {
                        object o = JsonNewtonsoft.FromJSON(Param);
                        if (o is JObject && o != null)
                        {
                            log += _space + gcUserName.Text + _colon + (o as JObject)["userName"].ToString() + _space;
                            log += _space + lcPassword2.Text + _colon + (o as JObject)["Password"].ToString() + _space;
                        }
                    }
                    if (diviceName == DeviceCommViewModel.DeviceName.Plat)
                    {
                        log += lcPlatNum.Text + _colon + Param + _space;
                    }
                }
                catch { }
            }
            ErrorLog.SystemLog(DateTime.Now, log);
        }
コード例 #2
0
 /// <summary>
 /// 保存设备参数修改
 /// </summary>
 /// <param name="diviceName">设备名</param>
 /// <param name="com">设备通讯</param>
 /// <param name="intUsed">是否启用</param>
 /// <param name="Param">其他参数</param>
 protected virtual bool SaveDeviceComChanges(DeviceCommViewModel.DeviceName diviceName, string com = null, string intUsed = null, string Param = null)
 {
     //开启等待窗口
     //SplashScreenManager.ShowForm(this.ParentForm, typeof(wfMain), false, true);
     DeviceCommViewModel.VM.Execute(new List <object> {
         DeviceCommViewModel.ExecuteCommand.ec_SaveDeviceChange,
         diviceName.ToString(),
         com,
         intUsed,
         Param,
     });
     WriteLog(diviceName, com, intUsed, Param);
     if (!DeviceCommViewModel.VM.SaveDeviceChangeEntities /*&& DeviceCommViewModel.VM.SendDeviceToSOAEntities.Result*/)
     {
         //XtraMessageBox.Show(SaveCompleted.Text);
         //return true;
         ErrorLog.Error(SaveFail.Text);
         XtraMessageBox.Show(SaveFail.Text);
         return(false);
     }
     //XtraMessageBox.Show(SaveFail.Text);
     //return false;
     return(true);
 }