Example #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;
        }