public BarcodeStateForm(BarcodeState state, DialogMode mode)
 {
     InitializeComponent();
     InitializeComboBoxes();
     bc.ScaleMode = enumSCALE_MODE.Scale_Millimeter;
     bc.Barcode   = "12345";
     if (Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName == "ru")
     {
         bc.TopText    = "Заголовок";
         bc.BottomText = "Подпись";
     }
     else
     {
         bc.TopText    = "Top text";
         bc.BottomText = "Bottom text";
     }
     bc.BackColor = Color.White;
     if (state == null)
     {
         state = new BarcodeState(bc);
     }
     InitializeControlsValues(state);
     if (mode == DialogMode.Master)
     {
         btnBack.Visible = true;
         if (Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName == "ru")
         {
             btnOk.Text = "Далее";
         }
         else
         {
             btnOk.Text = "Next";
         }
     }
 }
Beispiel #2
0
 public BcProject(BcSource source, decimal plantId,
                  RewDataSet.BarcodeDataTable table,
                  BarcodeData data, BarcodeState state, BcLayout layout,
                  PageSettings pageSettings)
 {
     this.source       = source;
     this.plantId      = plantId;
     this.table        = table;
     this.data         = data;
     this.state        = state;
     this.layout       = layout;
     this.pageSettings = pageSettings;
 }
 void InitializeControlsValues(BarcodeState state)
 {
     cbSymb.SetSelectedText(state.symb);
     cbOptCheck.SetSelectedText(state.optCheck);
     cbOrient.SetSelectedText(state.orient);
     tbHeight.Text = state.heigth.ToString();
     tbNbw.Text    = state.nbWigth.ToString();
     cbCodePos.SetSelectedText(state.bcTextPos);
     cbBorder.SetSelectedText(state.border);
     cbQz.SetSelectedText(state.qZone);
     lBackColor.BackColor = state.bColor;
     lForeColor.BackColor = state.fColor;
     bc.BackColor         = state.bColor;
     bc.ForeColor         = state.fColor;
     chbBb.Checked        = state.bBars;
     bc.TopTextFont       = state.topFont;
     bc.BarcodeTextFont   = state.bcFont;
     bc.BottomTextFont    = state.botFont;
 }
Beispiel #4
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string   filename = "Project.bcp";
            BcSource source   = BcSource.Workers;
            decimal  plantId  = -1;

            RewDataSet.BarcodeDataTable table = null;
            BarcodeData  data   = null;
            BarcodeState state  = null;
            BcLayout     layout = null;

            int i = 0;

            do
            {
                DialogResult res = DialogResult.None;
                switch (i)
                {
                case 0:
                    saveFileDialog1.FileName = filename;
                    res      = saveFileDialog1.ShowDialog();
                    filename = saveFileDialog1.FileName;
                    break;

                case 1:
                    DataSourceForm dForm = new DataSourceForm(source, plantId,
                                                              connection, DialogMode.Master);
                    res    = dForm.ShowDialog();
                    source = dForm.GetSource(out plantId);
                    break;

                case 2:
                    switch (source)
                    {
                    case BcSource.Workers:
                        WorkFilterForm fWork = new WorkFilterForm(connection,
                                                                  table, plantId, DialogMode.Master);
                        res   = fWork.ShowDialog();
                        table = fWork.GetTable();
                        break;

                    case BcSource.Defects:
                        DefFilterForm fDef = new DefFilterForm(connection,
                                                               table, plantId, DialogMode.Master);
                        res   = fDef.ShowDialog();
                        table = fDef.GetTable();
                        break;

                    case BcSource.Repairs:
                        RepFilterForm fRep = new RepFilterForm(connection,
                                                               table, plantId, DialogMode.Master);
                        res   = fRep.ShowDialog();
                        table = fRep.GetTable();
                        break;
                    }
                    break;

                case 3:
                    BarcodeDataForm fData = new BarcodeDataForm(data,
                                                                DialogMode.Master);
                    res  = fData.ShowDialog();
                    data = fData.GetData();
                    break;

                case 4:
                    BarcodeStateForm fState = new BarcodeStateForm(state,
                                                                   DialogMode.Master);
                    res   = fState.ShowDialog();
                    state = fState.GetState();
                    break;

                case 5:
                    LayoutForm fLayout = new LayoutForm(layout, DialogMode.Master);
                    res    = fLayout.ShowDialog();
                    layout = fLayout.GetLayout();
                    break;
                }
                switch (res)
                {
                case DialogResult.Cancel:
                    return;

                case DialogResult.OK:
                    i++;
                    break;

                case DialogResult.Retry:
                    i--;
                    break;
                }
            }while (i < 6);
            BcProject project = new BcProject(source, plantId, table,
                                              data, state, layout, new PageSettings());

            try
            {
                project.Save(filename);
            }
            catch
            {
                MessageBox.Show("Cannot write file", "Save error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            hasChanges = false;
            AddToProjectList(filename);
        }