private void butChangeRegKey_Click(object sender, EventArgs e)
        {
            FormRegistrationKey formR = new FormRegistrationKey();

            formR.ShowDialog();
            DataValid.SetInvalid(InvalidType.Prefs);
            string regkey = PrefC.GetString(PrefName.RegistrationKey);

            if (regkey.Length == 16)
            {
                textRegKey.Text = regkey.Substring(0, 4) + "-" + regkey.Substring(4, 4) + "-" + regkey.Substring(8, 4) + "-" + regkey.Substring(12, 4);
            }
            else
            {
                textRegKey.Text = regkey;
            }
            IsDone = !string.IsNullOrEmpty(textRegKey.Text);
            groupProcTools.Enabled = IsDone;
        }
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            Operatory         opCur   = (Operatory)gridMain.ListGridRows[e.Row].Tag;
            FormOperatoryEdit FormOE  = new FormOperatoryEdit(opCur);
            List <Operatory>  listOld = new List <Operatory>();

            foreach (Operatory op in _listOps)
            {
                listOld.Add(op.Copy());
            }
            FormOE.ListOps = _listOps;
            FormOE.ShowDialog();
            if (FormOE.DialogResult == DialogResult.OK)
            {
                Operatories.Sync(_listOps, listOld);
                FillGrid();
                DataValid.SetInvalid(InvalidType.Operatories);
            }
        }
        private void butAdd_Click(object sender, EventArgs e)
        {
            FormOperatoryEdit FormOE = new FormOperatoryEdit(new Operatory());

            FormOE.IsNew = true;
            List <Operatory> listOld = new List <Operatory>();

            foreach (Operatory op in _listOps)
            {
                listOld.Add(op.Copy());
            }
            FormOE.ListOps = _listOps;
            FormOE.ShowDialog();
            if (FormOE.DialogResult == DialogResult.OK)
            {
                Operatories.Sync(_listOps, listOld);
                FillGrid();
                DataValid.SetInvalid(InvalidType.Operatories);
            }
        }
        private void ControlDone(object sender, EventArgs e)
        {
            //Correct the item orders of all definition categories.
            List <Def> listDefUpdates = new List <Def>();

            foreach (KeyValuePair <DefCat, List <Def> > kvp in Defs.GetDeepCopy())
            {
                for (int i = 0; i < kvp.Value.Count; i++)
                {
                    if (kvp.Value[i].ItemOrder != i)
                    {
                        kvp.Value[i].ItemOrder = i;
                        listDefUpdates.Add(kvp.Value[i]);
                    }
                }
            }
            listDefUpdates.ForEach(x => Defs.Update(x));
            if (_isDefChanged || listDefUpdates.Count > 0)
            {
                DataValid.SetInvalid(InvalidType.Defs);
            }
        }
Esempio n. 5
0
        private void ControlDone(object sender, EventArgs e)
        {
            string compName = SystemInformation.ComputerName;

            if (checkSimple.Checked && !PrefC.GetBool(PrefName.EasyHidePrinters))
            {
                Printers.ClearAll();
                Printers.RefreshCache();
                string printerName = "";
                if (comboDefault.SelectedIndex == 0)
                {
                    printerName = "";
                }
                else
                {
                    printerName = PrinterSettings.InstalledPrinters[comboDefault.SelectedIndex - 1];
                }
                Printers.PutForSit(PrintSituation.Default, compName, printerName, true);
            }
            else
            {
                for (int i = 0; i < Enum.GetValues(typeof(PrintSituation)).Length; i++)
                {
                    //loop through each printSituation
                    string printerName = "";
                    bool   isChecked   = false;
                    //PrintSituation sit=PrintSituation.Default;
                    //first: main Default, since not in panel Simple
                    if (i == 0)           //printSituation.Default
                    {
                        if (comboDefault.SelectedIndex == 0)
                        {
                            printerName = "";
                        }
                        else
                        {
                            printerName = PrinterSettings.InstalledPrinters[comboDefault.SelectedIndex - 1];
                        }
                    }
                    foreach (Control control in panelSimple.Controls)
                    {
                        if (control.GetType() != typeof(ComboBox) &&          //skip anything but comboBoxes and CheckBoxes
                            control.GetType() != typeof(CheckBox))
                        {
                            continue;
                        }
                        //so only two controls out of all will be used in each Enum loop
                        if (GetSit(control) != (PrintSituation)i)
                        {
                            continue;
                        }
                        if (control.GetType() == typeof(ComboBox))
                        {
                            if (((ComboBox)control).SelectedIndex == 0)
                            {
                                printerName = "";
                            }
                            else
                            {
                                printerName = PrinterSettings.InstalledPrinters[((ComboBox)control).SelectedIndex - 1];
                            }
                        }
                        else                  //checkBox
                        {
                            isChecked = ((CheckBox)control).Checked;
                        }
                    }
                    Printers.PutForSit((PrintSituation)i, compName, printerName, isChecked);
                }
            }
            DataValid.SetInvalid(InvalidType.Computers);
            if (checkSimple.Checked != PrefC.GetBool(PrefName.EasyHidePrinters))
            {
                Prefs.UpdateBool(PrefName.EasyHidePrinters, checkSimple.Checked);
                DataValid.SetInvalid(InvalidType.Prefs);
            }
            Printers.RefreshCache();            //the other computers don't care
            ComputerPrefs.LocalComputer.ScanDocSelectSource = checkScanDocSelectSource.Checked;
            ComputerPrefs.LocalComputer.ScanDocShowOptions  = radioScanDocShowOptions.Checked;
            ComputerPrefs.LocalComputer.ScanDocDuplex       = checkScanDocDuplex.Checked;
            ComputerPrefs.LocalComputer.ScanDocGrayscale    = checkScanDocGrayscale.Checked;
            ComputerPrefs.LocalComputer.ScanDocResolution   = PIn.Int(textScanDocResolution.Text);
            ComputerPrefs.LocalComputer.ScanDocQuality      = PIn.Byte(textScanDocQuality.Text);
            ComputerPrefs.Update(ComputerPrefs.LocalComputer);
            DataValid.SetInvalid(InvalidType.Prefs);
        }