Ejemplo n.º 1
0
 private void btnZetOplopend_Click(object sender, EventArgs e)
 {
     if (lbLocaties.SelectedItem != null)
     {
         InstellingString selected = (InstellingString)lbLocaties.SelectedItem;
         if (selected.Standaard)
         {
             selected.Sortering = SORTERING.OPLOPEND;
             MailSAVerTwee.Properties.Settings.Default.LocatieStandaard = selected.SorteringMetPad();
         }
         else if (selected.Anders)
         {
             selected.Sortering = SORTERING.OPLOPEND;
             MailSAVerTwee.Properties.Settings.Default.LocatieAnders = selected.SorteringMetPad();
         }
         else
         {
             MailSAVerTwee.Properties.Settings.Default.Locaties.Remove(selected.SorteringMetPad());
             selected.Sortering = SORTERING.OPLOPEND;
             MailSAVerTwee.Properties.Settings.Default.Locaties.Add(selected.SorteringMetPad());
         }
         SaveAndReload();
         VulLocaties();
     }
 }
Ejemplo n.º 2
0
        private void VoegLocatieToe(String pad)
        {
            if (pad != null)
            {
                //default is oplopend +
                InstellingString locatie = getObjectVanPad("+" + pad);
                //Als het ingevoerde pad niet bestaat, melding geven
                if (Directory.Exists(locatie.Pad))
                {
                    if (locatie.Pad != "")
                    {
                        //Als er nog geen \ achter staat, voeg die toe
                        if (!locatie.Pad.EndsWith(@"\"))
                        {
                            locatie.Pad = locatie.Pad + @"\";
                        }
                        //Ingevoerde pad moet niet al voorkomen
                        bool staatInLijst = false;

                        //Als het pad gelijk is aan de standaard
                        if (MailSAVerTwee.Properties.Settings.Default.LocatieStandaard == pad)
                        {
                            staatInLijst = true;
                        }
                        //Als het pad gelijk is aan de Anders
                        else if (MailSAVerTwee.Properties.Settings.Default.LocatieAnders == pad)
                        {
                            staatInLijst = true;
                        }
                        //Als het pad gelijk is aan een van de locaties
                        foreach (String gelijk in MailSAVerTwee.Properties.Settings.Default.Locaties)
                        {
                            if (gelijk == locatie.Pad)
                            {
                                staatInLijst = true;
                            }
                        }
                        //Als hij nog niet in de lijst staat, voeg hem dan toe
                        if (!staatInLijst)
                        {
                            MailSAVerTwee.Properties.Settings.Default.Locaties.Add(locatie.SorteringMetPad());
                            SaveAndReload();
                            VulLocaties();
                        }
                        else
                        {
                            MessageBox.Show("Ingevoerd pad: '" + pad + "' staat al in de lijst!", "MailSAVer: Melding", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Ingevoerd pad: '" + pad + "' is niet correct!", "MailSAVer: Melding", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
Ejemplo n.º 3
0
 private void btnLocatieVerwijder_Click(object sender, EventArgs e)
 {
     if (lbLocaties.SelectedItem != null)
     {
         InstellingString selected = (InstellingString)lbLocaties.SelectedItem;
         MailSAVerTwee.Properties.Settings.Default.Locaties.Remove(selected.SorteringMetPad());
         SaveAndReload();
         VulLocaties();
     }
 }
Ejemplo n.º 4
0
        private void btnLocatieZetAnders_Click(object sender, EventArgs e)
        {
            if (lbLocaties.SelectedItem != null)
            {
                InstellingString selected      = (InstellingString)lbLocaties.SelectedItem;
                String           padoudeanders = MailSAVerTwee.Properties.Settings.Default.LocatieAnders;

                MailSAVerTwee.Properties.Settings.Default.LocatieAnders = selected.SorteringMetPad();
                MailSAVerTwee.Properties.Settings.Default.Locaties.Remove(selected.SorteringMetPad());
                VoegLocatieToe(SaveManager.Instance.getPadZonderSortering(padoudeanders));
                SaveAndReload();
                VulLocaties();
            }
        }
Ejemplo n.º 5
0
        private void VulLocaties()
        {
            lbLocaties.Items.Clear();
            //Standaard locatie
            InstellingString standaard = new InstellingString(SaveManager.Instance.GetDefaultPad());

            standaard.Standaard = true;
            lbLocaties.Items.Add(standaard);
            //Overige locaties oplopend
            foreach (LocatieString locatie in SaveManager.Instance.GetLocaties())
            {
                InstellingString favoriet = new InstellingString(locatie);
                lbLocaties.Items.Add(favoriet);
            }
            //Anders locatie
            InstellingString anders = new InstellingString(SaveManager.Instance.GetAndersPad());

            anders.Anders = true;
            lbLocaties.Items.Add(anders);
        }
Ejemplo n.º 6
0
        private InstellingString getObjectVanPad(string pad)
        {
            string orderchar = pad.Substring(0, 1);

            if (orderchar != "+" &&
                orderchar != "-")
            {
                MessageBox.Show("Fout in pad");
            }
            string           orderremoved = pad.Substring(1);
            InstellingString locatie      = new InstellingString(orderremoved);

            if (orderchar == "+")
            {
                locatie.Sortering = SORTERING.OPLOPEND;
            }
            else if (orderchar == "-")
            {
                locatie.Sortering = SORTERING.AFLOPEND;
            }
            return(locatie);
        }