示例#1
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///
        ///
        public void OnPrinterPropertyChange(SPrinterProperty sp)
        {
            bool bSupperUser = (PubFunc.GetUserPermission() == (int)UserPermission.SupperUser);

            m_sPrinterProperty = sp;
            m_CheckedListBoxColor.Items.Clear();
            int colornum = sp.GetRealColorNum();

            for (int i = 0; i < colornum; i++)
            {
                ColorEnum color = (ColorEnum)sp.eColorOrder[i];
                string    cmode = ResString.GetEnumDisplayName(typeof(ColorEnum), color);
                m_CheckedListBoxColor.Items.Add(cmode);
                m_CheckedListBoxColor.SetItemChecked(i, true);
            }
            m_ComboBoxBaseColor.Items.Clear();
            for (int i = 0; i < colornum; i++)
            {
                ColorEnum color = (ColorEnum)sp.eColorOrder[i];
                string    cmode = ResString.GetEnumDisplayName(typeof(ColorEnum), color);
                m_ComboBoxBaseColor.Items.Add(cmode);
                comboBoxYStepColor1.Items.Add(cmode);
                comboBoxYStepColor2.Items.Add(cmode);
            }
            m_CheckedListBoxPass.Visible =
                m_LabelPass.Visible      = bSupperUser;

            UIPreference.SetSelectIndexAndClampWithMax(m_ComboBoxBaseColor, 0);
            UIPreference.SetSelectIndexAndClampWithMax(comboBoxYStepColor1, 0);
            UIPreference.SetSelectIndexAndClampWithMax(comboBoxYStepColor2, 0);

            m_TextBoxCleanPoint.Text = "0";
            m_TextBoxBaseStep.Text   = sp.nStepPerHead.ToString();

            m_TextBoxCleanPoint.Visible =
                m_LabelBaseStep.Visible = m_TextBoxBaseStep.Visible = bSupperUser;

            UIPreference.SetSelectIndexAndClampWithMax(m_ComboBoxHighSpeed, sp.eSpeedMap[0]);
            UIPreference.SetSelectIndexAndClampWithMax(m_ComboBoxMiddleSpeed, sp.eSpeedMap[1]);
            UIPreference.SetSelectIndexAndClampWithMax(m_ComboBoxLowSpeed, sp.eSpeedMap[2]);
            m_ComboBoxHighSpeed.Visible        =
                m_ComboBoxMiddleSpeed.Visible  =
                    m_ComboBoxLowSpeed.Visible = bSupperUser;

            ObjectContainer contain = new ObjectContainer();

            contain.Info    = null;
            contain.Index   = -1;
            contain.Object  = sp;
            contain.ObjType = sp.GetType();
            m_TreeViewPrinterProperty.Tag = contain;

            m_TreeViewPrinterProperty.Nodes.Clear();
            PubFunc.AddNode(sp.GetType().Name, sp, m_TreeViewPrinterProperty.Nodes, null, null, -1);
            label1.Visible = m_TreeViewPrinterProperty.Visible = bSupperUser;

            this.comboBoxYStepColor1.Visible = this.label4.Visible = sp.EPSONLCD_DEFINED;
            this.comboBoxYStepColor2.Visible = this.label5.Visible = sp.EPSONLCD_DEFINED;

            m_ComboBoxSpeed.Items.Clear();
            foreach (SpeedEnum mode in Enum.GetValues(typeof(SpeedEnum)))
            {
                if (mode == SpeedEnum.CustomSpeed)
                {
                    if (!PubFunc.IsCustomSpeedDisp(sp.ePrinterHead))
                    {
                        continue;
                    }
                }
                string cmode = ResString.GetEnumDisplayName(typeof(SpeedEnum), mode);
                if (SPrinterProperty.IsEpson(sp.ePrinterHead))
                {
                    cmode = "VSD_" + ((int)mode + 1).ToString();
                }
                m_ComboBoxSpeed.Items.Add(cmode);
            }

            m_LabelHighSpeed.Visible        =
                m_LabelMiddleSpeed.Visible  =
                    m_LabelLowSpeed.Visible =

                        m_LabelCleanPoint.Visible =
                            labelSpeed.Visible    = m_ComboBoxSpeed.Visible = bSupperUser;
            //this.isDirty = false;
        }
示例#2
0
        /// <summary>
        /// 获取当前累计已消耗墨量
        /// </summary>
        /// <returns></returns>
        private List <Tuple <ColorEnum, double> > GetUsedInk()
        {
            List <Tuple <ColorEnum, double> > curInks = new List <Tuple <ColorEnum, double> >();

            try
            {
                if (EpsonLCD.IsNewDurationInkCmd())
                {
                    //pl墨量统计

                    #region PL单位墨量统计

                    long[] durationInk = new long[8];
                    if (EpsonLCD.GetDurationInk(ref durationInk))
                    {
                        List <MbInfo> list = GetMbList();
                        for (int i = 1; i < list.Count; i++) //多个主板 将每一个的都加到pwdinfo1里面
                        {
                            long[] durationInk2 = new long[8];
                            if (EpsonLCD.GetDurationInk(ref durationInk2, list[i].MbId))
                            {
                                if (durationInk2 == null)
                                {
                                    durationInk2 = durationInk;
                                }
                                else
                                {
                                    for (int j = 0; j < durationInk.Length; j++)
                                    {
                                        durationInk[j] += durationInk2[j];
                                    }
                                }
                            }
                        }

                        SPrinterProperty PrinterProperty = new SPrinterProperty();
                        CoreInterface.GetSPrinterProperty(ref PrinterProperty);
                        int colornum = PrinterProperty.GetRealColorNum();
                        for (int i = 0; i < colornum; i++)
                        {
                            if (i < durationInk.Length)
                            {
                                Tuple <ColorEnum, double> ink = new Tuple <ColorEnum, double>(
                                    (ColorEnum)PrinterProperty.eColorOrder[i],
                                    (((double)durationInk[i]) / (Math.Pow(10, 12))));
                                curInks.Add(ink);
                            }
                        }
                    }
                    else
                    {
                        LogWriter.SaveOptionLog("GetUsedInk:GetDurationInk fail!");
                    }
                    #endregion
                }
                else
                {
                    LogWriter.SaveOptionLog("GetUsedInk:IsNewDurationInkCmd=false!");
                    List <MbInfo> list     = GetMbList();
                    SPwdInfo      pwdinfo1 = new SPwdInfo();
                    for (int i = 1; i < list.Count; i++)
                    {
                        SPwdInfo pwdinfo2 = new SPwdInfo();
                        if (CoreInterface.GetPWDInfo(ref pwdinfo2, list[i].MbId) != 0)
                        {
                            if (pwdinfo1.nDurationInk == null)
                            {
                                pwdinfo1 = pwdinfo2;
                            }
                            else
                            {
                                for (int j = 0; j < pwdinfo1.nDurationInk.Length; j++)
                                {
                                    pwdinfo1.nDurationInk[j] += pwdinfo2.nDurationInk[j];
                                }
                            }
                        }
                    }

                    string mbversion = string.Empty;
                    if (pwdinfo1.nDurationInk != null)
                    {
                        SPrinterProperty PrinterProperty = new SPrinterProperty();
                        CoreInterface.GetSPrinterProperty(ref PrinterProperty);
                        int colornum = PrinterProperty.GetRealColorNum();
                        for (int i = 0; i < colornum && i < pwdinfo1.nDurationInk.Length; i++)
                        {
                            Tuple <ColorEnum, double> ink =
                                new Tuple <ColorEnum, double>((ColorEnum)PrinterProperty.eColorOrder[i],
                                                              pwdinfo1.nDurationInk[i]);
                            curInks.Add(ink);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogWriter.SaveOptionLog("GetUsedInk:Exception=" + ex.Message);
            }

            return(curInks);
        }