コード例 #1
0
        private void FillTypeSerrBox()
        {
            string[] lines = File.ReadAllLines(@"\\Serv-kalysse\EDatas\Dev\Datas\Casiers\serrures_config.txt");

            if (lines.Length > 2)
            {
                TypeSerrBox.Items.Clear();
                for (int i = 2; i < lines.Length; i++)
                {
                    string[] line = lines[i].Split(';');

                    if (line.Length != 3)
                    {
                        continue;
                    }
                    string name = line[0];
                    TypeSerrBox.Items.Add(name);

                    LockInfos infos = new LockInfos
                    {
                        Name  = name,
                        Code1 = line[1],
                        Code2 = line[2]
                    };
                    Locks.Add(infos);
                }
                TypeSerrBox.SelectedIndex = 0;
            }
        }
コード例 #2
0
        private Locker CreateLockerFromInfos()
        {
            string type       = "";
            int    entraxe    = EntraxeUpDown.Value.GetValueOrDefault();
            string typeSerr   = "";
            int    kitPiedPat = 0;
            int    isPend     = 0;
            int    typePlaq   = 0;

            // type
            if ((LockTypeBox.SelectedItem as ComboBoxItem) != null)
            {
                type = (LockTypeBox.SelectedItem as ComboBoxItem).Content.ToString();
            }

            // type serrure
            if (TypeSerrBox.SelectedItem != null)
            {
                string typeSerrSelected = TypeSerrBox.SelectedItem.ToString();

                LockInfos selectedLock = Locks.Find(l => l.Name == typeSerrSelected);

                typeSerr = $"{selectedLock.Name},{selectedLock.Code1},{selectedLock.Code2}";
            }

            // type plaque
            if ((PlaqueBox.SelectedItem as ComboBoxItem) != null)
            {
                string typePlaqSelected = (PlaqueBox.SelectedItem as ComboBoxItem).Content.ToString();

                if (typePlaqSelected == "Plaquette gravée 80x30 Gravoply")
                {
                    typePlaq = 1;
                }
                else if (typePlaqSelected == "Plaquette 70x40 Ojmar marquage Kalysse")
                {
                    typePlaq = 2;
                }
                else
                {
                    typePlaq = 0;
                }
            }

            // pied / patere
            if ((bool)PiedCheck.IsChecked)
            {
                kitPiedPat++;
            }
            if ((bool)PatereCheck.IsChecked)
            {
                kitPiedPat += 2;
            }

            // cintres
            if ((PenderieBox.SelectedItem as ComboBoxItem) != null)
            {
                string isPendSelected = (PenderieBox.SelectedItem as ComboBoxItem).Content.ToString();

                if (isPendSelected == "Oui avec cintres")
                {
                    isPend = 1;
                }
                else if (isPendSelected == "Oui sans cintres")
                {
                    isPend = 2;
                }
                else
                {
                    isPend = 0;
                }
            }

            return(new Locker(type, entraxe, typeSerr, kitPiedPat, isPend, typePlaq));
        }