コード例 #1
0
        /// <summary>
        /// 保存设置
        /// </summary>
        public void save()
        {
            try
            {
                _outPut.Describe = labDescribe.Text;

                for (int i = 0; i < _chanNum; i++)
                {
                    _outPut.Chan[i].Vname  = vControl[i].txtName.Text;
                    _outPut.Chan[i].Vmin   = System.Convert.ToDouble(vControl[i].txtVmin.Text);
                    _outPut.Chan[i].Vmax   = System.Convert.ToDouble(vControl[i].txtVmax.Text);
                    _outPut.Chan[i].Imode  = vControl[i].cmbIMode.SelectedIndex;
                    _outPut.Chan[i].ISet   = System.Convert.ToDouble(vControl[i].txtISet.Text);
                    _outPut.Chan[i].Imin   = System.Convert.ToDouble(vControl[i].txtImin.Text);
                    _outPut.Chan[i].Imax   = System.Convert.ToDouble(vControl[i].txtImax.Text);
                    _outPut.Chan[i].QCType = (int)((EQCM)Enum.Parse(typeof(EQCM), (vControl[i].cmbQCM.Text)));
                    _outPut.Chan[i].QCV    = System.Convert.ToDouble(vControl[i].txtQCV.Text);
                }

                OnSaveArgs.OnEvented(new COutPutArgs(_idNo, _outPut));
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        /// <summary>
        /// 保存设置
        /// </summary>
        private bool save()
        {
            try
            {
                int countTime = 0;

                _OnOff.Describe = labDescribe.Text;

                _OnOff.TotalTime = (int)(System.Convert.ToDouble(txtTotalTime.Text) * 60);

                for (int i = 0; i < _OnOff.Item.Length; i++)
                {
                    _OnOff.Item[i].ChkSec = _udcOnOff[i].chkSec;

                    _OnOff.Item[i].OnOffTime = _udcOnOff[i].onoffTime;

                    _OnOff.Item[i].OnTime = _udcOnOff[i].onTime;

                    _OnOff.Item[i].OffTime = _udcOnOff[i].offTime;

                    _OnOff.Item[i].ACV = _udcOnOff[i].acv;

                    _OnOff.Item[i].OutPutType = _udcOnOff[i].outPutType;

                    if (_OnOff.Item[i].OnOffTime > 0)
                    {
                        if (_OnOff.Item[i].OnTime == 0 && _OnOff.Item[i].OffTime == 0)
                        {
                            MessageBox.Show("ONOFF" + (i + 1).ToString() + CLanguage.Lan("参数设置错误"));
                            return(false);
                        }

                        countTime = _OnOff.Item[i].OnOffTime * (_OnOff.Item[i].OnTime + _OnOff.Item[i].OffTime);
                    }
                }

                if (countTime == 0)
                {
                    MessageBox.Show("ONOFF1-4" + CLanguage.Lan("参数设置错误"));
                    return(false);
                }

                OnSaveArgs.OnEvented(new COnOffArgs(_idNo, _OnOff));

                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(false);
            }
        }
コード例 #3
0
        private void OnSaveThreadProc(object context)
        {
            OnSaveArgs osa = (OnSaveArgs)context;

            try
            {
                OnSave(osa);
            }

            catch (Exception ex)
            {
                osa.exception = ex;
            }
        }
コード例 #4
0
        protected override void OnSave(
            Document input,
            Stream output,
            SaveConfigToken token,
            Surface scratchSurface,
            ProgressEventHandler callback)
        {
            switch (Thread.CurrentThread.GetApartmentState())
            {
            // WIC does not support MTA, so we must marshal this stuff to another thread that is guaranteed to be STA.
            case ApartmentState.Unknown:
            case ApartmentState.MTA:
                ParameterizedThreadStart pts = new ParameterizedThreadStart(OnSaveThreadProc);

                OnSaveArgs osa = new OnSaveArgs();
                osa.input          = input;
                osa.output         = output;
                osa.token          = token;
                osa.scratchSurface = scratchSurface;
                osa.callback       = callback;

                Thread staThread = new Thread(pts);
                staThread.SetApartmentState(ApartmentState.STA);
                staThread.Start(osa);
                staThread.Join();

                if (osa.exception != null)
                {
                    throw new ApplicationException("OnSaveImpl() threw an exception", osa.exception);
                }
                break;

            case ApartmentState.STA:
                OnSaveImpl(input, output, token, scratchSurface, callback);
                break;

            default:
                throw new InvalidOperationException();
            }
        }
コード例 #5
0
 private void OnSave(OnSaveArgs args)
 {
     OnSaveImpl(args.input, args.output, args.token, args.scratchSurface, args.callback);
 }
コード例 #6
0
ファイル: HDPhotoFileType.cs プロジェクト: metadeta96/openpdn
 private void OnSave(OnSaveArgs args)
 {
     OnSaveImpl(args.input, args.output, args.token, args.scratchSurface, args.callback);
 }
コード例 #7
0
ファイル: HDPhotoFileType.cs プロジェクト: metadeta96/openpdn
        protected override void OnSave(
            Document input, 
            Stream output, 
            SaveConfigToken token, 
            Surface scratchSurface, 
            ProgressEventHandler callback)
        {
            switch (Thread.CurrentThread.GetApartmentState())
            {
                // WIC does not support MTA, so we must marshal this stuff to another thread that is guaranteed to be STA.
                case ApartmentState.Unknown:
                case ApartmentState.MTA:
                    ParameterizedThreadStart pts = new ParameterizedThreadStart(OnSaveThreadProc);

                    OnSaveArgs osa = new OnSaveArgs();
                    osa.input = input;
                    osa.output = output;
                    osa.token = token;
                    osa.scratchSurface = scratchSurface;
                    osa.callback = callback;

                    Thread staThread = new Thread(pts);
                    staThread.SetApartmentState(ApartmentState.STA);
                    staThread.Start(osa);
                    staThread.Join();

                    if (osa.exception != null)
                    {
                        throw new ApplicationException("OnSaveImpl() threw an exception", osa.exception);
                    }
                    break;

                case ApartmentState.STA:
                    OnSaveImpl(input, output, token, scratchSurface, callback);
                    break;

                default:
                    throw new InvalidOperationException();
            }
        }